[LLVMdev] llvm-gcc

Nabila ABDESSAIED nabila.abdessaied at gmail.com
Tue Apr 19 14:06:04 PDT 2011


hi all please could u help me in these points

1- I have installed llvm-gcc 4.2 and llvm 2.8 with the synaptic
package manager(ubuntu 10.10)
every time i do this commande:
llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc
it shows to me i should install llvm-gcc4.5
when i have installed llvm-gcc 4.5 i get all the times a wrong bc file
as output, because when i try to execute it with lli it says to me
invalid signature.
2 -
for (Module::iterator a=M.begin(),b=M.end();a!=b;++a) {	
for (Function::iterator i = a->begin(), e = a->end(); i != e; ++i){
 new StoreInst(const_int32_12, gvar_int32_x, false, label_entry);
// normally label entry would be the end of the basic bloc i
}
}
what would be the value of label entry to make the instruction
inserted at the end of the basic bloc
when i have tried this:
Instruction* label_entry = i->begin();
new StoreInst(const_int32_12, gvar_int32_x, false, label_entry);
it works but the instruction is inserted at the begining of the basic bloc
and when i tried this
Instruction* label_entry = i->end();
new StoreInst(const_int32_12, gvar_int32_x, false, label_entry);
it gives me this as error :Basic Block in function 'main' does not
have terminator!

3-i have added to my IR code a global variable (integer) ,
GlobalVariable* gvar_int32_x = new GlobalVariable(/*Module=*/M,
  /*Type=*/IntegerType::get(M.getContext(), 32),
  /*isConstant=*/false,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Initializer=*/0, // has initializer, specified below
  /*Name=*/"x");
 i would like to add the value of  the size od a basic bloc to this
global variable
how to convert the size of a basic bloc to integer?



More information about the llvm-dev mailing list