LLVM  13.0.0git
Public Member Functions | Public Attributes | List of all members
llvm::OutlinableRegion Struct Reference

The OutlinableRegion holds all the information for a specific region, or sequence of instructions. More...

#include "llvm/Transforms/IPO/IROutliner.h"

Collaboration diagram for llvm::OutlinableRegion:
Collaboration graph
[legend]

Public Member Functions

 OutlinableRegion (IRSimilarityCandidate &C, OutlinableGroup &Group)
 
void splitCandidate ()
 For the contained region, split the parent BasicBlock at the starting and ending instructions of the contained IRSimilarityCandidate. More...
 
void reattachCandidate ()
 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. More...
 
InstructionCost getBenefit (TargetTransformInfo &TTI)
 Get the size of the code removed from the region. More...
 

Public Attributes

IRSimilarityCandidateCandidate = nullptr
 Describes the region of code. More...
 
IRInstructionDataNewFront = nullptr
 If this region is outlined, the front and back IRInstructionData could potentially become invalidated if the only new instruction is a call. More...
 
IRInstructionDataNewBack = nullptr
 
unsigned NumExtractedInputs = 0
 The number of extracted inputs from the CodeExtractor. More...
 
unsigned OutputBlockNum = -1
 The corresponding BasicBlock with the appropriate stores for this OutlinableRegion in the overall function. More...
 
DenseMap< unsigned, unsigned > ExtractedArgToAgg
 Mapping the extracted argument number to the argument number in the overall function. More...
 
DenseMap< unsigned, unsigned > AggArgToExtracted
 
DenseMap< unsigned, 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. More...
 
SmallVector< unsigned, 4 > GVNStores
 The global value numbers that are used as outputs for this section. More...
 
CodeExtractorCE = nullptr
 Used to create an outlined function. More...
 
CallInstCall = nullptr
 The call site of the extracted region. More...
 
FunctionExtractedFunction = nullptr
 The function for the extracted region. More...
 
bool CandidateSplit = false
 Flag for whether we have split out the IRSimilarityCanidate. More...
 
bool IgnoreRegion = false
 Flag for whether we should not consider this region for extraction. More...
 
BasicBlockPrevBB = nullptr
 The BasicBlock that is before the start of the region BasicBlock, only defined when the region has been split. More...
 
BasicBlockStartBB = nullptr
 The BasicBlock that contains the starting instruction of the region. More...
 
BasicBlockEndBB = nullptr
 The BasicBlock that contains the ending instruction of the region. More...
 
BasicBlockFollowBB = nullptr
 The BasicBlock that is after the start of the region BasicBlock, only defined when the region has been split. More...
 
OutlinableGroupParent = nullptr
 The Outlinable Group that contains this region and structurally similar regions to this region. More...
 

Detailed 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.

Definition at line 64 of file IROutliner.h.

Constructor & Destructor Documentation

◆ OutlinableRegion()

llvm::OutlinableRegion::OutlinableRegion ( IRSimilarityCandidate C,
OutlinableGroup Group 
)
inline

Definition at line 134 of file IROutliner.h.

Member Function Documentation

◆ getBenefit()

InstructionCost OutlinableRegion::getBenefit ( TargetTransformInfo TTI)

Get the size of the code removed from the region.

Parameters
[in]TTI- The TargetTransformInfo for the parent function.
Returns
the code size of the region

Definition at line 246 of file IROutliner.cpp.

References llvm::TargetTransformInfo::getInstructionCost(), I, and llvm::TargetTransformInfo::TCK_CodeSize.

◆ reattachCandidate()

void OutlinableRegion::reattachCandidate ( )

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.

Definition at line 162 of file IROutliner.cpp.

References assert(), and moveBBContents().

◆ splitCandidate()

void OutlinableRegion::splitCandidate ( )

For the contained region, split the parent BasicBlock at the starting and ending instructions of the contained IRSimilarityCandidate.

Definition at line 126 of file IROutliner.cpp.

References assert(), llvm::Value::getName(), llvm::Instruction::getParent(), and llvm::StringRef::str().

Member Data Documentation

◆ AggArgToConstant

DenseMap<unsigned, Constant *> llvm::OutlinableRegion::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.

Definition at line 93 of file IROutliner.h.

◆ AggArgToExtracted

DenseMap<unsigned, unsigned> llvm::OutlinableRegion::AggArgToExtracted

Definition at line 87 of file IROutliner.h.

◆ Call

CallInst* llvm::OutlinableRegion::Call = nullptr

The call site of the extracted region.

Definition at line 104 of file IROutliner.h.

Referenced by fillOverallFunction().

◆ Candidate

IRSimilarityCandidate* llvm::OutlinableRegion::Candidate = nullptr

Describes the region of code.

Definition at line 66 of file IROutliner.h.

◆ CandidateSplit

bool llvm::OutlinableRegion::CandidateSplit = false

Flag for whether we have split out the IRSimilarityCanidate.

That is, make the region contained the IRSimilarityCandidate its own BasicBlock.

Definition at line 111 of file IROutliner.h.

◆ CE

CodeExtractor* llvm::OutlinableRegion::CE = nullptr

Used to create an outlined function.

Definition at line 101 of file IROutliner.h.

◆ EndBB

BasicBlock* llvm::OutlinableRegion::EndBB = nullptr

The BasicBlock that contains the ending instruction of the region.

Definition at line 124 of file IROutliner.h.

◆ ExtractedArgToAgg

DenseMap<unsigned, unsigned> llvm::OutlinableRegion::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.

Definition at line 86 of file IROutliner.h.

◆ ExtractedFunction

Function* llvm::OutlinableRegion::ExtractedFunction = nullptr

The function for the extracted region.

Definition at line 107 of file IROutliner.h.

Referenced by fillOverallFunction().

◆ FollowBB

BasicBlock* llvm::OutlinableRegion::FollowBB = nullptr

The BasicBlock that is after the start of the region BasicBlock, only defined when the region has been split.

Definition at line 128 of file IROutliner.h.

◆ GVNStores

SmallVector<unsigned, 4> llvm::OutlinableRegion::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.

Definition at line 98 of file IROutliner.h.

◆ IgnoreRegion

bool llvm::OutlinableRegion::IgnoreRegion = false

Flag for whether we should not consider this region for extraction.

Definition at line 114 of file IROutliner.h.

◆ NewBack

IRInstructionData* llvm::OutlinableRegion::NewBack = nullptr

Definition at line 72 of file IROutliner.h.

◆ NewFront

IRInstructionData* llvm::OutlinableRegion::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.

Definition at line 71 of file IROutliner.h.

◆ NumExtractedInputs

unsigned llvm::OutlinableRegion::NumExtractedInputs = 0

The number of extracted inputs from the CodeExtractor.

Definition at line 75 of file IROutliner.h.

◆ OutputBlockNum

unsigned llvm::OutlinableRegion::OutputBlockNum = -1

The corresponding BasicBlock with the appropriate stores for this OutlinableRegion in the overall function.

Definition at line 79 of file IROutliner.h.

Referenced by fillOverallFunction().

◆ Parent

OutlinableGroup* llvm::OutlinableRegion::Parent = nullptr

The Outlinable Group that contains this region and structurally similar regions to this region.

Definition at line 132 of file IROutliner.h.

◆ PrevBB

BasicBlock* llvm::OutlinableRegion::PrevBB = nullptr

The BasicBlock that is before the start of the region BasicBlock, only defined when the region has been split.

Definition at line 118 of file IROutliner.h.

◆ StartBB

BasicBlock* llvm::OutlinableRegion::StartBB = nullptr

The BasicBlock that contains the starting instruction of the region.

Definition at line 121 of file IROutliner.h.


The documentation for this struct was generated from the following files: