Advice on __emit__ intrinsic

I'm working on adding codegen support for the BCC __emit__ intrinsic:

Essentially, it allows you to insert a sequence of bytes verbatim to
the object file.


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:


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)


-- Sent from my Apple II

Although that does expand to something, the result isn't something
that can be assembled:


Doing something like:

  .long -8(%rsp)

doesn't work either. I guess it needed to expand to just ".long -8".
Any more ideas? Any help would be appreciated!