struct OutlinableRegion
Declaration
struct OutlinableRegion { /* full declaration omitted */ };
Description
The OutlinableRegion holds all the information for a specific region, or sequence of instructions. This includes what values need to be hoisted to arguments from the extracted function, inputs and outputs to the region, and mapping from the extracted function arguments to overall function arguments.
Declared at: llvm/include/llvm/Transforms/IPO/IROutliner.h:63
Member Variables
- public llvm::IRSimilarity::IRSimilarityCandidate* Candidate = nullptr
- Describes the region of code.
- public llvm::IRSimilarity::IRInstructionData* NewFront = nullptr
- If this region is outlined, the front and back IRInstructionData could potentially become invalidated if the only new instruction is a call. This ensures that we replace in the instruction in the IRInstructionData.
- public llvm::IRSimilarity::IRInstructionData* NewBack = nullptr
- public unsigned int NumExtractedInputs = 0
- The number of extracted inputs from the CodeExtractor.
- public unsigned int OutputBlockNum = -1
- The corresponding BasicBlock with the appropriate stores for this OutlinableRegion in the overall function.
- public DenseMap<unsigned int, unsigned int> ExtractedArgToAgg
- Mapping the extracted argument number to the argument number in the overall function. Since there will be inputs, such as elevated constants that are not the same in each region in a SimilarityGroup, or values that cannot be sunk into the extracted section in every region, we must keep track of which extracted argument maps to which overall argument.
- public DenseMap<unsigned int, unsigned int> AggArgToExtracted
- public DenseMap<llvm::Value*, llvm::Value*> RemappedArguments
- Values in the outlined functions will often be replaced by arguments. When finding corresponding values from one region to another, the found value will be the value the argument previously replaced. This structure maps any replaced values for the region to the aggregate aggregate argument in the overall function.
- public bool ChangedArgOrder = false
- Marks whether we need to change the order of the arguments when mapping the old extracted function call to the new aggregate outlined function call.
- public bool EndsInBranch = false
- Marks whether this region ends in a branch, there is special handling required for the following basic blocks in this case.
- public DenseMap<llvm::Value*, llvm::BasicBlock*> PHIBlocks
- The PHIBlocks with their corresponding return block based on the return value as the key.
- public DenseMap<unsigned int, llvm::Constant*> AggArgToConstant
- Mapping of the argument number in the deduplicated function to a given constant, which is used when creating the arguments to the call to the newly created deduplicated function. This is handled separately since the CodeExtractor does not recognize constants.
- public SmallVector<unsigned int, 4> GVNStores
- The global value numbers that are used as outputs for this section. Once extracted, each output will be stored to an output register. This documents the global value numbers that are used in this pattern.
- public llvm::CodeExtractor* CE = nullptr
- Used to create an outlined function.
- public llvm::CallInst* Call = nullptr
- The call site of the extracted region.
- public llvm::Function* ExtractedFunction = nullptr
- The function for the extracted region.
- public bool CandidateSplit = false
- Flag for whether we have split out the IRSimilarityCanidate. That is, make the region contained the IRSimilarityCandidate its own BasicBlock.
- public bool IgnoreRegion = false
- Flag for whether we should not consider this region for extraction.
- public llvm::BasicBlock* PrevBB = nullptr
- The BasicBlock that is before the start of the region BasicBlock, only defined when the region has been split.
- public llvm::BasicBlock* StartBB = nullptr
- The BasicBlock that contains the starting instruction of the region.
- public llvm::BasicBlock* EndBB = nullptr
- The BasicBlock that contains the ending instruction of the region.
- public llvm::BasicBlock* FollowBB = nullptr
- The BasicBlock that is after the start of the region BasicBlock, only defined when the region has been split.
- public OutlinableGroup* Parent = nullptr
- The Outlinable Group that contains this region and structurally similar regions to this region.
Method Overview
- public OutlinableRegion(llvm::IRSimilarity::IRSimilarityCandidate & C, OutlinableGroup & Group)
- public llvm::BasicBlock * findCorrespondingBlockIn(const llvm::OutlinableRegion & Other, llvm::BasicBlock * BB)
- public llvm::Value * findCorrespondingValueIn(const llvm::OutlinableRegion & Other, llvm::Value * V)
- public llvm::InstructionCost getBenefit(llvm::TargetTransformInfo & TTI)
- public void reattachCandidate()
- public void splitCandidate()
Methods
¶OutlinableRegion(
llvm::IRSimilarity::IRSimilarityCandidate& C,
OutlinableGroup& Group)
OutlinableRegion(
llvm::IRSimilarity::IRSimilarityCandidate& C,
OutlinableGroup& Group)
Declared at: llvm/include/llvm/Transforms/IPO/IROutliner.h:153
Parameters
¶llvm::BasicBlock* findCorrespondingBlockIn(
const llvm::OutlinableRegion& Other,
llvm::BasicBlock* BB)
llvm::BasicBlock* findCorrespondingBlockIn(
const llvm::OutlinableRegion& Other,
llvm::BasicBlock* BB)
Description
Find a corresponding BasicBlock for \p BB in similar OutlinableRegion \p Other.
Declared at: llvm/include/llvm/Transforms/IPO/IROutliner.h:183
Parameters
- const llvm::OutlinableRegion& Other
- [in] - The OutlinableRegion to find the corresponding BasicBlock in.
- llvm::BasicBlock* BB
- [in] - The BasicBlock to look for in the other region.
Returns
The corresponding Value to \p V if it exists, otherwise nullptr.
¶llvm::Value* findCorrespondingValueIn(
const llvm::OutlinableRegion& Other,
llvm::Value* V)
llvm::Value* findCorrespondingValueIn(
const llvm::OutlinableRegion& Other,
llvm::Value* V)
Description
Find a corresponding value for \p V in similar OutlinableRegion \p Other.
Declared at: llvm/include/llvm/Transforms/IPO/IROutliner.h:175
Parameters
- const llvm::OutlinableRegion& Other
- [in] - The OutlinableRegion to find the corresponding Value in.
- llvm::Value* V
- [in] - The Value to look for in the other region.
Returns
The corresponding Value to \p V if it exists, otherwise nullptr.
¶llvm::InstructionCost getBenefit(
llvm::TargetTransformInfo& TTI)
llvm::InstructionCost getBenefit(
llvm::TargetTransformInfo& TTI)
Description
Get the size of the code removed from the region.
Declared at: llvm/include/llvm/Transforms/IPO/IROutliner.h:190
Parameters
- llvm::TargetTransformInfo& TTI
- - The TargetTransformInfo for the parent function.
Returns
the code size of the region
¶void reattachCandidate()
void reattachCandidate()
Description
For the contained region, reattach the BasicBlock at the starting and ending instructions of the contained IRSimilarityCandidate, or if the function has been extracted, the start and end of the BasicBlock containing the called function.
Declared at: llvm/include/llvm/Transforms/IPO/IROutliner.h:167
¶void splitCandidate()
void splitCandidate()
Description
For the contained region, split the parent BasicBlock at the starting and ending instructions of the contained IRSimilarityCandidate.
Declared at: llvm/include/llvm/Transforms/IPO/IROutliner.h:161