[LLVMdev] get the identifies of the unnamed temporaries from the instruction of LLVM IR

Duncan Sands baldrick at free.fr
Tue Apr 9 01:47:36 PDT 2013


Hi,

On 09/04/13 10:16, Dong Chen wrote:
> hello guys:
> I am in trouble with get the identifies of the unnamed temporaries from the
> instruction of LLVM IR.

this is a FAQ.  Most names in the IR are just there to make it easier to read
and can safely be removed.  You can't rely on instructions having names, and as
you saw often they do not have a name.  Even if they start off with a name, the
optimizers may change the name, eg when inlining.

> for example:
> instruction: %4 = mul nsw i32 %1, %width
> unnamed temporaries: %4, %1

These are not temporaries, they are values without a name.  The numbers %4 and
%1 only exist in the human readable IR (.ll file), as without them it wouldn't
be possible to convert the human readable IR back into bitcode.  You can't get
hold of them from the API since they don't exist.

> how to get them?
> I have tried several iterators(op_iterator,value_op_iterator) and
> getOperand(int) function,but none of them works.
> does anyone know how to get it? thanks very much

Why do you want them?  Maybe you are really looking for debug info?

Ciao, Duncan.

>
>
>
> --
> View this message in context: http://llvm.1065342.n5.nabble.com/get-the-identifies-of-the-unnamed-temporaries-from-the-instruction-of-LLVM-IR-tp56572.html
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list