[LLVMdev] Loop IR insertion

Misha Brukman brukman at uiuc.edu
Wed Jan 12 21:42:15 PST 2005


On Tue, Jan 11, 2005 at 11:56:41PM +0800, Qiuyu Zhang wrote:
> I am trying to insert a Loop IR into the existed bytecode file. 
> 
> insertion part by C code,
> 
> char *p[n]; // pointer array for storing the address of strings
> int i;
> for(i=0;i<n;i++){
> (p[i])[2] = (p[i])[2] ^ 0x27;
> }
> 
> 2. from instructions.h, there are some instructions class, but could I
> insert Xor instruction? 

See llvm/include/llvm/InstrTypes.h and Instruction.def, which together
provide BinaryOperator::createXor() .

> or could I insert all IR instruction as I want? if so, would you like
> to give me some hints or examples.

I'm not sure what you're asking here, but if you are wondering how to
express the C code in LLVM, consider using llvm-gcc to compile it
without optimizations (-Wa,-disable-opt -Wl,-disable-opt) and see what
it produces.

-- 
Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu




More information about the llvm-dev mailing list