David Majnemer
2013-Sep-16 01:40 UTC
[LLVMdev] Ambiguity in LLVM IR for global variable sections
What do we expect from the following IR? @i2 = constant i32 30, section "INITDATA", align 4 @i1 = global i32 0, section "INITDATA", align 4 Currently, we stick them in one section that isn't writable which is problematic because @i1 is writable. If you flip @i1 and @i2 you get one section which is writable. It seems like we should do one of the following: 1. Two sections, one writable + one that isn't 2. One section that is writable 3. Give an error Personally, I like #1 or #2. -- David Majnemer -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130915/29eb8d45/attachment.html>
David Majnemer
2013-Sep-16 11:13 UTC
[LLVMdev] Ambiguity in LLVM IR for global variable sections
Seems like #2 won't work for this case: @l = thread_local global i32 0, section "bar", align 4 @k = global i32 0, section "bar", align 4 On Sun, Sep 15, 2013 at 6:40 PM, David Majnemer <david.majnemer at gmail.com>wrote:> What do we expect from the following IR? > > @i2 = constant i32 30, section "INITDATA", align 4 > @i1 = global i32 0, section "INITDATA", align 4 > > Currently, we stick them in one section that isn't writable which is > problematic because @i1 is writable. If you flip @i1 and @i2 you get one > section which is writable. > > It seems like we should do one of the following: > 1. Two sections, one writable + one that isn't > 2. One section that is writable > 3. Give an error > > Personally, I like #1 or #2. > > -- > David Majnemer >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130916/cf78c3bd/attachment.html>
Rafael EspĂndola
2013-Oct-07 14:45 UTC
[LLVMdev] Ambiguity in LLVM IR for global variable sections
On 15 September 2013 21:40, David Majnemer <david.majnemer at gmail.com> wrote:> What do we expect from the following IR? > > @i2 = constant i32 30, section "INITDATA", align 4 > @i1 = global i32 0, section "INITDATA", align 4 > > Currently, we stick them in one section that isn't writable which is > problematic because @i1 is writable. If you flip @i1 and @i2 you get one > section which is writable. > > It seems like we should do one of the following: > 1. Two sections, one writable + one that isn't > 2. One section that is writable > 3. Give an error > > Personally, I like #1 or #2.Why not #3? It the frontend wants a constant section it can print @i1 differently. It if wants a writable section it can print @i2 differently. Cheers, Rafael
David Majnemer
2013-Oct-11 05:53 UTC
[LLVMdev] Ambiguity in LLVM IR for global variable sections
I've come around and believe #3 is the right answer. Better yet, we should give a way to specify the section attributes somewhere explicitly and only infer them as a fallback. On Mon, Oct 7, 2013 at 7:45 AM, Rafael EspĂndola <rafael.espindola at gmail.com> wrote:> On 15 September 2013 21:40, David Majnemer <david.majnemer at gmail.com> > wrote: > > What do we expect from the following IR? > > > > @i2 = constant i32 30, section "INITDATA", align 4 > > @i1 = global i32 0, section "INITDATA", align 4 > > > > Currently, we stick them in one section that isn't writable which is > > problematic because @i1 is writable. If you flip @i1 and @i2 you get one > > section which is writable. > > > > It seems like we should do one of the following: > > 1. Two sections, one writable + one that isn't > > 2. One section that is writable > > 3. Give an error > > > > Personally, I like #1 or #2. > > Why not #3? It the frontend wants a constant section it can print @i1 > differently. It if wants a writable section it can print @i2 > differently. > > Cheers, > Rafael >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131010/333fa728/attachment.html>