Loading llvm/lib/CodeGen/MachineOutliner.cpp +27 −34 Original line number Diff line number Diff line Loading @@ -91,8 +91,7 @@ STATISTIC(FunctionsCreated, "Number of functions created"); // this is off by default. It should, however, be the default behaviour in // LTO. static cl::opt<bool> EnableLinkOnceODROutlining( "enable-linkonceodr-outlining", cl::Hidden, "enable-linkonceodr-outlining", cl::Hidden, cl::desc("Enable the machine outliner on linkonceodr functions"), cl::init(false)); Loading Loading @@ -301,8 +300,8 @@ private: "Non-root internal nodes must have parents!"); unsigned *E = new (InternalEndIdxAllocator) unsigned(EndIdx); SuffixTreeNode *N = new (NodeAllocator.Allocate()) SuffixTreeNode(StartIdx, E, Root); SuffixTreeNode *N = new (NodeAllocator.Allocate()) SuffixTreeNode(StartIdx, E, Root); if (Parent) Parent->Children[Edge] = N; Loading Loading @@ -490,7 +489,6 @@ public: setSuffixIndices(*Root, 0); } /// Iterator for finding all repeated substrings in the suffix tree. struct RepeatedSubstringIterator { private: Loading Loading @@ -694,8 +692,9 @@ struct InstructionMapper { /// IllegalInstrNumber. /// /// \returns The integer that \p *It was mapped to. unsigned mapToIllegalUnsigned(MachineBasicBlock::iterator &It, bool &CanOutlineWithPrevInstr, std::vector<unsigned> &UnsignedVecForMBB, unsigned mapToIllegalUnsigned( MachineBasicBlock::iterator &It, bool &CanOutlineWithPrevInstr, std::vector<unsigned> &UnsignedVecForMBB, std::vector<MachineBasicBlock::iterator> &InstrListForMBB) { // Can't outline an illegal instruction. Set the flag. CanOutlineWithPrevInstr = false; Loading Loading @@ -768,8 +767,8 @@ struct InstructionMapper { // Keep track of where this instruction is in the module. switch (TII.getOutliningType(It, Flags)) { case InstrType::Illegal: mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB, InstrListForMBB); mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB, InstrListForMBB); break; case InstrType::Legal: Loading Loading @@ -888,8 +887,7 @@ struct MachineOutliner : public ModulePass { /// \param FunctionList A list of functions to be inserted into the module. /// \param Mapper Contains the instruction mappings for the module. bool outline(Module &M, std::vector<OutlinedFunction> &FunctionList, InstructionMapper &Mapper, unsigned &OutlinedFunctionNum); InstructionMapper &Mapper, unsigned &OutlinedFunctionNum); /// Creates a function for \p OF and inserts it into the module. MachineFunction *createOutlinedFunction(Module &M, OutlinedFunction &OF, Loading Loading @@ -922,14 +920,13 @@ struct MachineOutliner : public ModulePass { /// FIXME: This should be handled by the pass manager, not the outliner. /// FIXME: This is nearly identical to the initSizeRemarkInfo in the legacy /// pass manager. void initSizeRemarkInfo( const Module &M, const MachineModuleInfo &MMI, void initSizeRemarkInfo(const Module &M, const MachineModuleInfo &MMI, StringMap<unsigned> &FunctionToInstrCount); /// Emit the remark. // FIXME: This should be handled by the pass manager, not the outliner. void emitInstrCountChangedRemark( const Module &M, const MachineModuleInfo &MMI, void emitInstrCountChangedRemark(const Module &M, const MachineModuleInfo &MMI, const StringMap<unsigned> &FunctionToInstrCount); }; } // Anonymous namespace. Loading Loading @@ -1007,9 +1004,8 @@ void MachineOutliner::emitOutlinedFunctionRemark(OutlinedFunction &OF) { MORE.emit(R); } void MachineOutliner::findCandidates(InstructionMapper &Mapper, std::vector<OutlinedFunction> &FunctionList) { void MachineOutliner::findCandidates( InstructionMapper &Mapper, std::vector<OutlinedFunction> &FunctionList) { FunctionList.clear(); SuffixTree ST(Mapper.UnsignedVec); Loading Loading @@ -1091,10 +1087,8 @@ MachineOutliner::findCandidates(InstructionMapper &Mapper, } } MachineFunction * MachineOutliner::createOutlinedFunction(Module &M, OutlinedFunction &OF, InstructionMapper &Mapper, unsigned Name) { MachineFunction *MachineOutliner::createOutlinedFunction( Module &M, OutlinedFunction &OF, InstructionMapper &Mapper, unsigned Name) { // Create the function name. This should be unique. // FIXME: We should have a better naming scheme. This should be stable, Loading Loading @@ -1405,8 +1399,7 @@ void MachineOutliner::emitInstrCountChangedRemark( MachineOptimizationRemarkEmitter MORE(*MF, nullptr); MORE.emit([&]() { MachineOptimizationRemarkAnalysis R("size-info", "FunctionMISizeChange", DiagnosticLocation(), &MF->front()); DiagnosticLocation(), &MF->front()); R << DiagnosticInfoOptimizationBase::Argument("Pass", "Machine Outliner") << ": Function: " << DiagnosticInfoOptimizationBase::Argument("Function", F.getName()) Loading Loading @@ -1445,14 +1438,14 @@ bool MachineOutliner::doOutline(Module &M, unsigned &OutlinedFunctionNum) { // Otherwise, if the target supports default outlining, it will run on all // functions deemed by the target to be worth outlining from by default. Tell // the user how the outliner is running. LLVM_DEBUG( LLVM_DEBUG({ dbgs() << "Machine Outliner: Running on "; if (RunOnAllFunctions) dbgs() << "all functions"; else dbgs() << "target-default functions"; dbgs() << "\n" ); dbgs() << "\n"; }); // If the user specifies that they want to outline from linkonceodrs, set // it here. Loading Loading
llvm/lib/CodeGen/MachineOutliner.cpp +27 −34 Original line number Diff line number Diff line Loading @@ -91,8 +91,7 @@ STATISTIC(FunctionsCreated, "Number of functions created"); // this is off by default. It should, however, be the default behaviour in // LTO. static cl::opt<bool> EnableLinkOnceODROutlining( "enable-linkonceodr-outlining", cl::Hidden, "enable-linkonceodr-outlining", cl::Hidden, cl::desc("Enable the machine outliner on linkonceodr functions"), cl::init(false)); Loading Loading @@ -301,8 +300,8 @@ private: "Non-root internal nodes must have parents!"); unsigned *E = new (InternalEndIdxAllocator) unsigned(EndIdx); SuffixTreeNode *N = new (NodeAllocator.Allocate()) SuffixTreeNode(StartIdx, E, Root); SuffixTreeNode *N = new (NodeAllocator.Allocate()) SuffixTreeNode(StartIdx, E, Root); if (Parent) Parent->Children[Edge] = N; Loading Loading @@ -490,7 +489,6 @@ public: setSuffixIndices(*Root, 0); } /// Iterator for finding all repeated substrings in the suffix tree. struct RepeatedSubstringIterator { private: Loading Loading @@ -694,8 +692,9 @@ struct InstructionMapper { /// IllegalInstrNumber. /// /// \returns The integer that \p *It was mapped to. unsigned mapToIllegalUnsigned(MachineBasicBlock::iterator &It, bool &CanOutlineWithPrevInstr, std::vector<unsigned> &UnsignedVecForMBB, unsigned mapToIllegalUnsigned( MachineBasicBlock::iterator &It, bool &CanOutlineWithPrevInstr, std::vector<unsigned> &UnsignedVecForMBB, std::vector<MachineBasicBlock::iterator> &InstrListForMBB) { // Can't outline an illegal instruction. Set the flag. CanOutlineWithPrevInstr = false; Loading Loading @@ -768,8 +767,8 @@ struct InstructionMapper { // Keep track of where this instruction is in the module. switch (TII.getOutliningType(It, Flags)) { case InstrType::Illegal: mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB, InstrListForMBB); mapToIllegalUnsigned(It, CanOutlineWithPrevInstr, UnsignedVecForMBB, InstrListForMBB); break; case InstrType::Legal: Loading Loading @@ -888,8 +887,7 @@ struct MachineOutliner : public ModulePass { /// \param FunctionList A list of functions to be inserted into the module. /// \param Mapper Contains the instruction mappings for the module. bool outline(Module &M, std::vector<OutlinedFunction> &FunctionList, InstructionMapper &Mapper, unsigned &OutlinedFunctionNum); InstructionMapper &Mapper, unsigned &OutlinedFunctionNum); /// Creates a function for \p OF and inserts it into the module. MachineFunction *createOutlinedFunction(Module &M, OutlinedFunction &OF, Loading Loading @@ -922,14 +920,13 @@ struct MachineOutliner : public ModulePass { /// FIXME: This should be handled by the pass manager, not the outliner. /// FIXME: This is nearly identical to the initSizeRemarkInfo in the legacy /// pass manager. void initSizeRemarkInfo( const Module &M, const MachineModuleInfo &MMI, void initSizeRemarkInfo(const Module &M, const MachineModuleInfo &MMI, StringMap<unsigned> &FunctionToInstrCount); /// Emit the remark. // FIXME: This should be handled by the pass manager, not the outliner. void emitInstrCountChangedRemark( const Module &M, const MachineModuleInfo &MMI, void emitInstrCountChangedRemark(const Module &M, const MachineModuleInfo &MMI, const StringMap<unsigned> &FunctionToInstrCount); }; } // Anonymous namespace. Loading Loading @@ -1007,9 +1004,8 @@ void MachineOutliner::emitOutlinedFunctionRemark(OutlinedFunction &OF) { MORE.emit(R); } void MachineOutliner::findCandidates(InstructionMapper &Mapper, std::vector<OutlinedFunction> &FunctionList) { void MachineOutliner::findCandidates( InstructionMapper &Mapper, std::vector<OutlinedFunction> &FunctionList) { FunctionList.clear(); SuffixTree ST(Mapper.UnsignedVec); Loading Loading @@ -1091,10 +1087,8 @@ MachineOutliner::findCandidates(InstructionMapper &Mapper, } } MachineFunction * MachineOutliner::createOutlinedFunction(Module &M, OutlinedFunction &OF, InstructionMapper &Mapper, unsigned Name) { MachineFunction *MachineOutliner::createOutlinedFunction( Module &M, OutlinedFunction &OF, InstructionMapper &Mapper, unsigned Name) { // Create the function name. This should be unique. // FIXME: We should have a better naming scheme. This should be stable, Loading Loading @@ -1405,8 +1399,7 @@ void MachineOutliner::emitInstrCountChangedRemark( MachineOptimizationRemarkEmitter MORE(*MF, nullptr); MORE.emit([&]() { MachineOptimizationRemarkAnalysis R("size-info", "FunctionMISizeChange", DiagnosticLocation(), &MF->front()); DiagnosticLocation(), &MF->front()); R << DiagnosticInfoOptimizationBase::Argument("Pass", "Machine Outliner") << ": Function: " << DiagnosticInfoOptimizationBase::Argument("Function", F.getName()) Loading Loading @@ -1445,14 +1438,14 @@ bool MachineOutliner::doOutline(Module &M, unsigned &OutlinedFunctionNum) { // Otherwise, if the target supports default outlining, it will run on all // functions deemed by the target to be worth outlining from by default. Tell // the user how the outliner is running. LLVM_DEBUG( LLVM_DEBUG({ dbgs() << "Machine Outliner: Running on "; if (RunOnAllFunctions) dbgs() << "all functions"; else dbgs() << "target-default functions"; dbgs() << "\n" ); dbgs() << "\n"; }); // If the user specifies that they want to outline from linkonceodrs, set // it here. Loading