LLVM 20.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...

Public Member Functions

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

Public Attributes

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

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 72 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 605 of file IROutliner.cpp.

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

◆ 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 598 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 78 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 128 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 114 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 110 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 131 of file IROutliner.cpp.

◆ EndBBs

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

The return blocks for the overall function.

Definition at line 89 of file IROutliner.cpp.

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

◆ GVNsToPHINodeGVN

DenseMap<hash_code, unsigned> OutlinableGroup::GVNsToPHINodeGVN

Definition at line 124 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 86 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 102 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 106 of file IROutliner.cpp.

Referenced by findExtractedInputToOverallInputMapping(), and findExtractedOutputToOverallOutputMapping().

◆ OutlinedFunction

Function* OutlinableGroup::OutlinedFunction = nullptr

The Function for the collective overall function.

Definition at line 82 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 80 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 98 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 93 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 123 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 119 of file IROutliner.cpp.

Referenced by findOutputValueInRegion(), and getGVNForPHINode().

◆ Regions

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

The sections that could be outlined.

Definition at line 74 of file IROutliner.cpp.

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

◆ SwiftErrorArgument

std::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 135 of file IROutliner.cpp.

Referenced by findExtractedInputToOverallInputMapping(), and replaceCalledFunction().


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