ABI rewite limitation?

Kai Nacke kai.nacke at redstar.de
Tue May 14 20:30:08 PDT 2013


Hi!

I try to create a workaround for LLVM bug 14779. On PPC64 an 
anonymous structure
used as a parameter is not handled correctly. LDC passes arrays 
as type { i64, i8* } and is directly affected by this bug.

My idea is to create a distinct type %ppc_pr14779_arraytype = 
type { i64, i8* } and use the ABI rewrite facility to substitute 
the type.

However I faced some challenges:

- ABIRewrite knows nothing about ref parameter
   The interface methods take the D type and D/LLVM values. More 
specialized informations like attributes of a parameter or the 
byref flag are missing.
   I worked around this by using 2 instances of my rewrite class: 
one for value parameters and one for ref parameters.

- ABIRewrite.get()/.getL() is not called for ref parameters
   DtoDefineFunction simply excludes this case ( if (!refout...) )
   I solved this by adding another else to the if condition.

Is this by design or just a deficiency of the interface?
My solution seems to work fine but I need to do more checking.

BTW: The x86_64 ABI rewrite only rewrites structures passed by 
value, therefore there is no need to handle ref parameters.

Regards
Kai


More information about the digitalmars-d-ldc mailing list