Go to the documentation of this file.
41 #ifndef LLVM_TRANSFORMS_IPO_IROUTLINER_H
42 #define LLVM_TRANSFORMS_IPO_IROUTLINER_H
53 using namespace IRSimilarity;
56 class TargetTransformInfo;
57 class OptimizationRemarkEmitter;
74 unsigned NumExtractedInputs = 0;
78 unsigned OutputBlockNum = -1;
98 bool ChangedArgOrder =
false;
102 bool EndsInBranch =
false;
130 bool CandidateSplit =
false;
133 bool IgnoreRegion =
false;
154 : Candidate(&
C), Parent(&Group) {
155 StartBB =
C.getStartBB();
156 EndBB =
C.getEndBB();
161 void splitCandidate();
167 void reattachCandidate();
204 : getTTI(GTTI), getIRSI(GIRSI), getORE(GORE) {
208 "DenseMapInfo<unsigned>'s empty key isn't -1!");
210 "DenseMapInfo<unsigned>'s tombstone key isn't -2!");
220 unsigned doOutline(
Module &M);
241 pruneIncompatibleRegions(std::vector<IRSimilarityCandidate> &CandidateVec,
253 unsigned FunctionNameSuffix);
312 std::vector<Function *> &FuncsToRemove,
313 unsigned &OutlinedFunctionNum);
317 bool OutlineFromLinkODRs =
false;
322 bool CostModel =
true;
354 struct InstructionAllowed :
public InstVisitor<InstructionAllowed, bool> {
355 InstructionAllowed() =
default;
357 bool visitBranchInst(
BranchInst &BI) {
return EnableBranches; }
358 bool visitPHINode(PHINode &PN) {
return EnableBranches; }
360 bool visitAllocaInst(AllocaInst &AI) {
return false; }
364 bool visitVAArgInst(VAArgInst &
VI) {
return false; }
367 bool visitLandingPadInst(LandingPadInst &LPI) {
return false; }
368 bool visitFuncletPadInst(FuncletPadInst &FPI) {
return false; }
372 bool visitDbgInfoIntrinsic(DbgInfoIntrinsic &DII) {
return true; }
375 bool IntrinsicInst(IntrinsicInst &II) {
return EnableIntrinsics; }
378 bool visitCallInst(CallInst &CI) {
380 bool IsIndirectCall = CI.isIndirectCall();
381 if (IsIndirectCall && !EnableIndirectCalls)
383 if (!
F && !IsIndirectCall)
388 if (CI.canReturnTwice())
401 if (IsTailCC && !EnableMustTailCalls)
403 if (CI.isMustTailCall() && !EnableMustTailCalls)
407 if (CI.isMustTailCall() && !IsTailCC)
414 bool visitFreezeInst(FreezeInst &CI) {
return false; }
416 bool visitInvokeInst(InvokeInst &II) {
return false; }
418 bool visitCallBrInst(CallBrInst &CBI) {
return false; }
420 bool visitTerminator(Instruction &
I) {
return false; }
421 bool visitInstruction(Instruction &
I) {
return true; }
425 bool EnableBranches =
false;
429 bool EnableIndirectCalls =
true;
433 bool EnableIntrinsics =
false;
436 bool EnableMustTailCalls =
false;
440 InstructionAllowed InstructionClassifier;
451 #endif // LLVM_TRANSFORMS_IPO_IROUTLINER_H
A set of analyses that are preserved following a run of a transformation pass.
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
A CRTP mix-in to automatically provide informational APIs needed for passes.
A BumpPtrAllocator that allows only elements of a specific type to be allocated.
LLVM Basic Block Representation.
An information struct used to provide DenseMap with the various necessary components for a given valu...
IROutliner(function_ref< TargetTransformInfo &(Function &)> GTTI, function_ref< IRSimilarityIdentifier &(Module &)> GIRSI, function_ref< OptimizationRemarkEmitter &(Function &)> GORE)
@ Tail
Tail - This calling convention attemps to make calls as fast as possible while guaranteeing that tail...
OutlinableRegion(IRSimilarityCandidate &C, OutlinableGroup &Group)
(vector float) vec_cmpeq(*A, *B) C
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
An efficient, type-erasing, non-owning reference to a callable.
SmallVector< unsigned, 4 > GVNStores
The global value numbers that are used as outputs for this section.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This provides the utilities for hashing an Instruction to an unsigned integer.
A Module instance is used to store all the information related to an LLVM module.
The OutlinableGroup holds all the overarching information for outlining a set of regions that are str...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
DenseMap< unsigned, unsigned > ExtractedArgToAgg
Mapping the extracted argument number to the argument number in the overall function.
DenseMap< Value *, BasicBlock * > PHIBlocks
The PHIBlocks with their corresponding return block based on the return value as the key.
Base class for instruction visitors.
Machine Check Debug Module
An instruction for reading from memory.
Pass to outline similar regions.
DenseMap< unsigned, unsigned > AggArgToExtracted
The OutlinableRegion holds all the information for a specific region, or sequence of instructions.
This is a class that wraps a range of IRInstructionData from one point to another in the vector of IR...
A container for analyses that lazily runs them and caches their results.
This class is a pass that identifies similarity in a Module, extracts instances of the similarity,...
This class represents a function call, abstracting a target machine's calling convention.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
This class puts all the pieces of the IRInstructionData, IRInstructionMapper, IRSimilarityCandidate t...
Conditional or Unconditional Branch instruction.
DenseMap< Value *, Value * > RemappedArguments
Values in the outlined functions will often be replaced by arguments.
LLVM Value Representation.
DenseMap< unsigned, Constant * > AggArgToConstant
Mapping of the argument number in the deduplicated function to a given constant, which is used when c...
@ SwiftTail
SwiftTail - This follows the Swift calling convention in how arguments are passed but guarantees tail...