[cfe-dev] preventing bitcast in generated code

Chris Lattner clattner at apple.com
Mon May 10 10:59:03 PDT 2010


On May 10, 2010, at 10:30 AM, Jochen Wilhelmy wrote:

> Hi!
> 
> I compile a subset of c++ to llvm IR that is then executed by a
> kind of virtual machine that is not capable of executing all instructions.
> For example if I have a struct with two floats and copy it form
> one location to another clang uses a bitcast to i64 to copy it
> (x86 target).

You will never be capable of eliminating all bitcasts, but...

> Can I implement an own TargetInfo to prevent this?

Yes, in this case it sounds like it is being generated from the X86-specific ABI handling code.  Implementing your own TargetInfo for ABI lowering will allow you to avoid this specific bitcast.

-Chris





More information about the cfe-dev mailing list