Hi all, Tuning my TargetAsmPrinter implementation in the back-end side, I discovered that the address space number is not passed down while emitting global variables with constant initializers. The information is dropped at AsmPrinter::EmitGlobalConstant() function call which defaults it to zero. I would like to emit target-dependent asm directives depending on the address space of constant initializers. Is there another method to implement this feature ? The main reason is that we have 2 distinct memories and we are currently using address_space attribute from clang to initialize them. Thanks in advance, Ivan
On Mon, May 07, 2012 at 02:15:16PM +0200, Ivan Llopard wrote:> I would like to emit target-dependent asm directives depending on the > address space of constant initializers. Is there another method to > implement this feature ?I'm not sure I understand what your problem is. Can you provide an example of what you see and what you expect, please? Joerg
Thanks for your quick response Joerg. We have a very small test case where there is global array and its address space attribute specified like in the following code const int __attribute__((address_space(256))) fangle[13] {2341, 4681, 7022, 9362, 11703, 1403,16384, 18725, 21065, 23406, 25746, 28087, 30427}; I need to put its initializer in another memory because it has a different address space and I wanted to pass this information through a target-depend asm directive. At the moment, I've overridden EmitGlobalVariable() from AsmPrinter because I didn't see any other spot to put this special directive. Ivan Le 07/05/2012 14:35, Joerg Sonnenberger a écrit :> On Mon, May 07, 2012 at 02:15:16PM +0200, Ivan Llopard wrote: >> I would like to emit target-dependent asm directives depending on the >> address space of constant initializers. Is there another method to >> implement this feature ? > I'm not sure I understand what your problem is. Can you provide an > example of what you see and what you expect, please? > > Joerg > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Mon, May 7, 2012 at 5:15 AM, Ivan Llopard <ivanllopard at gmail.com> wrote:> Hi all, > > Tuning my TargetAsmPrinter implementation in the back-end side, I > discovered that the address space number is not passed down while > emitting global variables with constant initializers. The information is > dropped at AsmPrinter::EmitGlobalConstant() function call which defaults > it to zero.This sounds like a bug. -Eli
Hi Eli, On 07/05/2012 18:15, Eli Friedman wrote:> On Mon, May 7, 2012 at 5:15 AM, Ivan Llopard<ivanllopard at gmail.com> wrote: >> Hi all, >> >> Tuning my TargetAsmPrinter implementation in the back-end side, I >> discovered that the address space number is not passed down while >> emitting global variables with constant initializers. The information is >> dropped at AsmPrinter::EmitGlobalConstant() function call which defaults >> it to zero. > > This sounds like a bug.The feature added to allow targets emit custom data directives based on the address space seems to be broken. However, it doesn't produce any odd behavior because it's not used. The attached patch is quite small and shows where the address space information is getting lost and it will correctly propagate it. It also avoids existent back-ends to break because of an unimplemented hook in MCAsmInfo. Ivan> > -Eli-------------- next part -------------- A non-text attachment was scrubbed... Name: addrspace-asmprinter.patch Type: text/x-patch Size: 2018 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120508/e0712e29/attachment.bin>