<div dir="ltr"><br><br><div class="gmail_quote">On Thu, Mar 5, 2015 at 9:02 AM <<a href="mailto:aschwaighofer@apple.com">aschwaighofer@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 03/05/15, Hal Finkel   wrote:<br>
> Okay, unfortunately, this specifically does not work for me. I need to control the triple used for compilation in cross-compiling environments, and whether or not calls to some particular library might be generated does not belong there.<br>
><br>
> Currently, TLI is constructed by the frontend like this (to copy from Clang):<br>
><br>
>  // Figure out TargetLibraryInfo.<br>
>  Triple TargetTriple(TheModule-><u></u>getTargetTriple());<br>
>  PMBuilder.LibraryInfo = createTLI(TargetTriple, CodeGenOpts);<br>
><br>
> and this information needs to be passed in from the frontend (so that it can be easily controlled using frontend command-line flags). We should define some enum with the different library types being targeted, and probably stick that into CodeGenOpts, and use it in TLI as appropriate. The backend might also generate calls into such a library, so CodeGenOpts is really the right place for this.<br>
<br>
Works for me.<br>
<br>
<br>
I viewed using the environment as a stringly typed version of what you suggest until we have some real users of this. I must admit I have not researched deeply into whether the frontend could have set the triple in TheModule->getTargetTriple() from " "x86-apple-darwin” to "x86-apple-darwin-accelerate".<br>
<br></blockquote><div><br></div><div>FWIW you can do this, but ... let's not :)</div><div><br></div><div>CodeGenOpts is how you pass this sort of stuff down. </div><div><br></div><div>Thanks!</div><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
That said this would have been a hack in the frontend and using a enum or alternatively just setting the set of functions in the frontend is cleaner.<br>
<br>
</blockquote></div></div>