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 {
141 unsigned IllegalInstrNumber = -3;
145 unsigned LegalInstrNumber = 0;
149 InstructionIntegerMap;
165 bool AddedIllegalLastTime =
false;
173 unsigned mapToLegalUnsigned(
175 bool &HaveLegalRange,
unsigned &NumLegalInBlock,
180 AddedIllegalLastTime =
false;
184 if (CanOutlineWithPrevInstr)
185 HaveLegalRange =
true;
186 CanOutlineWithPrevInstr =
true;
198 std::tie(ResultIt, WasInserted) =
199 InstructionIntegerMap.
insert(std::make_pair(&
MI, LegalInstrNumber));
200 unsigned MINumber = ResultIt->second;
209 if (LegalInstrNumber >= IllegalInstrNumber)
213 "Tried to assign DenseMap tombstone or empty key to instruction.");
215 "Tried to assign DenseMap tombstone or empty key to instruction.");
218 ++NumLegalInUnsignedVec;
228 unsigned mapToIllegalUnsigned(
233 CanOutlineWithPrevInstr =
false;
236 if (AddedIllegalLastTime)
237 return IllegalInstrNumber;
240 AddedIllegalLastTime =
true;
241 unsigned MINumber = IllegalInstrNumber;
244 UnsignedVecForMBB.
push_back(IllegalInstrNumber);
245 IllegalInstrNumber--;
247 ++NumIllegalInUnsignedVec;
249 assert(LegalInstrNumber < IllegalInstrNumber &&
250 "Instruction mapping overflow!");
253 "IllegalInstrNumber cannot be DenseMap tombstone or empty key!");
256 "IllegalInstrNumber cannot be DenseMap tombstone or empty key!");
274 <<
"' to unsigned vector ***\n");
278 if (!
TII.isMBBSafeToOutlineFrom(
MBB, Flags))
281 auto OutlinableRanges =
TII.getOutlinableRanges(
MBB, Flags);
283 <<
" outlinable range(s)\n");
284 if (OutlinableRanges.empty())
294 unsigned NumLegalInBlock = 0;
298 bool HaveLegalRange =
false;
302 bool CanOutlineWithPrevInstr =
false;
310 for (
auto &OutlinableRange : OutlinableRanges) {
311 auto OutlinableRangeBegin = OutlinableRange.first;
312 auto OutlinableRangeEnd = OutlinableRange.second;
316 << std::distance(OutlinableRangeBegin, OutlinableRangeEnd)
317 <<
" instruction range\n");
319 unsigned NumSkippedInRange = 0;
321 for (; It != OutlinableRangeBegin; ++It) {
325 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
330 <<
" instructions outside outlinable range\n");
332 assert(It !=
MBB.
end() &&
"Should still have instructions?");
335 for (; It != OutlinableRangeEnd; ++It) {
337 switch (
TII.getOutliningType(MMI, It, Flags)) {
338 case InstrType::Illegal:
339 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
343 case InstrType::Legal:
344 mapToLegalUnsigned(It, CanOutlineWithPrevInstr, HaveLegalRange,
345 NumLegalInBlock, UnsignedVecForMBB,
349 case InstrType::LegalTerminator:
350 mapToLegalUnsigned(It, CanOutlineWithPrevInstr, HaveLegalRange,
351 NumLegalInBlock, UnsignedVecForMBB,
355 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
359 case InstrType::Invisible:
363 AddedIllegalLastTime =
false;
369 LLVM_DEBUG(
dbgs() <<
"HaveLegalRange = " << HaveLegalRange <<
"\n");
373 if (HaveLegalRange) {
378 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
390 "DenseMapInfo<unsigned>'s empty key isn't -1!");
392 "DenseMapInfo<unsigned>'s tombstone key isn't -2!");
413 bool OutlineFromLinkOnceODRs =
false;
416 unsigned OutlineRepeatedNum = 0;
422 bool RunOnAllFunctions =
true;
439 void emitNotOutliningCheaperRemark(
440 unsigned StringLen, std::vector<Candidate> &CandidatesForRepeatedSeq,
459 void findCandidates(InstructionMapper &Mapper,
460 std::vector<OutlinedFunction> &FunctionList);
468 bool outline(
Module &M, std::vector<OutlinedFunction> &FunctionList,
469 InstructionMapper &Mapper,
unsigned &OutlinedFunctionNum);
473 InstructionMapper &Mapper,
481 bool doOutline(
Module &M,
unsigned &OutlinedFunctionNum);
495 void populateMapper(InstructionMapper &Mapper,
Module &M);
501 void initSizeRemarkInfo(
const Module &M,
507 emitInstrCountChangedRemark(
const Module &M,
512char MachineOutliner::ID = 0;
516 MachineOutliner *OL =
new MachineOutliner();
517 OL->RunOnAllFunctions = RunOnAllFunctions;
526void MachineOutliner::emitNotOutliningCheaperRemark(
533 Candidate &
C = CandidatesForRepeatedSeq.front();
537 C.front().getDebugLoc(),
C.getMBB());
538 R <<
"Did not outline " <<
NV(
"Length", StringLen) <<
" instructions"
539 <<
" from " <<
NV(
"NumOccurrences", CandidatesForRepeatedSeq.size())
541 <<
" Bytes from outlining all occurrences ("
542 <<
NV(
"OutliningCost", OF.getOutliningCost()) <<
")"
543 <<
" >= Unoutlined instruction bytes ("
544 <<
NV(
"NotOutliningCost", OF.getNotOutlinedCost()) <<
")"
545 <<
" (Also found at: ";
548 for (
unsigned i = 1, e = CandidatesForRepeatedSeq.size(); i < e; i++) {
550 CandidatesForRepeatedSeq[i].front().
getDebugLoc());
565 R <<
"Saved " <<
NV(
"OutliningBenefit", OF.
getBenefit()) <<
" bytes by "
566 <<
"outlining " <<
NV(
"Length", OF.
getNumInstrs()) <<
" instructions "
572 for (
size_t i = 0, e = OF.
Candidates.size(); i < e; i++) {
585void MachineOutliner::findCandidates(
586 InstructionMapper &Mapper, std::vector<OutlinedFunction> &FunctionList) {
587 FunctionList.clear();
592 std::vector<Candidate> CandidatesForRepeatedSeq;
593 LLVM_DEBUG(
dbgs() <<
"*** Discarding overlapping candidates *** \n");
595 dbgs() <<
"Searching for overlaps in all repeated sequences...\n");
597 CandidatesForRepeatedSeq.clear();
598 unsigned StringLen = RS.Length;
602 unsigned NumDiscarded = 0;
603 unsigned NumKept = 0;
608 for (
const unsigned &StartIdx : RS.StartIndices) {
630 unsigned EndIdx = StartIdx + StringLen - 1;
631 if (!CandidatesForRepeatedSeq.empty() &&
632 StartIdx <= CandidatesForRepeatedSeq.back().getEndIdx()) {
635 LLVM_DEBUG(
dbgs() <<
" .. DISCARD candidate @ [" << StartIdx <<
", "
636 << EndIdx <<
"]; overlaps with candidate @ ["
637 << CandidatesForRepeatedSeq.back().getStartIdx()
638 <<
", " << CandidatesForRepeatedSeq.back().getEndIdx()
652 CandidatesForRepeatedSeq.emplace_back(StartIdx, StringLen, StartIt, EndIt,
654 Mapper.MBBFlagsMap[
MBB]);
665 if (CandidatesForRepeatedSeq.size() < 2)
671 CandidatesForRepeatedSeq[0].getMF()->getSubtarget().getInstrInfo();
673 std::optional<OutlinedFunction> OF =
674 TII->getOutliningCandidateInfo(*MMI, CandidatesForRepeatedSeq);
678 if (!OF || OF->Candidates.size() < 2)
683 emitNotOutliningCheaperRemark(StringLen, CandidatesForRepeatedSeq, *OF);
687 FunctionList.push_back(*OF);
697 std::string FunctionName =
"OUTLINED_FUNCTION_";
698 if (OutlineRepeatedNum > 0)
699 FunctionName += std::to_string(OutlineRepeatedNum + 1) +
"_";
700 FunctionName += std::to_string(
Name);
706 Function::ExternalLinkage, FunctionName, M);
711 F->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
715 F->addFnAttr(Attribute::OptimizeForSize);
716 F->addFnAttr(Attribute::MinSize);
728 return std::max(K, C.getMF()->getFunction().getUWTableKind());
730 F->setUWTableKind(UW);
734 Builder.CreateRetVoid();
745 const std::vector<MCCFIInstruction> &Instrs =
747 for (
auto &
MI : FirstCand) {
748 if (
MI.isDebugInstr())
753 if (
MI.isCFIInstruction()) {
754 unsigned CFIIndex =
MI.getOperand(0).getCFIIndex();
770 MF.
getProperties().
set(MachineFunctionProperties::Property::TracksLiveness);
781 CandLiveIns.addLiveOuts(OutlineBB);
784 CandLiveIns.stepBackward(
MI);
793 TII.buildOutlinedFrame(
MBB, MF, OF);
801 DIFile *Unit = SP->getFile();
811 DB.createSubroutineType(
812 DB.getOrCreateTypeArray(std::nullopt)),
814 DINode::DIFlags::FlagArtificial ,
816 DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
819 DB.finalizeSubprogram(OutlinedSP);
822 F->setSubprogram(OutlinedSP);
830bool MachineOutliner::outline(
Module &M,
831 std::vector<OutlinedFunction> &FunctionList,
832 InstructionMapper &Mapper,
833 unsigned &OutlinedFunctionNum) {
835 LLVM_DEBUG(
dbgs() <<
"NUMBER OF POTENTIAL FUNCTIONS: " << FunctionList.size()
837 bool OutlinedSomething =
false;
843 return LHS.getNotOutlinedCost() *
RHS.getOutliningCost() >
844 RHS.getNotOutlinedCost() *
LHS.getOutliningCost();
849 auto *UnsignedVecBegin = Mapper.UnsignedVec.begin();
853 auto NumCandidatesBefore = OF.
Candidates.size();
858 return std::any_of(UnsignedVecBegin + C.getStartIdx(),
859 UnsignedVecBegin + C.getEndIdx() + 1, [](unsigned I) {
860 return I == static_cast<unsigned>(-1);
865 auto NumCandidatesAfter = OF.
Candidates.size();
866 LLVM_DEBUG(
dbgs() <<
"PRUNED: " << NumCandidatesBefore - NumCandidatesAfter
867 <<
"/" << NumCandidatesBefore <<
" candidates\n");
885 emitOutlinedFunctionRemark(OF);
887 OutlinedFunctionNum++;
903 auto MBBBeingOutlinedFromName =
909 << MFBeingOutlinedFromName <<
":"
910 << MBBBeingOutlinedFromName <<
"\n");
919 MachineFunctionProperties::Property::TracksLiveness)) {
933 Iter !=
Last; Iter++) {
943 DefRegs.
insert(MOP.getReg());
944 if (UseRegs.
count(MOP.getReg()) &&
945 !InstrUseRegs.
count(MOP.getReg()))
948 UseRegs.
erase(MOP.getReg());
949 }
else if (!MOP.isUndef()) {
952 UseRegs.
insert(MOP.getReg());
953 InstrUseRegs.
insert(MOP.getReg());
956 if (
MI->isCandidateForCallSiteEntry())
957 MI->getMF()->eraseCallSiteInfo(
MI);
976 MBB.
erase(std::next(StartIt), std::next(EndIt));
979 for (
unsigned &
I :
make_range(UnsignedVecBegin +
C.getStartIdx(),
980 UnsignedVecBegin +
C.getEndIdx() + 1))
981 I =
static_cast<unsigned>(-1);
982 OutlinedSomething =
true;
989 LLVM_DEBUG(
dbgs() <<
"OutlinedSomething = " << OutlinedSomething <<
"\n";);
990 return OutlinedSomething;
993void MachineOutliner::populateMapper(InstructionMapper &Mapper,
Module &M) {
1000 if (
F.hasFnAttribute(
"nooutline")) {
1001 LLVM_DEBUG(
dbgs() <<
"SKIP: Function has nooutline attribute\n");
1012 LLVM_DEBUG(
dbgs() <<
"SKIP: Function does not have a MachineFunction\n");
1017 if (!RunOnAllFunctions && !
TII->shouldOutlineFromFunctionByDefault(*MF)) {
1018 LLVM_DEBUG(
dbgs() <<
"SKIP: Target does not want to outline from "
1019 "function by default\n");
1025 if (!
TII->isFunctionSafeToOutlineFrom(*MF, OutlineFromLinkOnceODRs)) {
1027 <<
": unsafe to outline from\n");
1034 const unsigned MinMBBSize = 2;
1044 if (
MBB.
size() < MinMBBSize) {
1045 LLVM_DEBUG(
dbgs() <<
" SKIP: MBB size less than minimum size of "
1046 << MinMBBSize <<
"\n");
1058 Mapper.convertToUnsignedVec(
MBB, *
TII);
1062 UnsignedVecSize = Mapper.UnsignedVec.size();
1065void MachineOutliner::initSizeRemarkInfo(
1080void MachineOutliner::emitInstrCountChangedRemark(
1093 std::string Fname = std::string(
F.getName());
1095 unsigned FnCountBefore = 0;
1098 auto It = FunctionToInstrCount.
find(Fname);
1102 if (It != FunctionToInstrCount.
end())
1103 FnCountBefore = It->second;
1106 int64_t FnDelta =
static_cast<int64_t
>(FnCountAfter) -
1107 static_cast<int64_t
>(FnCountBefore);
1118 <<
": MI instruction count changed from "
1131bool MachineOutliner::runOnModule(
Module &M) {
1137 MMI = &getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
1140 unsigned OutlinedFunctionNum = 0;
1142 OutlineRepeatedNum = 0;
1143 if (!doOutline(M, OutlinedFunctionNum))
1147 OutlinedFunctionNum = 0;
1148 OutlineRepeatedNum++;
1149 if (!doOutline(M, OutlinedFunctionNum)) {
1151 dbgs() <<
"Did not outline on iteration " <<
I + 2 <<
" out of "
1161bool MachineOutliner::doOutline(
Module &M,
unsigned &OutlinedFunctionNum) {
1168 dbgs() <<
"Machine Outliner: Running on ";
1169 if (RunOnAllFunctions)
1170 dbgs() <<
"all functions";
1172 dbgs() <<
"target-default functions";
1179 InstructionMapper Mapper(*MMI);
1182 populateMapper(Mapper, M);
1183 std::vector<OutlinedFunction> FunctionList;
1186 findCandidates(Mapper, FunctionList);
1197 bool ShouldEmitSizeRemarks =
M.shouldEmitInstrCountChangedRemark();
1199 if (ShouldEmitSizeRemarks)
1200 initSizeRemarkInfo(M, FunctionToInstrCount);
1203 bool OutlinedSomething =
1204 outline(M, FunctionList, Mapper, OutlinedFunctionNum);
1209 if (ShouldEmitSizeRemarks && OutlinedSomething)
1210 emitInstrCountChangedRemark(M, FunctionToInstrCount);
1213 if (!OutlinedSomething)
1214 dbgs() <<
"Stopped outlining at iteration " << OutlineRepeatedNum
1215 <<
" because no changes were found.\n";
1218 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.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
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