similar to: [LLVMdev] How to assign a constant to a register?

Displaying 20 results from an estimated 5000 matches similar to: "[LLVMdev] How to assign a constant to a register?"

2010 Oct 18
0
[LLVMdev] How to assign a constant to a register?
Hi, > Other than: > %x = add i32 5,0 ; suppose I want to assign 5 to %x > > is there any other way? Something like x86's mov instruction let me say that in general doing this is pointless. Due to SSA form, if %x is set to 5 you can't set it to something else later. Thus everywhere that you use %x you might as well just directly use 5 there instead. A common situation is
2010 Oct 18
4
[LLVMdev] How to assign a constant to a register?
> let me say that in general doing this is pointless. Due to SSA form, > if %x is > set to 5 you can't set it to something else later. Thus everywhere > that you > use %x you might as well just directly use 5 there instead. But the cost of doing that might be greater than the costs of keeping it in a register. Suppose the code was ORing a value with 5 and the target only had
2010 Oct 21
0
[LLVMdev] Re : How to assign a constant to a register?
> If x is a local variable, it will be stored on the stack. So you need an > alloca for it: Aha, I remember this in Kaleidoscope tutorial. So, after the alloca %x can be modified freely (e.g. without adding suffix)? -- View this message in context: http://old.nabble.com/How-to-assign-a-constant-to-a-register--tp29987387p30016496.html Sent from the LLVM - Dev mailing list archive at
2010 Oct 20
3
[LLVMdev] Re : How to assign a constant to a register?
Hi, If x is a local variable, it will be stored on the stack. So you need an alloca for it: %x = alloca i8 ; <i8*> Then you can just perform a store: Store i8* %x, i8 0 Cheers, James > -----Original Message----- > From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of leledumbo > Sent: 20 October 2010 14:39 > To: llvmdev at
2010 Oct 20
3
[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.
2010 Oct 19
0
[LLVMdev] How to assign a constant to a register?
> let me say that in general doing this is pointless. Due to SSA form, if %x is > set to 5 you can't set it to something else later. Thus everywhere that > you > use %x you might as well just directly use 5 there instead. My bad... I should've started thinking in SSA way all the time. I got it mixed with common assembly language. So I must hold the initial value until the
2010 Oct 18
3
[LLVMdev] How to assign a constant to a register?
hi, Well, there is no "Register" at the level of LLVM IR, %x = add i32 %y, %z means you define a value "x" by adding value "y" and value "z" together. best regards ether
2010 Oct 19
0
[LLVMdev] How to assign a constant to a register?
> But if the usage was in a loop it would be better (at the cost of > register pressure) to materialise 5 into a register outside of the > loop and use the register repeatedly in the loop. Bouncing on this subject: you can not know before isel is over if the constants have to materialize into registers or not, as this is really dependent on the target's instruction set. Do we have
2010 Oct 19
1
[LLVMdev] How to assign a constant to a register?
On Tue, Oct 19, 2010 at 12:19 AM, Arnaud Allard de Grandmaison <Arnaud.AllardDeGrandMaison at dibcom.com> wrote: >> But if the usage was in a loop it would be better (at the cost of >> register pressure) to materialise 5 into a register outside of the >> loop and use the register repeatedly in the loop. > > Bouncing on this subject: you can not know before isel is
2010 Oct 19
2
[LLVMdev] How to assign a constant to a register?
On Oct 18, 2010, at 9:22 PM, leledumbo wrote: > >> let me say that in general doing this is pointless. Due to SSA form, if %x > is >> set to 5 you can't set it to something else later. Thus everywhere that >> you >> use %x you might as well just directly use 5 there instead. > > My bad... I should've started thinking in SSA way all the time. I got
2010 Oct 20
2
[LLVMdev] How to assign a constant to a register?
On Oct 20, 2010, at 12:52 AM, leledumbo wrote: >> >> No, you could throw it into a global if you know you're going to want to > use 5 at some point in the future randomly. > > OK, I guess that's the way I should treat it. Load from global to register, > do operations, store it back. I suppose, it'd be no different than doing this in a C file: static const
2010 Oct 20
1
[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 =
2010 Oct 18
0
[LLVMdev] How to assign a constant to a register?
Hi Alasdair, > But the cost of doing that might be greater than the costs > of keeping it in a register. Suppose the code was ORing a value > with 5 and the target only had OR-register and not OR-immediate. > You would expect local code generation to handle OR-immediate by > locally materialising the constant into a spare register. > But if the usage was in a loop it would be
2010 Sep 27
2
[LLVMdev] Bls: Compiling LLVM 2.7 with MinGW GCC 4.5.0
> Make sure you're using the correct perl - that one which comes with msys DTK I'm using msys perl for msys 1.0.11. Maybe I should revert back to msys 1.0.10? ________________________________ Dari: Anton Korobeynikov <anton at korobeynikov.info> Kepada: leledumbo <leledumbo_cool at yahoo.co.id> Cc: llvmdev at cs.uiuc.edu Terkirim: Sen, 27 September, 2010 13:45:47 Judul:
2010 Sep 29
2
[LLVMdev] Bls: Compiling LLVM 2.7 with MinGW GCC 4.5.0
Good morning. I don't understand relation between output.log and error.log. It seems all LLVM libraries are not found on linking opt.exe. Please show us logs with command lines with make VERBOSE=1 It would be better only then to touch a few files. (eg. lib/Transforms/Scalar/GVN.cpp) The warning of --export-dynamic might be harmless, and you may add the option --enable-auto-import IIRC
2010 Oct 20
0
[LLVMdev] How to assign a constant to a register?
> No, you could throw it into a global if you know you're going to want to use 5 at some point in the future randomly. OK, I guess that's the way I should treat it. Load from global to register, do operations, store it back. -- View this message in context: http://old.nabble.com/How-to-assign-a-constant-to-a-register--tp29987387p30007489.html Sent from the LLVM - Dev mailing list
2010 Oct 20
0
[LLVMdev] How to assign a constant to a register?
> 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. -- View this message in context: http://old.nabble.com/How-to-assign-a-constant-to-a-register--tp29987387p30008156.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
2010 Oct 20
0
[LLVMdev] Re : How to assign a constant to a register?
> 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
2010 Sep 27
2
[LLVMdev] Compiling LLVM 2.7 with MinGW GCC 4.5.0
> Could you post the errors message? Sounds like bug in mingw's gcc / ld. It's very long, maybe I should just attach the log? I only remember the first line saying: --export-dynamic is not supported for PE targets, do you mean --export-all-symbols? *or something similar to this* then a bunch of undefined references occur. -- View this message in context:
2010 Sep 27
0
[LLVMdev] Compiling LLVM 2.7 with MinGW GCC 4.5.0
> first line saying: --export-dynamic is not supported for PE targets, do you > mean --export-all-symbols? *or something similar to this* then a bunch of > undefined references occur. Make sure you're using the correct perl - that one which comes with msys DTK -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University