[LLVMdev] Re:RE: Question about inserting instructions

Chris Lattner sabre at nondot.org
Wed May 11 13:45:16 PDT 2005


On Wed, 11 May 2005, Misha Brukman wrote:
>> during step 2, we read *.bc code and find dummy BB and put some
>> meaningless machinecode, here, we cannot put some illegal machince
>> code, otherwise, step 3 goes to fail.
>
> Yes, you are correct -- if you want to create illegal code you need to
> not use system as.  What you need is the ability for llc to create
> object files with native code directly, without using the system
> assembler.  I think someone is working on it, but I'm not sure as to the
> status.  Otherwise, you will just have some random one-byte
> instructions.

Actually that's not true.  You can make instructions with an asmstring of:

   ".byte 123\n .byte 56\n .byte 86" and those bytes will get emitted to 
the code stream.

-Chris

>> if so, how could we chang llc?  I take a look at MachineInstr.c
>> CodeGenerator.c etc, but I still don't know how to do it.
>
> The CodeEmitter would have to be enhanced to allow outputting standard
> format object files that ld can process.  If you are interested in doing
> this, someone can point you in the right direction as to what needs to
> be done.
>
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list