[LLVMdev] proposed change to class BasicTTI and dual mode mips16/32 working

Nadav Rotem nrotem at apple.com
Mon Apr 1 12:58:19 PDT 2013

> On Thu, Mar 28, 2013 at 12:22 PM, Nadav Rotem <nrotem at apple.com> wrote:
> IMHO the right way to handle target function attributes is to re-initialize the target machine and TTI for every function (if the attributes changed).  Do you have another solution in mind ?
> I don't really understand this.
> TargetMachine and TTI may be quite expensive to initialize.

Yes. But we can keep a few TMs around and only initialize TTI, which should be inexpensive to initialize because it has no state. 

> Doing so for each (sometimes tiny) function processed doesn't make a lot of sense to me.

I assume that even for LTO builds, the target attributes won't change very often. 

> Wouldn't it be better to design a TargetMachine (and TTI, or other passes that are similar) which provides context-sensitive answers? You could imagine this being a wrapper which delegates to one of two real TM and TTI implementations based on a mode switch.

This can work, but I don't have enough information about two things: 
1. How often do we switch TMs.  (and how expensive it is)
2. How complex is it to create a wrapper and what overhead is the wrapper going to add. 

Do you have a design in mind for such a wrapper ?

> Alternatively, we could look at partitioning functions into two modules, and then bring up the infrastructure once per module.

I am not sure if this can work. I see a scenario where a non-AVX function can call an AVX functions. Splitting these into two modules can potentially prevent some optimizations. 

> I would personally choose between these based on how much shared functionality there would be in the TM and TTI between the two.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130401/be331513/attachment.html>

More information about the llvm-dev mailing list