<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I think this needs more discussion.<div><br></div><div>I have proposed something similar back in January and we agreed it was not a good idea to expose such interface:</div><div><a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140113/201619.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140113/201619.html</a></div><div><br></div><div>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.</div><div><br></div><div>Thanks,</div><div><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-Quentin</div>
</div>
<br><div><div>On Jun 11, 2014, at 6:16 AM, Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Thanks!<br><br>On 11 June 2014 03:04, Jiangning Liu <<a href="mailto:jiangning.liu@arm.com">jiangning.liu@arm.com</a>> wrote:<br><blockquote type="cite">Author: jiangning<br>Date: Wed Jun 11 02:04:37 2014<br>New Revision: 210641<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=210641&view=rev">http://llvm.org/viewvc/llvm-project?rev=210641&view=rev</a><br>Log:<br>Create macro INITIALIZE_TM_PASS.<br><br>Pass initialization requires to initialize TargetMachine for back-end<br>specific passes. This commit creates a new macro INITIALIZE_TM_PASS to<br>simplify this kind of initialization.<br><br>Modified:<br> llvm/trunk/include/llvm/PassSupport.h<br> llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp<br> llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp<br> llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp<br><br>Modified: llvm/trunk/include/llvm/PassSupport.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=210641&r1=210640&r2=210641&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassSupport.h?rev=210641&r1=210640&r2=210641&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/PassSupport.h (original)<br>+++ llvm/trunk/include/llvm/PassSupport.h Wed Jun 11 02:04:37 2014<br>@@ -166,6 +166,18 @@ private:<br> } \<br> TsanHappensAfter(&initialized);<br><br>+#define INITIALIZE_TM_PASS(passName, arg, name, cfg, analysis) \<br>+ static void* initialize##passName##PassOnce(PassRegistry &Registry) { \<br>+ PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \<br>+ PassInfo::NormalCtor_t(callDefaultCtor< passName >), cfg, analysis, \<br>+ PassInfo::TargetMachineCtor_t(callTargetMachineCtor< passName >)); \<br>+ Registry.registerPass(*PI, true); \<br>+ return PI; \<br>+ } \<br>+ void llvm::initialize##passName##Pass(PassRegistry &Registry) { \<br>+ CALL_ONCE_INITIALIZATION(initialize##passName##PassOnce) \<br>+ }<br>+<br> #define INITIALIZE_PASS(passName, arg, name, cfg, analysis) \<br> static void* initialize##passName##PassOnce(PassRegistry &Registry) { \<br> PassInfo *PI = new PassInfo(name, arg, & passName ::ID, \<br><br>Modified: llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp?rev=210641&r1=210640&r2=210641&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp?rev=210641&r1=210640&r2=210641&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp (original)<br>+++ llvm/trunk/lib/CodeGen/AtomicExpandLoadLinkedPass.cpp Wed Jun 11 02:04:37 2014<br>@@ -50,22 +50,9 @@ namespace {<br><br> char AtomicExpandLoadLinked::ID = 0;<br> char &llvm::AtomicExpandLoadLinkedID = AtomicExpandLoadLinked::ID;<br>-<br>-static void *initializeAtomicExpandLoadLinkedPassOnce(PassRegistry &Registry) {<br>- PassInfo *PI = new PassInfo(<br>- "Expand Atomic calls in terms of load-linked & store-conditional",<br>- "atomic-ll-sc", &AtomicExpandLoadLinked::ID,<br>- PassInfo::NormalCtor_t(callDefaultCtor<AtomicExpandLoadLinked>), false,<br>- false, PassInfo::TargetMachineCtor_t(<br>- callTargetMachineCtor<AtomicExpandLoadLinked>));<br>- Registry.registerPass(*PI, true);<br>- return PI;<br>-}<br>-<br>-void llvm::initializeAtomicExpandLoadLinkedPass(PassRegistry &Registry) {<br>- CALL_ONCE_INITIALIZATION(initializeAtomicExpandLoadLinkedPassOnce)<br>-}<br>-<br>+INITIALIZE_TM_PASS(AtomicExpandLoadLinked, "atomic-ll-sc",<br>+ "Expand Atomic calls in terms of load-linked & store-conditional",<br>+ false, false)<br><br> FunctionPass *llvm::createAtomicExpandLoadLinkedPass(const TargetMachine *TM) {<br> return new AtomicExpandLoadLinked(TM);<br><br>Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=210641&r1=210640&r2=210641&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=210641&r1=210640&r2=210641&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)<br>+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Wed Jun 11 02:04:37 2014<br>@@ -151,19 +151,8 @@ typedef DenseMap<Instruction *, Type *><br> }<br><br> char CodeGenPrepare::ID = 0;<br>-static void *initializeCodeGenPreparePassOnce(PassRegistry &Registry) {<br>- initializeTargetLibraryInfoPass(Registry);<br>- PassInfo *PI = new PassInfo(<br>- "Optimize for code generation", "codegenprepare", &CodeGenPrepare::ID,<br>- PassInfo::NormalCtor_t(callDefaultCtor<CodeGenPrepare>), false, false,<br>- PassInfo::TargetMachineCtor_t(callTargetMachineCtor<CodeGenPrepare>));<br>- Registry.registerPass(*PI, true);<br>- return PI;<br>-}<br>-<br>-void llvm::initializeCodeGenPreparePass(PassRegistry &Registry) {<br>- CALL_ONCE_INITIALIZATION(initializeCodeGenPreparePassOnce)<br>-}<br>+INITIALIZE_TM_PASS(CodeGenPrepare, "codegenprepare",<br>+ "Optimize for code generation", false, false)<br><br> FunctionPass *llvm::createCodeGenPreparePass(const TargetMachine *TM) {<br> return new CodeGenPrepare(TM);<br><br>Modified: llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp?rev=210641&r1=210640&r2=210641&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp?rev=210641&r1=210640&r2=210641&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp (original)<br>+++ llvm/trunk/lib/Transforms/Scalar/GlobalMerge.cpp Wed Jun 11 02:04:37 2014<br>@@ -136,19 +136,8 @@ namespace {<br> } // end anonymous namespace<br><br> char GlobalMerge::ID = 0;<br>-<br>-static void *initializeGlobalMergePassOnce(PassRegistry &Registry) {<br>- PassInfo *PI = new PassInfo(<br>- "Merge global variables", "global-merge", &GlobalMerge::ID,<br>- PassInfo::NormalCtor_t(callDefaultCtor<GlobalMerge>), false, false,<br>- PassInfo::TargetMachineCtor_t(callTargetMachineCtor<GlobalMerge>));<br>- Registry.registerPass(*PI, true);<br>- return PI;<br>-}<br>-<br>-void llvm::initializeGlobalMergePass(PassRegistry &Registry) {<br>- CALL_ONCE_INITIALIZATION(initializeGlobalMergePassOnce)<br>-}<br>+INITIALIZE_TM_PASS(GlobalMerge, "global-merge", "Merge global variables",<br>+ false, false)<br><br> bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,<br> Module &M, bool isConst, unsigned AddrSpace) const {<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></div></body></html>