Actually i have to implement strength reduction, for that i have to first detect induction variables using ALLEN-COCKE-KENNEDY algorithm. To find out induction variables, i need the name of the instruction. Thanks for the reply. Devang Patel-2 wrote:> > On Fri, Mar 26, 2010 at 6:53 AM, help__me_please > <krishnadhan at cse.iitb.ac.in> wrote: >> >> Can anyone tell how to get the result name or instruction name of all >> instruction? For example if the instruction is "x=add y,z", here i need >> "x". >> Using getName(), i am getting some instructions result name, but llvm >> produces some instruction like "%0=add i32 tmp, 1", here getName() shows >> empty string as result name. >> So please help. >> > > Instruction names are optional and not reliable. Why do you need a > name ? You can use use_iterator to find instruction's uses. > - > Devang > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- View this message in context: http://old.nabble.com/Operand%2C-instruction-tp21961718p28064581.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Hi,> Actually i have to implement strength reduction, for that i have to first > detect induction variables using ALLEN-COCKE-KENNEDY algorithm. To find out > induction variables, i need the name of the instruction.I suspect you are confused. Surely you only need a way of referring to each instruction. For this you can use a pointer to the instruction. Ciao, Duncan.
Can you tell how to use vector globally? I mean, i am able to add entries to a vector in a basicblock, but whenever a basicblock function call is returned, the vector becomes empty. So how to use data structures globally? And one thing, where is main ( or same kind of) function in llvm? Thanks for you reply. Duncan Sands wrote:> > Hi, > >> Actually i have to implement strength reduction, for that i have to first >> detect induction variables using ALLEN-COCKE-KENNEDY algorithm. To find >> out >> induction variables, i need the name of the instruction. > > I suspect you are confused. Surely you only need a way of referring to > each > instruction. For this you can use a pointer to the instruction. > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- View this message in context: http://old.nabble.com/Operand%2C-instruction-tp21961718p28087559.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Can you please give an example of creating an instruction (for example add instructions with two operand a and b)? I am trying instruction() for a while, but no success yet. Duncan Sands wrote:> > Hi, > >> Actually i have to implement strength reduction, for that i have to first >> detect induction variables using ALLEN-COCKE-KENNEDY algorithm. To find >> out >> induction variables, i need the name of the instruction. > > I suspect you are confused. Surely you only need a way of referring to > each > instruction. For this you can use a pointer to the instruction. > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- View this message in context: http://old.nabble.com/Operand%2C-instruction-tp21961718p28235150.html Sent from the LLVM - Dev mailing list archive at Nabble.com.