[llvm] r186853 - Initialize/Register LTO passes to enable flags like -print-after=<lto-pass>
Shuxin Yang
shuxin.llvm at gmail.com
Mon Jul 22 23:47:02 PDT 2013
Thank you Nick. Committed in r186931. Sorry for being sloppy.
On 7/22/13 10:35 PM, Nick Lewycky wrote:
> Shuxin Yang wrote:
>> Author: shuxin_yang
>> Date: Mon Jul 22 13:40:34 2013
>> New Revision: 186853
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=186853&view=rev
>> Log:
>> Initialize/Register LTO passes to enable flags like
>> -print-after=<lto-pass>
>>
>> There already have two "dead" functions, initialize{IPO|IPA}, defined
>> for
>> similar purpose. I decide not to call these two functions for two
>> reasons:
>> o. they don't cover all LTO passes (which will soon be separated
>> into IPO
>> and post-IPO passes)
>> o. We have not yet figured out the right passes and the ordering
>> for IPO
>> and post-IPO stages, meaning this change is only for the time
>> being.
>>
>> Since LTO passes are registered, we are now able to print IR before and
>> after particular point.
>>
>> For OSX users:
>> --------------
>> "...-Wl,-mllvm -Wl,-print-after=<pass-name>" will print IR after the
>> specified pass.
>>
>> For Other UNIX with GNU gold linker:
>> ------------------------------------
>> "-Wl,-plugin-opt=-print-after=<pass-name>" should work.
>> (NOTE: no need for "-Wl,-mllvm")
>>
>> Strip "-Wl," if flags are fed directly to linker instead of
>> clang/clang++.
>>
>> Modified:
>> llvm/trunk/tools/lto/LTOCodeGenerator.cpp
>> llvm/trunk/tools/lto/LTOCodeGenerator.h
>>
>> Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=186853&r1=186852&r2=186853&view=diff
>> ==============================================================================
>>
>> --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
>> +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Mon Jul 22 13:40:34 2013
>> @@ -24,6 +24,7 @@
>> #include "llvm/IR/DerivedTypes.h"
>> #include "llvm/IR/LLVMContext.h"
>> #include "llvm/IR/Module.h"
>> +#include "llvm/InitializePasses.h"
>> #include "llvm/Linker.h"
>> #include "llvm/MC/MCAsmInfo.h"
>> #include "llvm/MC/MCContext.h"
>> @@ -77,6 +78,7 @@ LTOCodeGenerator::LTOCodeGenerator()
>> InitializeAllTargets();
>> InitializeAllTargetMCs();
>> InitializeAllAsmPrinters();
>> + initializeLTOPasses();
>> }
>>
>> LTOCodeGenerator::~LTOCodeGenerator() {
>> @@ -89,6 +91,36 @@ LTOCodeGenerator::~LTOCodeGenerator() {
>> free(*I);
>> }
>>
>> +// Initialize LTO passes. Please keep this funciton in sync with
>> +// PassManagerBuilder::populateLTOPassManager(), and make sure all LTO
>
> Two spaces in "and make" should be one space.
>
> Nick
>
>> +// passes are initialized.
>> +//
>> +void LTOCodeGenerator::initializeLTOPasses() {
>> + PassRegistry&R = *PassRegistry::getPassRegistry();
>> +
>> + initializeInternalizePassPass(R);
>> + initializeIPSCCPPass(R);
>> + initializeGlobalOptPass(R);
>> + initializeConstantMergePass(R);
>> + initializeDAHPass(R);
>> + initializeInstCombinerPass(R);
>> + initializeSimpleInlinerPass(R);
>> + initializePruneEHPass(R);
>> + initializeGlobalDCEPass(R);
>> + initializeArgPromotionPass(R);
>> + initializeJumpThreadingPass(R);
>> + initializeSROAPass(R);
>> + initializeSROA_DTPass(R);
>> + initializeSROA_SSAUpPass(R);
>> + initializeFunctionAttrsPass(R);
>> + initializeGlobalsModRefPass(R);
>> + initializeLICMPass(R);
>> + initializeGVNPass(R);
>> + initializeMemCpyOptPass(R);
>> + initializeDCEPass(R);
>> + initializeCFGSimplifyPassPass(R);
>> +}
>> +
>> bool LTOCodeGenerator::addModule(LTOModule* mod, std::string&
>> errMsg) {
>> bool ret = _linker.linkInModule(mod->getLLVVMModule(),&errMsg);
>>
>>
>> Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=186853&r1=186852&r2=186853&view=diff
>> ==============================================================================
>>
>> --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original)
>> +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Mon Jul 22 13:40:34 2013
>> @@ -56,6 +56,8 @@ struct LTOCodeGenerator {
>> void setCodeGenDebugOptions(const char *opts);
>>
>> private:
>> + void initializeLTOPasses();
>> +
>> bool generateObjectFile(llvm::raw_ostream&out, std::string&errMsg);
>> void applyScopeRestrictions();
>> void applyRestriction(llvm::GlobalValue&GV,
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
More information about the llvm-commits
mailing list