I have a constant parameter in a LLVM function. Is there a way to reserve a CPU register such that it also holds the value of the parameter in LLVM x86 codegen ? Thanks Xin
put "register" keyword on that variable. E.g., register int i; ... Whether it will be register allocated is totally up to the compiler, with respect to the rest of the program. Chuck On 7/19/2012 11:14 AM, Xin Tong wrote:> I have a constant parameter in a LLVM function. Is there a way to > reserve a CPU register such that it also holds the value of the > parameter in LLVM x86 codegen ? > > Thanks > > Xin > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Not really, no. On Jul 19, 2012, at 11:14 AM, Xin Tong <xerox.time.tech at gmail.com> wrote:> I have a constant parameter in a LLVM function. Is there a way to > reserve a CPU register such that it also holds the value of the > parameter in LLVM x86 codegen ? > > Thanks > > Xin > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On 7/19/12 1:23 PM, Jim Grosbach wrote:> Not really, no.If you really, really, wanted to do it, you could: 1) Hack the code generator to not use that register. It might be as simple as modifying the TableGen file to not know that the register exists. 2) Use inline asm to put the constant into that register and fetch it from that register. The real question is: what larger goal are you trying to accomplish? Holding a constant value in a register might not be the best way to do what you're doing. -- John T.> > On Jul 19, 2012, at 11:14 AM, Xin Tong <xerox.time.tech at gmail.com> wrote: > >> I have a constant parameter in a LLVM function. Is there a way to >> reserve a CPU register such that it also holds the value of the >> parameter in LLVM x86 codegen ? >> >> Thanks >> >> Xin >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> E.g., > register int i; > ... > > Whether it will be register allocated is totally up to the compiler, > with respect to the rest of the program.Yeah, e.g. clang just ignores "register" keyword :) -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Seemingly Similar Threads
- [LLVMdev] Bind a LLVM variable to a CPU register
- [LLVMdev] Bind a LLVM variable to a CPU register
- [LLVMdev] Bind a LLVM variable to a CPU register
- [LLVMdev] Bind a LLVM variable to a CPU register
- [LLVMdev] GPU thread/block/grid size contraints in LLVM PTX backend