Anton Korobeynikov
2007-Aug-20 08:35 UTC
[LLVMdev] Problem with missing support for non-zero contant initializers.
Hello, Tomas.> So far I have only been using LLVM at the user level. And I'm not sure > how this problem should be solved. It would be really nice if there > was a way to specify something like: > ******************************************************************* > @_D9arrayinit5tableG32f = global [32 x float] [ 32 x float 0x7FF8000000000000 ] > *******************************************************************Are there any notion of static construction in D? If yes, you can just emit code to init array in runtime before main() is called (for example, llvm-gcc currently does so). -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University.
Tomas Lindquist Olsen
2007-Aug-20 09:32 UTC
[LLVMdev] Problem with missing support for non-zero contant initializers.
On 8/20/07, Anton Korobeynikov <asl at math.spbu.ru> wrote:> Hello, Tomas. > > > So far I have only been using LLVM at the user level. And I'm not sure > > how this problem should be solved. It would be really nice if there > > was a way to specify something like: > > ******************************************************************* > > @_D9arrayinit5tableG32f = global [32 x float] [ 32 x float 0x7FF8000000000000 ] > > ******************************************************************* > Are there any notion of static construction in D? If yes, you can just > emit code to init array in runtime before main() is called (for example, > llvm-gcc currently does so). >Hi Anton. D does have static constructors. I just hoped I could avoid it, as something like what I proposed above would be much cleaner in my code. Also the execution times for these arrays seem to be quite out of hand. Should generating native assembly for a 32k element (truely) static float lookup table really take 40seconds? It does seem like I will have to go for the runtime approach though, as I don't have time to figure out how to add this functionality to LLVM right now. I'm doing this in my spare time, so I'd much rather work on getting the language working correctly instead. Thanx for the reply. Regards, Tomas
Holger Schurig
2007-Aug-20 10:56 UTC
[LLVMdev] Problem with missing support for non-zero contant initializers.
> D does have static constructors. I just hoped I could avoid > it, as something like what I proposed above would be much > cleaner in my code.First: a 'D' frontend to LLVM would be *AWESOME* ! :-) I think you should consider doing both. If the 'D' source code just makes float[4] table; when your LLVM should be @_D9arrayinit5tableG32f = global [4 x float] [ float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000, float 0x7FF8000000000000 ] ; <[4 x float]*> [#uses=0] because this is usually the fastest. And then you'll find out at which "n" a construction code would be faster. Finally, if you're still bored, you can group all similar array types together and then initialize them in one go: float[4] table1; int num; float[3] table2; could then be re-arranged (it's not in a struct, so easy:) int num; float[4] table1; float[3] table2; and your construction code could then initialize 7 elements at table1.
Seemingly Similar Threads
- [LLVMdev] Problem with missing support for non-zero contant initializers.
- [LLVMdev] Problem with missing support for non-zero contant initializers.
- [LLVMdev] Problem with missing support for non-zero contant initializers.
- [LLVMdev] Problem with missing support for non-zero contant initializers.
- [LLVMdev] Problem with missing support for non-zero contant initializers.