[LLVMdev] Inserting dead code in IR byte code

teja tamboli tamboli.teja at gmail.com
Mon Nov 19 09:44:29 PST 2012

Hi Duncan,

I mean both. In order to generate random code, I have to add function
definitions and also for robustness I have to call these functions from
already existing functions. So, have to add calling type of instructions
also in the existing function.
In future I also have to change instructions for simple substitution meaning

'add a, b' can be done using  'sub a, 0' and followed by 'add a, b' or
something like that. So, have to modify / add instructions in the existing

I am not much aware of LLVM IR Linker (llvm-ld). I know that it takes
multiple bitcode files and then link them together to generate one bitcode
file. Is it possible to add functions and instructions using this tool ?


On Mon, Nov 19, 2012 at 12:20 AM, Duncan Sands <baldrick at free.fr> wrote:

> 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?
> ______________________________**_________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121119/547c24b4/attachment.html>

More information about the llvm-dev mailing list