Changeset View
Changeset View
Standalone View
Standalone View
llvm/include/llvm/Transforms/IPO/IROutliner.h
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | struct OutlinableRegion { | ||||
/// Mapping the extracted argument number to the argument number in the | /// Mapping the extracted argument number to the argument number in the | ||||
/// overall function. Since there will be inputs, such as elevated constants | /// 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 | /// 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 | /// cannot be sunk into the extracted section in every region, we must keep | ||||
/// track of which extracted argument maps to which overall argument. | /// track of which extracted argument maps to which overall argument. | ||||
DenseMap<unsigned, unsigned> ExtractedArgToAgg; | DenseMap<unsigned, unsigned> ExtractedArgToAgg; | ||||
DenseMap<unsigned, unsigned> AggArgToExtracted; | DenseMap<unsigned, unsigned> AggArgToExtracted; | ||||
/// 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. | |||||
DenseMap<unsigned, Constant *> AggArgToConstant; | |||||
/// Used to create an outlined function. | /// Used to create an outlined function. | ||||
CodeExtractor *CE = nullptr; | CodeExtractor *CE = nullptr; | ||||
/// The call site of the extracted region. | /// The call site of the extracted region. | ||||
CallInst *Call = nullptr; | CallInst *Call = nullptr; | ||||
/// The function for the extracted region. | /// The function for the extracted region. | ||||
Function *ExtractedFunction = nullptr; | Function *ExtractedFunction = nullptr; | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | private: | ||||
/// \returns the newly created function. | /// \returns the newly created function. | ||||
Function *createFunction(Module &M, OutlinableGroup &CG, | Function *createFunction(Module &M, OutlinableGroup &CG, | ||||
unsigned FunctionNameSuffix); | unsigned FunctionNameSuffix); | ||||
/// Identify the needed extracted inputs in a section, and add to the overall | /// Identify the needed extracted inputs in a section, and add to the overall | ||||
/// function if needed. | /// function if needed. | ||||
/// | /// | ||||
/// \param [in] M - The module to outline from. | /// \param [in] M - The module to outline from. | ||||
/// \param [in,out] Region - The region to be extracted | /// \param [in,out] Region - The region to be extracted. | ||||
void findAddInputsOutputs(Module &M, OutlinableRegion &Region); | /// \param [in] NotSame - The global value numbers of the Values in the region | ||||
/// that do not have the same Constant in each strucutrally similar region. | |||||
void findAddInputsOutputs(Module &M, OutlinableRegion &Region, | |||||
DenseSet<unsigned> &NotSame); | |||||
/// Extract \p Region into its own function. | /// Extract \p Region into its own function. | ||||
/// | /// | ||||
/// \param [in] Region - The region to be extracted into its own function. | /// \param [in] Region - The region to be extracted into its own function. | ||||
/// \returns True if it was successfully outlined. | /// \returns True if it was successfully outlined. | ||||
bool extractSection(OutlinableRegion &Region); | bool extractSection(OutlinableRegion &Region); | ||||
/// For the similarities found, and the extracted sections, create a single | /// For the similarities found, and the extracted sections, create a single | ||||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |