81#define DEBUG_TYPE "machine-outliner"
85using namespace outliner;
88STATISTIC(NumOutlined,
"Number of candidates outlined");
89STATISTIC(FunctionsCreated,
"Number of functions created");
92STATISTIC(NumLegalInUnsignedVec,
"Outlinable instructions mapped");
94 "Unoutlinable instructions mapped + number of sentinel values");
95STATISTIC(NumSentinels,
"Sentinel values inserted during mapping");
97 "Invisible instructions skipped during mapping");
99 "Total number of instructions mapped and saved to mapping vector");
108 cl::desc(
"Enable the machine outliner on linkonceodr functions"),
117 "Number of times to rerun the outliner after the initial outline"));
122 "The minimum size in bytes before an outlining candidate is accepted"));
127struct InstructionMapper {
133 unsigned IllegalInstrNumber = -3;
137 unsigned LegalInstrNumber = 0;
141 InstructionIntegerMap;
157 bool AddedIllegalLastTime =
false;
165 unsigned mapToLegalUnsigned(
167 bool &HaveLegalRange,
unsigned &NumLegalInBlock,
172 AddedIllegalLastTime =
false;
176 if (CanOutlineWithPrevInstr)
177 HaveLegalRange =
true;
178 CanOutlineWithPrevInstr =
true;
190 std::tie(ResultIt, WasInserted) =
191 InstructionIntegerMap.
insert(std::make_pair(&
MI, LegalInstrNumber));
192 unsigned MINumber = ResultIt->second;
201 if (LegalInstrNumber >= IllegalInstrNumber)
205 "Tried to assign DenseMap tombstone or empty key to instruction.");
207 "Tried to assign DenseMap tombstone or empty key to instruction.");
210 ++NumLegalInUnsignedVec;
220 unsigned mapToIllegalUnsigned(
225 CanOutlineWithPrevInstr =
false;
228 if (AddedIllegalLastTime)
229 return IllegalInstrNumber;
232 AddedIllegalLastTime =
true;
233 unsigned MINumber = IllegalInstrNumber;
236 UnsignedVecForMBB.
push_back(IllegalInstrNumber);
237 IllegalInstrNumber--;
239 ++NumIllegalInUnsignedVec;
241 assert(LegalInstrNumber < IllegalInstrNumber &&
242 "Instruction mapping overflow!");
245 "IllegalInstrNumber cannot be DenseMap tombstone or empty key!");
248 "IllegalInstrNumber cannot be DenseMap tombstone or empty key!");
266 <<
"' to unsigned vector ***\n");
270 if (!
TII.isMBBSafeToOutlineFrom(
MBB, Flags))
273 auto OutlinableRanges =
TII.getOutlinableRanges(
MBB, Flags);
275 <<
" outlinable range(s)\n");
276 if (OutlinableRanges.empty())
286 unsigned NumLegalInBlock = 0;
290 bool HaveLegalRange =
false;
294 bool CanOutlineWithPrevInstr =
false;
302 for (
auto &OutlinableRange : OutlinableRanges) {
303 auto OutlinableRangeBegin = OutlinableRange.first;
304 auto OutlinableRangeEnd = OutlinableRange.second;
308 << std::distance(OutlinableRangeBegin, OutlinableRangeEnd)
309 <<
" instruction range\n");
311 unsigned NumSkippedInRange = 0;
313 for (; It != OutlinableRangeBegin; ++It) {
317 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
322 <<
" instructions outside outlinable range\n");
324 assert(It !=
MBB.
end() &&
"Should still have instructions?");
327 for (; It != OutlinableRangeEnd; ++It) {
329 switch (
TII.getOutliningType(It, Flags)) {
330 case InstrType::Illegal:
331 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
335 case InstrType::Legal:
336 mapToLegalUnsigned(It, CanOutlineWithPrevInstr, HaveLegalRange,
337 NumLegalInBlock, UnsignedVecForMBB,
341 case InstrType::LegalTerminator:
342 mapToLegalUnsigned(It, CanOutlineWithPrevInstr, HaveLegalRange,
343 NumLegalInBlock, UnsignedVecForMBB,
347 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
351 case InstrType::Invisible:
355 AddedIllegalLastTime =
false;
361 LLVM_DEBUG(
dbgs() <<
"HaveLegalRange = " << HaveLegalRange <<
"\n");
365 if (HaveLegalRange) {
370 mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB,
378 InstructionMapper() {
382 "DenseMapInfo<unsigned>'s empty key isn't -1!");
384 "DenseMapInfo<unsigned>'s tombstone key isn't -2!");
403 bool OutlineFromLinkOnceODRs =
false;
406 unsigned OutlineRepeatedNum = 0;
412 bool RunOnAllFunctions =
true;
429 void emitNotOutliningCheaperRemark(
430 unsigned StringLen, std::vector<Candidate> &CandidatesForRepeatedSeq,
449 void findCandidates(InstructionMapper &Mapper,
450 std::vector<OutlinedFunction> &FunctionList);
458 bool outline(
Module &M, std::vector<OutlinedFunction> &FunctionList,
459 InstructionMapper &Mapper,
unsigned &OutlinedFunctionNum);
463 InstructionMapper &Mapper,
471 bool doOutline(
Module &M,
unsigned &OutlinedFunctionNum);
485 void populateMapper(InstructionMapper &Mapper,
Module &M,
503char MachineOutliner::ID = 0;
507 MachineOutliner *OL =
new MachineOutliner();
508 OL->RunOnAllFunctions = RunOnAllFunctions;
517void MachineOutliner::emitNotOutliningCheaperRemark(
518 unsigned StringLen,
std::vector<
Candidate> &CandidatesForRepeatedSeq,
524 Candidate &
C = CandidatesForRepeatedSeq.front();
528 C.front()->getDebugLoc(),
C.getMBB());
529 R <<
"Did not outline " <<
NV(
"Length", StringLen) <<
" instructions"
530 <<
" from " <<
NV(
"NumOccurrences", CandidatesForRepeatedSeq.size())
532 <<
" Bytes from outlining all occurrences ("
533 <<
NV(
"OutliningCost", OF.getOutliningCost()) <<
")"
534 <<
" >= Unoutlined instruction bytes ("
535 <<
NV(
"NotOutliningCost", OF.getNotOutlinedCost()) <<
")"
536 <<
" (Also found at: ";
539 for (
unsigned i = 1, e = CandidatesForRepeatedSeq.size(); i < e; i++) {
541 CandidatesForRepeatedSeq[i].front()->
getDebugLoc());
556 R <<
"Saved " <<
NV(
"OutliningBenefit", OF.
getBenefit()) <<
" bytes by "
557 <<
"outlining " <<
NV(
"Length", OF.
getNumInstrs()) <<
" instructions "
563 for (
size_t i = 0, e = OF.
Candidates.size(); i < e; i++) {
576void MachineOutliner::findCandidates(
577 InstructionMapper &Mapper, std::vector<OutlinedFunction> &FunctionList) {
578 FunctionList.clear();
583 std::vector<Candidate> CandidatesForRepeatedSeq;
584 LLVM_DEBUG(
dbgs() <<
"*** Discarding overlapping candidates *** \n");
586 dbgs() <<
"Searching for overlaps in all repeated sequences...\n");
588 CandidatesForRepeatedSeq.clear();
589 unsigned StringLen = RS.Length;
593 unsigned NumDiscarded = 0;
594 unsigned NumKept = 0;
596 for (
const unsigned &StartIdx : RS.StartIndices) {
618 unsigned EndIdx = StartIdx + StringLen - 1;
620 CandidatesForRepeatedSeq, [StartIdx, EndIdx](
const Candidate &
C) {
621 return EndIdx >=
C.getStartIdx() && StartIdx <=
C.getEndIdx();
623 if (FirstOverlap != CandidatesForRepeatedSeq.end()) {
627 <<
", " << EndIdx <<
"]; overlaps with candidate @ ["
628 << FirstOverlap->getStartIdx() <<
", "
629 << FirstOverlap->getEndIdx() <<
"]\n");
642 CandidatesForRepeatedSeq.emplace_back(StartIdx, StringLen, StartIt, EndIt,
644 Mapper.MBBFlagsMap[
MBB]);
655 if (CandidatesForRepeatedSeq.size() < 2)
661 CandidatesForRepeatedSeq[0].getMF()->getSubtarget().getInstrInfo();
663 std::optional<OutlinedFunction> OF =
664 TII->getOutliningCandidateInfo(CandidatesForRepeatedSeq);
668 if (!OF || OF->Candidates.size() < 2)
673 emitNotOutliningCheaperRemark(StringLen, CandidatesForRepeatedSeq, *OF);
677 FunctionList.push_back(*OF);
687 std::string FunctionName =
"OUTLINED_FUNCTION_";
688 if (OutlineRepeatedNum > 0)
689 FunctionName += std::to_string(OutlineRepeatedNum + 1) +
"_";
690 FunctionName += std::to_string(
Name);
696 Function::ExternalLinkage, FunctionName, M);
701 F->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
705 F->addFnAttr(Attribute::OptimizeForSize);
706 F->addFnAttr(Attribute::MinSize);
718 return std::max(K, C.getMF()->getFunction().getUWTableKind());
720 if (UW != UWTableKind::None)
721 F->setUWTableKind(UW);
736 const std::vector<MCCFIInstruction> &Instrs =
738 for (
auto I = FirstCand.
front(),
E = std::next(FirstCand.
back());
I !=
E;
740 if (
I->isDebugInstr())
745 if (
I->isCFIInstruction()) {
746 unsigned CFIIndex =
I->getOperand(0).getCFIIndex();
762 MF.
getProperties().
set(MachineFunctionProperties::Property::TracksLiveness);
773 CandLiveIns.addLiveOuts(OutlineBB);
776 CandLiveIns.stepBackward(
MI);
785 TII.buildOutlinedFrame(
MBB, MF, OF);
793 DIFile *Unit = SP->getFile();
801 Unit ,
F->getName(),
StringRef(MangledNameStream.str()),
804 DB.createSubroutineType(
805 DB.getOrCreateTypeArray(std::nullopt)),
807 DINode::DIFlags::FlagArtificial ,
809 DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
812 DB.finalizeSubprogram(OutlinedSP);
815 F->setSubprogram(OutlinedSP);
823bool MachineOutliner::outline(
Module &M,
824 std::vector<OutlinedFunction> &FunctionList,
825 InstructionMapper &Mapper,
826 unsigned &OutlinedFunctionNum) {
828 LLVM_DEBUG(
dbgs() <<
"NUMBER OF POTENTIAL FUNCTIONS: " << FunctionList.size()
830 bool OutlinedSomething =
false;
835 return LHS.getBenefit() >
RHS.getBenefit();
840 auto *UnsignedVecBegin = Mapper.UnsignedVec.begin();
844 auto NumCandidatesBefore = OF.
Candidates.size();
849 return std::any_of(UnsignedVecBegin + C.getStartIdx(),
850 UnsignedVecBegin + C.getEndIdx() + 1, [](unsigned I) {
851 return I == static_cast<unsigned>(-1);
856 auto NumCandidatesAfter = OF.
Candidates.size();
857 LLVM_DEBUG(
dbgs() <<
"PRUNED: " << NumCandidatesBefore - NumCandidatesAfter
858 <<
"/" << NumCandidatesBefore <<
" candidates\n");
876 emitOutlinedFunctionRemark(OF);
878 OutlinedFunctionNum++;
894 auto MBBBeingOutlinedFromName =
900 << MFBeingOutlinedFromName <<
":"
901 << MBBBeingOutlinedFromName <<
"\n");
910 MachineFunctionProperties::Property::TracksLiveness)) {
924 Iter !=
Last; Iter++) {
934 DefRegs.
insert(MOP.getReg());
935 if (UseRegs.
count(MOP.getReg()) &&
936 !InstrUseRegs.
count(MOP.getReg()))
939 UseRegs.
erase(MOP.getReg());
940 }
else if (!MOP.isUndef()) {
943 UseRegs.
insert(MOP.getReg());
944 InstrUseRegs.
insert(MOP.getReg());
947 if (
MI->isCandidateForCallSiteEntry())
948 MI->getMF()->eraseCallSiteInfo(
MI);
967 MBB.
erase(std::next(StartIt), std::next(EndIt));
970 for (
unsigned &
I :
make_range(UnsignedVecBegin +
C.getStartIdx(),
971 UnsignedVecBegin +
C.getEndIdx() + 1))
972 I =
static_cast<unsigned>(-1);
973 OutlinedSomething =
true;
980 LLVM_DEBUG(
dbgs() <<
"OutlinedSomething = " << OutlinedSomething <<
"\n";);
981 return OutlinedSomething;
984void MachineOutliner::populateMapper(InstructionMapper &Mapper,
Module &M,
992 if (
F.hasFnAttribute(
"nooutline")) {
1004 LLVM_DEBUG(
dbgs() <<
"SKIP: Function does not have a MachineFunction\n");
1009 if (!RunOnAllFunctions && !
TII->shouldOutlineFromFunctionByDefault(*MF)) {
1010 LLVM_DEBUG(
dbgs() <<
"SKIP: Target does not want to outline from "
1011 "function by default\n");
1017 if (!
TII->isFunctionSafeToOutlineFrom(*MF, OutlineFromLinkOnceODRs)) {
1019 <<
": unsafe to outline from\n");
1026 const unsigned MinMBBSize = 2;
1036 if (
MBB.
size() < MinMBBSize) {
1037 LLVM_DEBUG(
dbgs() <<
" SKIP: MBB size less than minimum size of "
1038 << MinMBBSize <<
"\n");
1050 Mapper.convertToUnsignedVec(
MBB, *
TII);
1054 UnsignedVecSize = Mapper.UnsignedVec.size();
1057void MachineOutliner::initSizeRemarkInfo(
1073void MachineOutliner::emitInstrCountChangedRemark(
1087 std::string Fname = std::string(
F.getName());
1089 unsigned FnCountBefore = 0;
1092 auto It = FunctionToInstrCount.
find(Fname);
1096 if (It != FunctionToInstrCount.
end())
1097 FnCountBefore = It->second;
1100 int64_t FnDelta =
static_cast<int64_t
>(FnCountAfter) -
1101 static_cast<int64_t
>(FnCountBefore);
1112 <<
": MI instruction count changed from "
1125bool MachineOutliner::runOnModule(
Module &M) {
1132 unsigned OutlinedFunctionNum = 0;
1134 OutlineRepeatedNum = 0;
1135 if (!doOutline(M, OutlinedFunctionNum))
1139 OutlinedFunctionNum = 0;
1140 OutlineRepeatedNum++;
1141 if (!doOutline(M, OutlinedFunctionNum)) {
1143 dbgs() <<
"Did not outline on iteration " <<
I + 2 <<
" out of "
1153bool MachineOutliner::doOutline(
Module &M,
unsigned &OutlinedFunctionNum) {
1162 dbgs() <<
"Machine Outliner: Running on ";
1163 if (RunOnAllFunctions)
1164 dbgs() <<
"all functions";
1166 dbgs() <<
"target-default functions";
1173 InstructionMapper Mapper;
1176 populateMapper(Mapper, M, MMI);
1177 std::vector<OutlinedFunction> FunctionList;
1180 findCandidates(Mapper, FunctionList);
1191 bool ShouldEmitSizeRemarks =
M.shouldEmitInstrCountChangedRemark();
1193 if (ShouldEmitSizeRemarks)
1194 initSizeRemarkInfo(M, MMI, FunctionToInstrCount);
1197 bool OutlinedSomething =
1198 outline(M, FunctionList, Mapper, OutlinedFunctionNum);
1203 if (ShouldEmitSizeRemarks && OutlinedSomething)
1204 emitInstrCountChangedRemark(M, MMI, FunctionToInstrCount);
1207 if (!OutlinedSomething)
1208 dbgs() <<
"Stopped outlining at iteration " << OutlineRepeatedNum
1209 <<
" because no changes were found.\n";
1212 return OutlinedSomething;
unsigned const MachineRegisterInfo * MRI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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< 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
static Function * createOutlinedFunction(OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, StringRef FuncName, SmallVectorImpl< Value * > &Inputs, OpenMPIRBuilder::TargetBodyGenCallbackTy &CBFunc)
#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 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.
MachineBasicBlock * CreateMachineBasicBlock(const BasicBlock *bb=nullptr)
CreateMachineBasicBlock - Allocate a new MachineBasicBlock.
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
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.
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(const MachineFunction &)
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 a range to a container.
auto reverse(ContainerTy &&C)
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.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
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.
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.
MachineBasicBlock::iterator & front()
MachineFunction * getMF() const
MachineBasicBlock::iterator & back()
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