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?
> 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.There is no llvm-gcc 4.5. Report this bug to Ubuntu, because it seems they hacked the stuff somehow.> 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?Size = number of LLVM IR instructions there? If yes, just grab the number, convert it to ConstantIn and use as an initializer / store to variable. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
On 4/19/11 4:37 PM, Anton Korobeynikov wrote:>> 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. > There is no llvm-gcc 4.5. Report this bug to Ubuntu, because it seems > they hacked the stuff somehow. > >> 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? > Size = number of LLVM IR instructions there? If yes, just grab the > number, convert it to ConstantIn and use as an initializer / store to > variable. >There's a typo in the above sentence. ConstantIn should be ConstantInt. :) -- John T.
Hi Nabila,> 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.llvm-gcc4.5 is a wrapper script that makes use of the dragonegg plugin for gcc-4.5. As far as I know the script does not recognize -emit-llvm; use -flto instead. Ciao, Duncan.
2011/4/25 Duncan Sands <baldrick at free.fr>> Hi Nabila, > > > 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. > > llvm-gcc4.5 is a wrapper script that makes use of the dragonegg plugin > for gcc-4.5. As far as I know the script does not recognize -emit-llvm; > use -flto instead. > > Hi,I have solved the problem by downloding the llvm-gcc 4.2 binaries at the llvm website,unzipped it and adding it to envirnment path and no no problems> Ciao, Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110425/6281bafb/attachment.html>