[LLVMdev] Inserting dead code in IR byte code

Duncan Sands baldrick at free.fr
Mon Nov 19 00:20:09 PST 2012


Hi Teja,

> I am working on my Master's project in security and for this I need to do
> following things :
>
> 1. I have a IR bytecode of the main program. I want to insert dead code from
> other source files (e.g. cygwin files or the Linux files) in main program's IR
> byte code.

do you mean adding additional functions?  Or do you mean adding extra
instructions to existing functions?  In the first case why not use the
LLVM IR linker (llvm-link) to add in the extra bitcode?

Ciao, Duncan.

> 2. In order to insert code, I can try following two ways :
>     (i) I have observed that these IR bytecode files are just like a text file
> and they have fixed format. Using file operations, we can modify IR byte code of
> the first file by inserting the IR byte code from other files.
>     (ii) Second approach is to use LLC Tool to generate c++ code of second IR
> byte code. Then use generated c++ code and insert into the first IR byte code.
> Write the optimizer pass on first IR byte code and add the instructions from
> generated c++ code. Get the modified IR bytecode of the first program.
>
> Which approach is better and are there any other ways which I can use?






More information about the llvm-dev mailing list