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

Reed Kotler rkotler at mips.com
Mon Apr 1 14:50:13 PDT 2013


One set of issues here is that target independent optimizations that use 
the TTI would have to all be function passes too if they are going to 
change based on the subtarget (mip32/mips16 or arm/thumb1).

On 04/01/2013 01:41 PM, reed kotler wrote:
> On 04/01/2013 12:31 PM, Chandler Carruth wrote:
>> On Thu, Mar 28, 2013 at 12:22 PM, Nadav Rotem <nrotem at apple.com
>> <mailto: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. Doing so
>> for each (sometimes tiny) function processed doesn't make a lot of
>> sense to me.
>>
>> 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.
>>
>> Alternatively, we could look at partitioning functions into two
>> modules, and then bring up the infrastructure once per module.
>>
>> I would personally choose between these based on how much shared
>> functionality there would be in the TM and TTI between the two.
> For changing subtargets, i.e. mips16 to mips32 on a per function basis,
> I only have one copy of all that is needed for both mips16 and mips32.
>
> What I do is I have two versions of the instruction selection pass
> (mips16 and mips32) and a controller pass which is used to reset parts
> of target machine when needed (ptrs to target lowering, register info,
> frame lowering which in the case of mips16 / mips32 are different
> derived classes).
>
> If the run machine function is called in the mips16 instruction
> selection pass, it returns immediately if it's in mips32 mode and
> similarly in the mips32 instruction selection pass.
>
> The one hole is this immutable pass for basic target transform info
> which should be a function pass. This can also be done so that maybe
> only at most two copies of this pass are present and the information is
> reset when the subtarget changes.
>
> I'm attaching the current state of the patch in case you want to see how
> I'm doing this now.
>
> Many things can be handled with just options to the normal setup but
> something which differs as much as mips16 and mips32 or thumb1 and arm
> need a subtarget reset.
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>





More information about the llvm-dev mailing list