LLVM  15.0.0git
Public Member Functions | Public Attributes | List of all members
OutlinableGroup Struct Reference

The OutlinableGroup holds all the overarching information for outlining a set of regions that are structurally similar to one another, such as the types of the overall function, the output blocks, the sets of stores needed and a list of the different regions. More...

Collaboration diagram for OutlinableGroup:
Collaboration graph
[legend]

Public Member Functions

void findSameConstants (DenseSet< unsigned > &NotSame)
 For the Regions, we look at every Value. More...
 
void collectGVNStoreSets (Module &M)
 For the regions, look at each set of GVN stores needed and account for each combination. More...
 

Public Attributes

std::vector< OutlinableRegion * > Regions
 The sections that could be outlined. More...
 
std::vector< Type * > ArgumentTypes
 The argument types for the function created as the overall function to replace the extracted function for each region. More...
 
FunctionTypeOutlinedFunctionType = nullptr
 The FunctionType for the overall function. More...
 
FunctionOutlinedFunction = nullptr
 The Function for the collective overall function. More...
 
bool IgnoreGroup = false
 Flag for whether we should not consider this group of OutlinableRegions for extraction. More...
 
DenseMap< Value *, BasicBlock * > EndBBs
 The return blocks for the overall function. More...
 
DenseMap< Value *, BasicBlock * > PHIBlocks
 The PHIBlocks with their corresponding return block based on the return value as the key. More...
 
DenseSet< ArrayRef< unsigned > > OutputGVNCombinations
 A set containing the different GVN store sets needed. More...
 
bool InputTypesSet = false
 Flag for whether the ArgumentTypes have been defined after the extraction of the first region. More...
 
unsigned NumAggregateInputs = 0
 The number of input values in ArgumentTypes. More...
 
DenseMap< unsigned, unsigned > CanonicalNumberToAggArg
 The mapping of the canonical numbering of the values in outlined sections to specific arguments. More...
 
unsigned BranchesToOutside = 0
 The number of branches in the region target a basic block that is outside of the region. More...
 
unsigned PHINodeGVNTracker = -3
 Tracker counting backwards from the highest unsigned value possible to avoid conflicting with the GVNs of assigned values. More...
 
DenseMap< unsigned, std::pair< std::pair< unsigned, unsigned >, SmallVector< unsigned, 2 > > > PHINodeGVNToGVNs
 
DenseMap< hash_code, unsigned > GVNsToPHINodeGVN
 
InstructionCost Benefit = 0
 The number of instructions that will be outlined by extracting Regions. More...
 
InstructionCost Cost = 0
 The number of added instructions needed for the outlining of the Regions. More...
 
Optional< unsigned > SwiftErrorArgument
 The argument that needs to be marked with the swifterr attribute. More...
 

Detailed Description

The OutlinableGroup holds all the overarching information for outlining a set of regions that are structurally similar to one another, such as the types of the overall function, the output blocks, the sets of stores needed and a list of the different regions.

This information is used in the deduplication of extracted regions with the same structure.

Definition at line 73 of file IROutliner.cpp.

Member Function Documentation

◆ collectGVNStoreSets()

void OutlinableGroup::collectGVNStoreSets ( Module M)

For the regions, look at each set of GVN stores needed and account for each combination.

Add an argument to the argument types if there is more than one combination.

Parameters
[in]M- The module we are outlining from.

Definition at line 599 of file IROutliner.cpp.

References llvm::Type::getInt32Ty(), and M.

◆ findSameConstants()

void OutlinableGroup::findSameConstants ( DenseSet< unsigned > &  NotSame)

For the Regions, we look at every Value.

If it is a constant, we check whether it is the same in Region.

Parameters
[in,out]NotSamecontains the global value numbers where the constant is not always the same, and must be passed in as an argument.

Definition at line 592 of file IROutliner.cpp.

References collectRegionsConstants().

Member Data Documentation

◆ ArgumentTypes

std::vector<Type *> OutlinableGroup::ArgumentTypes

The argument types for the function created as the overall function to replace the extracted function for each region.

Definition at line 79 of file IROutliner.cpp.

Referenced by findExtractedInputToOverallInputMapping(), and findExtractedOutputToOverallOutputMapping().

◆ Benefit

InstructionCost OutlinableGroup::Benefit = 0

The number of instructions that will be outlined by extracting Regions.

Definition at line 129 of file IROutliner.cpp.

◆ BranchesToOutside

unsigned OutlinableGroup::BranchesToOutside = 0

The number of branches in the region target a basic block that is outside of the region.

Definition at line 115 of file IROutliner.cpp.

Referenced by findCostForOutputBlocks().

◆ CanonicalNumberToAggArg

DenseMap<unsigned, unsigned> OutlinableGroup::CanonicalNumberToAggArg

The mapping of the canonical numbering of the values in outlined sections to specific arguments.

Definition at line 111 of file IROutliner.cpp.

Referenced by findExtractedInputToOverallInputMapping().

◆ Cost

InstructionCost OutlinableGroup::Cost = 0

The number of added instructions needed for the outlining of the Regions.

Definition at line 132 of file IROutliner.cpp.

◆ EndBBs

DenseMap<Value *, BasicBlock *> OutlinableGroup::EndBBs

The return blocks for the overall function.

Definition at line 90 of file IROutliner.cpp.

Referenced by createSwitchStatement(), fillOverallFunction(), and findOrCreatePHIBlock().

◆ GVNsToPHINodeGVN

DenseMap<hash_code, unsigned> OutlinableGroup::GVNsToPHINodeGVN

Definition at line 125 of file IROutliner.cpp.

Referenced by getGVNForPHINode().

◆ IgnoreGroup

bool OutlinableGroup::IgnoreGroup = false

Flag for whether we should not consider this group of OutlinableRegions for extraction.

Definition at line 87 of file IROutliner.cpp.

◆ InputTypesSet

bool OutlinableGroup::InputTypesSet = false

Flag for whether the ArgumentTypes have been defined after the extraction of the first region.

Definition at line 103 of file IROutliner.cpp.

Referenced by findExtractedInputToOverallInputMapping().

◆ NumAggregateInputs

unsigned OutlinableGroup::NumAggregateInputs = 0

The number of input values in ArgumentTypes.

Anything after this index in ArgumentTypes is an output argument.

Definition at line 107 of file IROutliner.cpp.

Referenced by findExtractedInputToOverallInputMapping(), and findExtractedOutputToOverallOutputMapping().

◆ OutlinedFunction

Function* OutlinableGroup::OutlinedFunction = nullptr

The Function for the collective overall function.

Definition at line 83 of file IROutliner.cpp.

Referenced by createSwitchStatement(), fillOverallFunction(), findOrCreatePHIInBlock(), replaceArgumentUses(), replaceCalledFunction(), and replaceConstants().

◆ OutlinedFunctionType

FunctionType* OutlinableGroup::OutlinedFunctionType = nullptr

The FunctionType for the overall function.

Definition at line 81 of file IROutliner.cpp.

◆ OutputGVNCombinations

DenseSet<ArrayRef<unsigned> > OutlinableGroup::OutputGVNCombinations

A set containing the different GVN store sets needed.

Each array contains a sorted list of the different values that need to be stored into output registers.

Definition at line 99 of file IROutliner.cpp.

Referenced by createSwitchStatement(), findCostForOutputBlocks(), and replaceCalledFunction().

◆ PHIBlocks

DenseMap<Value *, BasicBlock *> OutlinableGroup::PHIBlocks

The PHIBlocks with their corresponding return block based on the return value as the key.

Definition at line 94 of file IROutliner.cpp.

Referenced by findOrCreatePHIBlock(), and replaceArgumentUses().

◆ PHINodeGVNToGVNs

DenseMap<unsigned, std::pair<std::pair<unsigned, unsigned>, SmallVector<unsigned, 2> > > OutlinableGroup::PHINodeGVNToGVNs

Definition at line 124 of file IROutliner.cpp.

Referenced by findOutputValueInRegion(), and getGVNForPHINode().

◆ PHINodeGVNTracker

unsigned OutlinableGroup::PHINodeGVNTracker = -3

Tracker counting backwards from the highest unsigned value possible to avoid conflicting with the GVNs of assigned values.

We start at -3 since -2 and -1 are assigned by the DenseMap.

Definition at line 120 of file IROutliner.cpp.

Referenced by findOutputValueInRegion(), and getGVNForPHINode().

◆ Regions

std::vector<OutlinableRegion *> OutlinableGroup::Regions

The sections that could be outlined.

Definition at line 75 of file IROutliner.cpp.

Referenced by fillOverallFunction(), findCostForOutputBlocks(), findOrCreatePHIInBlock(), getSubprogramOrNull(), and replaceArgumentUses().

◆ SwiftErrorArgument

Optional<unsigned> OutlinableGroup::SwiftErrorArgument

The argument that needs to be marked with the swifterr attribute.

If not needed, there is no value.

Definition at line 136 of file IROutliner.cpp.

Referenced by findExtractedInputToOverallInputMapping(), and replaceCalledFunction().


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