On 20/10/10 11:37, leledumbo wrote:> >> Why not just use ConstantInt::get() when you want the number 5? > > Because I'm not using LLVM libraries, I'm generating LLVM assembly myself.In that case, why not output '5' when you want 5? Ciao, Duncan.
> In that case, why not output '5' when you want 5?Like I said before, I'm used to common assembly language like x86. Usually I assign an initial value to a register, then manipulate it. -- View this message in context: http://old.nabble.com/How-to-assign-a-constant-to-a-register--tp29987387p30008689.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Matthieu Wipliez
2010-Oct-20 11:31 UTC
[LLVMdev] Re : How to assign a constant to a register?
leledumbo, from what you say, I assume you have some kind of representation (AST or a lower-level intermediate representation) from which you generate LLVM assembly. Is this representation in SSA form? If it is, you might want to do a "copy propagation" transformation that replaces the uses of all variables that are assigned a constant value by their definitions. Example: x = 5 y = x + 1 z = x * y becomes y = 5 + 1 z = 5 * y Cheers Matthieu ----- Message d'origine ----> De : Duncan Sands <baldrick at free.fr> > À : llvmdev at cs.uiuc.edu > Envoyé le : Mer 20 octobre 2010, 11h 59min 32s > Objet : Re: [LLVMdev] How to assign a constant to a register? > > On 20/10/10 11:37, leledumbo wrote: > > > >> Why not just use ConstantInt::get() when you want the number 5? > > > > Because I'm not using LLVM libraries, I'm generating LLVM assembly myself. > > In that case, why not output '5' when you want 5? > > Ciao, > > Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
> from what you say, I assume you have some kind of representation (AST or a > lower-level intermediate representation) from which you generate LLVM > assembly. > Is this representation in SSA form?Yes, the representation is an AST. It's not in SSA yet, as it's a direct representation of the input. I'm confused for this node: : / \ x 0 where x is a local variable.> If it is, you might want to do a "copy propagation" transformation that > replaces > the uses of all variables that are assigned a constant value by their > definitions.I'll consider it, it would useful for constant expression. -- View this message in context: http://old.nabble.com/How-to-assign-a-constant-to-a-register--tp29987387p30009972.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Reasonably Related Threads
- [LLVMdev] Re : How to assign a constant to a register?
- [LLVMdev] Re : How to assign a constant to a register?
- [LLVMdev] How to assign a constant to a register?
- [LLVMdev] Re : How to assign a constant to a register?
- [LLVMdev] How to assign a constant to a register?