[LLVMdev] customized output of double load/store on ppc32

Scott Graham scott.llvm at h4ck3r.net
Sat Jul 26 20:30:06 PDT 2008


> You can't do FFI with incompatible ABIs in the general case without
> copying the data into structures appropriate for the target.  Structs
> are laid out differently on different architectures, and sometimes the
> incompatibility is non-obvious.  But I'll assume you're doing some
> simple case, like the arguments being only scalars and pointers.
>
> Back to your issue, the simplest workaround for particular issue of
> splitting stores is to mark all your stores volatile; that will force
> the store to be done in a single instruction (the price is that it
> will reduce the effectiveness of some optimizations, but it shouldn't
> have a huge impact if you restrict it to the arrays you're going to
> pass via FFI).  If you prefer to hack your version of LLVM, you could
> alternatively disable the relevant optimization... it's probably in
> DAGCombine or PPCISelLowering, although I haven't checked.

Hi

Thanks for your help. After putzing around in DAGCombine and the PPC
lowering code for a while, I decided it wasn't going to work too well.

For anyone interested, I ended up creating an additional PPC cpu
target that's little-endian. This doesn't seem to require many
changes, just little tweaks in the PPC code which (reasonably) assumes
its memory is big-endian (fctiwz, for example).

Of course, the compilation speed halves because I need to compile
twice (yes, ignoring VAX-endian!) and the size of the "bytecode"
doubles because I need to include 2x the code/data as I don't know
what target the bytecode will be run on. Not optimal, but workable in
my situation for now.

thanks,
scott



More information about the llvm-dev mailing list