[cfe-dev] Advice on __emit__ intrinsic

David Chisnall csdavec at swan.ac.uk
Wed Jun 1 07:35:53 PDT 2011


On 1 Jun 2011, at 14:18, Daniel Wallin wrote:

> I'm working on adding codegen support for the BCC __emit__ intrinsic:
> 
>  http://docwiki.embarcadero.com/RADStudio/en/Bcc_intrinsics
> 
> Essentially, it allows you to insert a sequence of bytes verbatim to
> the object file.
> 
>  __emit__(0xCC);
> 
> would be equivalent to:
> 
>  asm(".byte 0xCC");
> 
> The documentation doesn't seem to mention it, but it also allows you
> to emit the address of a variable:
> 
>  __emit__(&x);
> 
> Because of this I figure I need to add support for this on the llvm
> level, but I'm not sure how to go about it. If anyone has any advice I
> would appreciate it.

I'm not sure that this needs anything extra in LLVM.  The first form, as you say, is already supported by trivial inline ASM.  The second looks like it's equivalent to:

asm ("$0" : : "m"(&x))

(I think - my GNU inline asm syntax knowledge is slightly rusty)

David

-- Sent from my Apple II



More information about the cfe-dev mailing list