[cfe-dev] struct copy

Argiris Kirtzidis akyrtzi at gmail.com
Mon Sep 22 11:58:48 PDT 2008


Chris Lattner wrote:
>
> Yes, that would be better.  llvm-gcc has logic to do this.  It is 
> somewhat tricky, because you only want to do it when the struct is 
> small, and can't always do it when you have unions.

Is it out of the question to let the backend target decide whether to do 
a block copy or not ? Couldn't there be a Pass to do that kind of 
transformation ?
To be more specific, the block copy is not appropriate for the MSIL 
target, it's better to convert the load/store to direct "load local 
variable"/"store local variable" MSIL code, instead of having a 
byte-block copy.

-Argiris

>
>> It's simpler and offers higher level information for those that want to
>> examine the bitcode.
>>
>> Isn't the job of the backend to interpret
>>    %tmp = load %struct.S* %q1
>>    store %struct.S %tmp, %struct.S* %q2
>> in an appropriate way according to target, thus not requiring the
>> frontend to explicitly encode it as low-level block-of-bytes copy ?
>
> Clang does a block copy right now because it is a) always correct and 
> b) required for the large struct copy case.  Improving this code to 
> use the same heuristics as llvm-gcc would be useful :)
>
> -Chris



More information about the cfe-dev mailing list