[llvm] r210641 - Create macro INITIALIZE_TM_PASS.
Quentin Colombet
qcolombet at apple.com
Wed Jun 11 11:00:18 PDT 2014
I think this needs more discussion.
I have proposed something similar back in January and we agreed it was not a good idea to expose such interface:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140113/201619.html
The bottom line is, this situation is supposed to be the exception and we do not want to provide support for it. The rational is that using target interface, you may violate the layer of LLVM, i.e., you may create a libraries dependencies.
Thanks,
-Quentin
On Jun 11, 2014, at 6:16 AM, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:
> Thanks!
>
> On 11 June 2014 03:04, Jiangning Liu <jiangning.liu at arm.com> wrote:
>> Author: jiangning
>> Date: Wed Jun 11 02:04:37 2014
>> New Revision: 210641
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=210641&view=rev
>> Log:
>> Create macro INITIALIZE_TM_PASS.
>>
>> Pass initialization requires to initialize TargetMachine for back-end
>> specific passes. This commit creates a new macro INITIALIZE_TM_PASS to
>> simplify this kind of initialization.
>>
>> Modified:
>> llvm/trunk/include/llvm/PassSupport.h
>> llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp
>> llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
>> llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp
>>
>> Modified: llvm/trunk/include/llvm/PassSupport.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=210641&r1=210640&r2=210641&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/PassSupport.h (original)
>> +++ llvm/trunk/include/llvm/PassSupport.h Wed Jun 11 02:04:37 2014
>> @@ -166,6 +166,18 @@ private:
>> } \
>> TsanHappensAfter(&initialized);
>>
>> +#define INITIALIZE_TM_PASS(passName, arg, name, cfg, analysis) \
>> + static void* initialize##passName##PassOnce(PassRegistry &Registry) { \
>> + PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
>> + PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis, \
>> + PassInfo::TargetMachineCtor_t(callTargetMachineCtor< passName >)); \
>> + Registry.registerPass(*PI, true); \
>> + return PI; \
>> + } \
>> + void llvm::initialize##passName##Pass(PassRegistry &Registry) { \
>> + CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \
>> + }
>> +
>> #define INITIALIZE_PASS(passName, arg, name, cfg, analysis) \
>> static void* initialize##passName##PassOnce(PassRegistry &Registry) { \
>> PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \
>>
>> Modified: llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp?rev=210641&r1=210640&r2=210641&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp Wed Jun 11 02:04:37 2014
>> @@ -50,22 +50,9 @@ namespace {
>>
>> char AtomicExpandLoadLinked::ID = 0;
>> char &llvm::AtomicExpandLoadLinkedID = AtomicExpandLoadLinked::ID;
>> -
>> -static void *initializeAtomicExpandLoadLinkedPassOnce(PassRegistry &Registry) {
>> - PassInfo *PI = new PassInfo(
>> - "Expand Atomic calls in terms of load-linked & store-conditional",
>> - "atomic-ll-sc", &AtomicExpandLoadLinked::ID,
>> - PassInfo::NormalCtor_t(callDefaultCtor<AtomicExpandLoadLinked>), false,
>> - false, PassInfo::TargetMachineCtor_t(
>> - callTargetMachineCtor<AtomicExpandLoadLinked>));
>> - Registry.registerPass(*PI, true);
>> - return PI;
>> -}
>> -
>> -void llvm::initializeAtomicExpandLoadLinkedPass(PassRegistry &Registry) {
>> - CALL_ONCE_INITIALIZATION(initializeAtomicExpandLoadLinkedPassOnce)
>> -}
>> -
>> +INITIALIZE_TM_PASS(AtomicExpandLoadLinked, "atomic-ll-sc",
>> + "Expand Atomic calls in terms of load-linked & store-conditional",
>> + false, false)
>>
>> FunctionPass *llvm::createAtomicExpandLoadLinkedPass(const TargetMachine *TM) {
>> return new AtomicExpandLoadLinked(TM);
>>
>> Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=210641&r1=210640&r2=210641&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Wed Jun 11 02:04:37 2014
>> @@ -151,19 +151,8 @@ typedef DenseMap<Instruction *, Type *>
>> }
>>
>> char CodeGenPrepare::ID = 0;
>> -static void *initializeCodeGenPreparePassOnce(PassRegistry &Registry) {
>> - initializeTargetLibraryInfoPass(Registry);
>> - PassInfo *PI = new PassInfo(
>> - "Optimize for code generation", "codegenprepare", &CodeGenPrepare::ID,
>> - PassInfo::NormalCtor_t(callDefaultCtor<CodeGenPrepare>), false, false,
>> - PassInfo::TargetMachineCtor_t(callTargetMachineCtor<CodeGenPrepare>));
>> - Registry.registerPass(*PI, true);
>> - return PI;
>> -}
>> -
>> -void llvm::initializeCodeGenPreparePass(PassRegistry &Registry) {
>> - CALL_ONCE_INITIALIZATION(initializeCodeGenPreparePassOnce)
>> -}
>> +INITIALIZE_TM_PASS(CodeGenPrepare, "codegenprepare",
>> + "Optimize for code generation", false, false)
>>
>> FunctionPass *llvm::createCodeGenPreparePass(const TargetMachine *TM) {
>> return new CodeGenPrepare(TM);
>>
>> Modified: llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp?rev=210641&r1=210640&r2=210641&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp Wed Jun 11 02:04:37 2014
>> @@ -136,19 +136,8 @@ namespace {
>> } // end anonymous namespace
>>
>> char GlobalMerge::ID = 0;
>> -
>> -static void *initializeGlobalMergePassOnce(PassRegistry &Registry) {
>> - PassInfo *PI = new PassInfo(
>> - "Merge global variables", "global-merge", &GlobalMerge::ID,
>> - PassInfo::NormalCtor_t(callDefaultCtor<GlobalMerge>), false, false,
>> - PassInfo::TargetMachineCtor_t(callTargetMachineCtor<GlobalMerge>));
>> - Registry.registerPass(*PI, true);
>> - return PI;
>> -}
>> -
>> -void llvm::initializeGlobalMergePass(PassRegistry &Registry) {
>> - CALL_ONCE_INITIALIZATION(initializeGlobalMergePassOnce)
>> -}
>> +INITIALIZE_TM_PASS(GlobalMerge, "global-merge", "Merge global variables",
>> + false, false)
>>
>> bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
>> Module &M, bool isConst, unsigned AddrSpace) const {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/d4a679da/attachment.html>
More information about the llvm-commits
mailing list