82#define DEBUG_TYPE "machine-outliner"
86using namespace outliner;
89STATISTIC(NumOutlined,
"Number of candidates outlined");
90STATISTIC(FunctionsCreated,
"Number of functions created");
93STATISTIC(NumLegalInUnsignedVec,
"Outlinable instructions mapped");
95 "Unoutlinable instructions mapped + number of sentinel values");
96STATISTIC(NumSentinels,
"Sentinel values inserted during mapping");
98 "Invisible instructions skipped during mapping");
100 "Total number of instructions mapped and saved to mapping vector");
109 cl::desc(
"Enable the machine outliner on linkonceodr functions"),
118 "Number of times to rerun the outliner after the initial outline"));
123 "The minimum size in bytes before an outlining candidate is accepted"));
127 cl::desc(
"Consider all leaf descendants of internal nodes of the suffix "
128 "tree as candidates for outlining (if false, only leaf children "
134struct InstructionMapper {
140 unsigned IllegalInstrNumber = -3;
144 unsigned LegalInstrNumber = 0;
148 InstructionIntegerMap;
164 bool AddedIllegalLastTime =
false;
172 unsigned mapToLegalUnsigned(
174 bool &HaveLegalRange,
unsigned &NumLegalInBlock,
179 AddedIllegalLastTime =
false;
183 if (CanOutlineWithPrevInstr)
184 HaveLegalRange =
true;
185 CanOutlineWithPrevInstr =
true;
197 std::tie(ResultIt, WasInserted) =
198 InstructionIntegerMap.
insert(std::make_pair(&
MI, LegalInstrNumber));
199 unsigned MINumber = ResultIt->second;
208 if (LegalInstrNumber >= IllegalInstrNumber)
212 "Tried to assign DenseMap tombstone or empty key to instruction.");
214 "Tried to assign DenseMap tombstone or empty key to instruction.");
217 ++NumLegalInUnsignedVec;
227 unsigned mapToIllegalUnsigned(
232 CanOutlineWithPrevInstr =
false;
235 if (AddedIllegalLastTime)
236 return IllegalInstrNumber;
239 AddedIllegalLastTime =
true;
240 unsigned MINumber = IllegalInstrNumber;
243 UnsignedVecForMBB.
push_back(IllegalInstrNumber);
244 IllegalInstrNumber--;
246 ++NumIllegalInUnsignedVec;
248 assert(LegalInstrNumber < IllegalInstrNumber &&
249 "Instruction mapping overflow!");
252 "IllegalInstrNumber cannot be DenseMap tombstone or empty key!");
255 "IllegalInstrNumber cannot be DenseMap tombstone or empty key!");
273 <<
"' to unsigned vector ***\n");
277 if (!
TII.isMBBSafeToOutlineFrom(
MBB, Flags))
280 auto OutlinableRanges =
TII.getOutlinableRanges(
MBB, Flags);
282 <<
" outlinable range(s)\n");
283 if (OutlinableRanges.empty())
293 unsigned NumLegalInBlock = 0;
297 bool HaveLegalRange =
false;
301 bool CanOutlineWithPrevInstr =
false;
309 for (
auto &OutlinableRange : OutlinableRanges) {
310 auto OutlinableRangeBegin = OutlinableRange.first;
311 auto OutlinableRangeEnd = OutlinableRange.second;
315 << std::distance(OutlinableRangeBegin, OutlinableRangeEnd)
316 <<
" instruction range\n");
318 unsigned NumSkippedInRange = 0;
320 for (; It != OutlinableRangeBegin; ++It) {
324 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
329 <<
" instructions outside outlinable range\n");
331 assert(It !=
MBB.
end() &&
"Should still have instructions?");
334 for (; It != OutlinableRangeEnd; ++It) {
336 switch (
TII.getOutliningType(It, Flags)) {
337 case InstrType::Illegal:
338 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
342 case InstrType::Legal:
343 mapToLegalUnsigned(It, CanOutlineWithPrevInstr, HaveLegalRange,
344 NumLegalInBlock, UnsignedVecForMBB,
348 case InstrType::LegalTerminator:
349 mapToLegalUnsigned(It, CanOutlineWithPrevInstr, HaveLegalRange,
350 NumLegalInBlock, UnsignedVecForMBB,
354 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
358 case InstrType::Invisible:
362 AddedIllegalLastTime =
false;
368 LLVM_DEBUG(
dbgs() <<
"HaveLegalRange = " << HaveLegalRange <<
"\n");
372 if (HaveLegalRange) {
377 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
385 InstructionMapper() {
389 "DenseMapInfo<unsigned>'s empty key isn't -1!");
391 "DenseMapInfo<unsigned>'s tombstone key isn't -2!");
410 bool OutlineFromLinkOnceODRs =
false;
413 unsigned OutlineRepeatedNum = 0;
419 bool RunOnAllFunctions =
true;
436 void emitNotOutliningCheaperRemark(
437 unsigned StringLen, std::vector<Candidate> &CandidatesForRepeatedSeq,
456 void findCandidates(InstructionMapper &Mapper,
457 std::vector<OutlinedFunction> &FunctionList);
465 bool outline(
Module &M, std::vector<OutlinedFunction> &FunctionList,
466 InstructionMapper &Mapper,
unsigned &OutlinedFunctionNum);
470 InstructionMapper &Mapper,
478 bool doOutline(
Module &M,
unsigned &OutlinedFunctionNum);
492 void populateMapper(InstructionMapper &Mapper,
Module &M,
510char MachineOutliner::ID = 0;
514 MachineOutliner *OL =
new MachineOutliner();
515 OL->RunOnAllFunctions = RunOnAllFunctions;
524void MachineOutliner::emitNotOutliningCheaperRemark(
531 Candidate &
C = CandidatesForRepeatedSeq.front();
535 C.front().getDebugLoc(),
C.getMBB());
536 R <<
"Did not outline " <<
NV(
"Length", StringLen) <<
" instructions"
537 <<
" from " <<
NV(
"NumOccurrences", CandidatesForRepeatedSeq.size())
539 <<
" Bytes from outlining all occurrences ("
540 <<
NV(
"OutliningCost", OF.getOutliningCost()) <<
")"
541 <<
" >= Unoutlined instruction bytes ("
542 <<
NV(
"NotOutliningCost", OF.getNotOutlinedCost()) <<
")"
543 <<
" (Also found at: ";
546 for (
unsigned i = 1, e = CandidatesForRepeatedSeq.size(); i < e; i++) {
548 CandidatesForRepeatedSeq[i].front().
getDebugLoc());
563 R <<
"Saved " <<
NV(
"OutliningBenefit", OF.
getBenefit()) <<
" bytes by "
564 <<
"outlining " <<
NV(
"Length", OF.
getNumInstrs()) <<
" instructions "
570 for (
size_t i = 0, e = OF.
Candidates.size(); i < e; i++) {
583void MachineOutliner::findCandidates(
584 InstructionMapper &Mapper, std::vector<OutlinedFunction> &FunctionList) {
585 FunctionList.clear();
590 std::vector<Candidate> CandidatesForRepeatedSeq;
591 LLVM_DEBUG(
dbgs() <<
"*** Discarding overlapping candidates *** \n");
593 dbgs() <<
"Searching for overlaps in all repeated sequences...\n");
595 CandidatesForRepeatedSeq.clear();
596 unsigned StringLen = RS.Length;
600 unsigned NumDiscarded = 0;
601 unsigned NumKept = 0;
606 for (
const unsigned &StartIdx : RS.StartIndices) {
628 unsigned EndIdx = StartIdx + StringLen - 1;
629 if (!CandidatesForRepeatedSeq.empty() &&
630 StartIdx <= CandidatesForRepeatedSeq.back().getEndIdx()) {
633 LLVM_DEBUG(
dbgs() <<
" .. DISCARD candidate @ [" << StartIdx <<
", "
634 << EndIdx <<
"]; overlaps with candidate @ ["
635 << CandidatesForRepeatedSeq.back().getStartIdx()
636 <<
", " << CandidatesForRepeatedSeq.back().getEndIdx()
650 CandidatesForRepeatedSeq.emplace_back(StartIdx, StringLen, StartIt, EndIt,
652 Mapper.MBBFlagsMap[
MBB]);
663 if (CandidatesForRepeatedSeq.size() < 2)
669 CandidatesForRepeatedSeq[0].getMF()->getSubtarget().getInstrInfo();
671 std::optional<OutlinedFunction> OF =
672 TII->getOutliningCandidateInfo(CandidatesForRepeatedSeq);
676 if (!OF || OF->Candidates.size() < 2)
681 emitNotOutliningCheaperRemark(StringLen, CandidatesForRepeatedSeq, *OF);
685 FunctionList.push_back(*OF);
695 std::string FunctionName =
"OUTLINED_FUNCTION_";
696 if (OutlineRepeatedNum > 0)
697 FunctionName += std::to_string(OutlineRepeatedNum + 1) +
"_";
698 FunctionName += std::to_string(
Name);
704 Function::ExternalLinkage, FunctionName, M);
709 F->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
713 F->addFnAttr(Attribute::OptimizeForSize);
714 F->addFnAttr(Attribute::MinSize);
726 return std::max(K, C.getMF()->getFunction().getUWTableKind());
728 F->setUWTableKind(UW);
732 Builder.CreateRetVoid();
743 const std::vector<MCCFIInstruction> &Instrs =
745 for (
auto &
MI : FirstCand) {
746 if (
MI.isDebugInstr())
751 if (
MI.isCFIInstruction()) {
752 unsigned CFIIndex =
MI.getOperand(0).getCFIIndex();
768 MF.
getProperties().
set(MachineFunctionProperties::Property::TracksLiveness);
779 CandLiveIns.addLiveOuts(OutlineBB);
782 CandLiveIns.stepBackward(
MI);
791 TII.buildOutlinedFrame(
MBB, MF, OF);
799 DIFile *Unit = SP->getFile();
809 DB.createSubroutineType(
810 DB.getOrCreateTypeArray(std::nullopt)),
812 DINode::DIFlags::FlagArtificial ,
814 DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
817 DB.finalizeSubprogram(OutlinedSP);
820 F->setSubprogram(OutlinedSP);
828bool MachineOutliner::outline(
Module &M,
829 std::vector<OutlinedFunction> &FunctionList,
830 InstructionMapper &Mapper,
831 unsigned &OutlinedFunctionNum) {
833 LLVM_DEBUG(
dbgs() <<
"NUMBER OF POTENTIAL FUNCTIONS: " << FunctionList.size()
835 bool OutlinedSomething =
false;
841 return LHS.getNotOutlinedCost() *
RHS.getOutliningCost() >
842 RHS.getNotOutlinedCost() *
LHS.getOutliningCost();
847 auto *UnsignedVecBegin = Mapper.UnsignedVec.begin();
851 auto NumCandidatesBefore = OF.
Candidates.size();
856 return std::any_of(UnsignedVecBegin + C.getStartIdx(),
857 UnsignedVecBegin + C.getEndIdx() + 1, [](unsigned I) {
858 return I == static_cast<unsigned>(-1);
863 auto NumCandidatesAfter = OF.
Candidates.size();
864 LLVM_DEBUG(
dbgs() <<
"PRUNED: " << NumCandidatesBefore - NumCandidatesAfter
865 <<
"/" << NumCandidatesBefore <<
" candidates\n");
883 emitOutlinedFunctionRemark(OF);
885 OutlinedFunctionNum++;
901 auto MBBBeingOutlinedFromName =
907 << MFBeingOutlinedFromName <<
":"
908 << MBBBeingOutlinedFromName <<
"\n");
917 MachineFunctionProperties::Property::TracksLiveness)) {
931 Iter !=
Last; Iter++) {
941 DefRegs.
insert(MOP.getReg());
942 if (UseRegs.
count(MOP.getReg()) &&
943 !InstrUseRegs.
count(MOP.getReg()))
946 UseRegs.
erase(MOP.getReg());
947 }
else if (!MOP.isUndef()) {
950 UseRegs.
insert(MOP.getReg());
951 InstrUseRegs.
insert(MOP.getReg());
954 if (
MI->isCandidateForCallSiteEntry())
955 MI->getMF()->eraseCallSiteInfo(
MI);
974 MBB.
erase(std::next(StartIt), std::next(EndIt));
977 for (
unsigned &
I :
make_range(UnsignedVecBegin +
C.getStartIdx(),
978 UnsignedVecBegin +
C.getEndIdx() + 1))
979 I =
static_cast<unsigned>(-1);
980 OutlinedSomething =
true;
987 LLVM_DEBUG(
dbgs() <<
"OutlinedSomething = " << OutlinedSomething <<
"\n";);
988 return OutlinedSomething;
991void MachineOutliner::populateMapper(InstructionMapper &Mapper,
Module &M,
999 if (
F.hasFnAttribute(
"nooutline")) {
1000 LLVM_DEBUG(
dbgs() <<
"SKIP: Function has nooutline attribute\n");
1011 LLVM_DEBUG(
dbgs() <<
"SKIP: Function does not have a MachineFunction\n");
1016 if (!RunOnAllFunctions && !
TII->shouldOutlineFromFunctionByDefault(*MF)) {
1017 LLVM_DEBUG(
dbgs() <<
"SKIP: Target does not want to outline from "
1018 "function by default\n");
1024 if (!
TII->isFunctionSafeToOutlineFrom(*MF, OutlineFromLinkOnceODRs)) {
1026 <<
": unsafe to outline from\n");
1033 const unsigned MinMBBSize = 2;
1043 if (
MBB.
size() < MinMBBSize) {
1044 LLVM_DEBUG(
dbgs() <<
" SKIP: MBB size less than minimum size of "
1045 << MinMBBSize <<
"\n");
1057 Mapper.convertToUnsignedVec(
MBB, *
TII);
1061 UnsignedVecSize = Mapper.UnsignedVec.size();
1064void MachineOutliner::initSizeRemarkInfo(
1080void MachineOutliner::emitInstrCountChangedRemark(
1094 std::string Fname = std::string(
F.getName());
1096 unsigned FnCountBefore = 0;
1099 auto It = FunctionToInstrCount.
find(Fname);
1103 if (It != FunctionToInstrCount.
end())
1104 FnCountBefore = It->second;
1107 int64_t FnDelta =
static_cast<int64_t
>(FnCountAfter) -
1108 static_cast<int64_t
>(FnCountBefore);
1119 <<
": MI instruction count changed from "
1132bool MachineOutliner::runOnModule(
Module &M) {
1139 unsigned OutlinedFunctionNum = 0;
1141 OutlineRepeatedNum = 0;
1142 if (!doOutline(M, OutlinedFunctionNum))
1146 OutlinedFunctionNum = 0;
1147 OutlineRepeatedNum++;
1148 if (!doOutline(M, OutlinedFunctionNum)) {
1150 dbgs() <<
"Did not outline on iteration " <<
I + 2 <<
" out of "
1160bool MachineOutliner::doOutline(
Module &M,
unsigned &OutlinedFunctionNum) {
1169 dbgs() <<
"Machine Outliner: Running on ";
1170 if (RunOnAllFunctions)
1171 dbgs() <<
"all functions";
1173 dbgs() <<
"target-default functions";
1180 InstructionMapper Mapper;
1183 populateMapper(Mapper, M, MMI);
1184 std::vector<OutlinedFunction> FunctionList;
1187 findCandidates(Mapper, FunctionList);
1198 bool ShouldEmitSizeRemarks =
M.shouldEmitInstrCountChangedRemark();
1200 if (ShouldEmitSizeRemarks)
1201 initSizeRemarkInfo(M, MMI, FunctionToInstrCount);
1204 bool OutlinedSomething =
1205 outline(M, FunctionList, Mapper, OutlinedFunctionNum);
1210 if (ShouldEmitSizeRemarks && OutlinedSomething)
1211 emitInstrCountChangedRemark(M, MMI, FunctionToInstrCount);
1214 if (!OutlinedSomething)
1215 dbgs() <<
"Stopped outlining at iteration " << OutlineRepeatedNum
1216 <<
" because no changes were found.\n";
1219 return OutlinedSomething;
unsigned const MachineRegisterInfo * MRI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file defines the DenseMap class.
const HexagonInstrInfo * TII
static DISubprogram * getSubprogramOrNull(OutlinableGroup &Group)
Get the subprogram if it exists for one of the outlined regions.
This file implements the LivePhysRegs utility for tracking liveness of physical registers.
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
static cl::opt< unsigned > OutlinerBenefitThreshold("outliner-benefit-threshold", cl::init(1), cl::Hidden, cl::desc("The minimum size in bytes before an outlining candidate is accepted"))
static cl::opt< bool > OutlinerLeafDescendants("outliner-leaf-descendants", cl::init(true), cl::Hidden, cl::desc("Consider all leaf descendants of internal nodes of the suffix " "tree as candidates for outlining (if false, only leaf children " "are considered)"))
static cl::opt< unsigned > OutlinerReruns("machine-outliner-reruns", cl::init(0), cl::Hidden, cl::desc("Number of times to rerun the outliner after the initial outline"))
Number of times to re-run the outliner.
static cl::opt< bool > EnableLinkOnceODROutlining("enable-linkonceodr-outlining", cl::Hidden, cl::desc("Enable the machine outliner on linkonceodr functions"), cl::init(false))
Contains all data structures shared between the outliner implemented in MachineOutliner....
unsigned const TargetRegisterInfo * TRI
Module.h This file contains the declarations for the Module class.
static Function * createOutlinedFunction(OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, StringRef FuncName, SmallVectorImpl< Value * > &Inputs, OpenMPIRBuilder::TargetBodyGenCallbackTy &CBFunc, OpenMPIRBuilder::TargetGenArgAccessorsCallbackTy &ArgAccessorFuncCB)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallSet class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
LLVM Basic Block Representation.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
This class represents a function call, abstracting a target machine's calling convention.
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
@ InternalLinkage
Rename collisions when linking (static functions).
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
This is an important class for using LLVM in a threaded context.
A set of physical registers with utility functions to track liveness when walking backward/forward th...
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
bool hasAddressTaken() const
Test whether this block is used as something other than the target of a terminator,...
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any debug instructions.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
StringRef getName() const
Return the name of the corresponding LLVM basic block, or an empty string.
MachineFunctionProperties & set(Property P)
bool hasProperty(Property P) const
MachineFunctionProperties & reset(Property P)
unsigned getInstructionCount() const
Return the number of MachineInstrs in this MachineFunction.
unsigned addFrameInst(const MCCFIInstruction &Inst)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the function's prologue.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
void setIsOutlined(bool V)
const MachineFunctionProperties & getProperties() const
Get the function properties.
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
const MachineBasicBlock & front() const
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *BB=nullptr, std::optional< UniqueBBID > BBID=std::nullopt)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
void insert(iterator MBBI, MachineBasicBlock *MBB)
const MachineInstrBuilder & addCFIIndex(unsigned CFIIndex) const
reverse_iterator getReverse() const
Get a reverse iterator to the same node.
Representation of each machine instruction.
const MachineBasicBlock * getParent() const
void dropMemRefs(MachineFunction &MF)
Clear this MachineInstr's memory reference descriptor list.
const MachineFunction * getMF() const
Return the function that contains the basic block that this instruction belongs to.
void setDebugLoc(DebugLoc DL)
Replace current source information with new such.
This class contains meta information specific to a module.
MachineFunction & getOrCreateMachineFunction(Function &F)
Returns the MachineFunction constructed for the IR function F.
MachineFunction * getMachineFunction(const Function &F) const
Returns the MachineFunction associated to IR function F if there is one, otherwise nullptr.
MachineOperand class - Representation of each machine instruction operand.
static MachineOperand CreateReg(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
void freezeReservedRegs()
freezeReservedRegs - Called by the register allocator to freeze the set of reserved registers before ...
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Wrapper class representing virtual and physical registers.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
iterator find(StringRef Key)
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
constexpr bool empty() const
empty - Check if the string is empty.
constexpr size_t size() const
size - Get the string size.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
virtual const TargetInstrInfo * getInstrInfo() const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static Type * getVoidTy(LLVMContext &C)
A raw_ostream that writes to an std::string.
@ C
The default llvm calling convention, compatible with C.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
DiagnosticInfoOptimizationBase::Argument NV
This is an optimization pass for GlobalISel generic memory operations.
void stable_sort(R &&Range)
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
auto reverse(ContainerTy &&C)
void sort(IteratorTy Start, IteratorTy End)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
void initializeMachineOutlinerPass(PassRegistry &)
ModulePass * createMachineOutlinerPass(bool RunOnAllFunctions=true)
This pass performs outlining on machine instructions directly before printing assembly.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
void addLiveIns(MachineBasicBlock &MBB, const LivePhysRegs &LiveRegs)
Adds registers contained in LiveRegs to the block live-in list of MBB.
Implement std::hash so that hash_code can be used in STL containers.
An information struct used to provide DenseMap with the various necessary components for a given valu...
Used in the streaming interface as the general argument type.
A repeated substring in the tree.
An individual sequence of instructions to be replaced with a call to an outlined function.
MachineFunction * getMF() const
The information necessary to create an outlined function for some class of candidate.
unsigned getBenefit() const
Return the number of instructions that would be saved by outlining this function.
MachineFunction * MF
The actual outlined function created.
unsigned getNumInstrs() const
Return the number of instructions in this sequence.
unsigned getOccurrenceCount() const
Return the number of candidates for this OutlinedFunction.
std::vector< Candidate > Candidates