[PATCH] D71551: [AIX][XCOFF]Implement mergeable const
Hubert Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 23 10:38:13 PST 2019
hubert.reinterpretcast added inline comments.
================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1870
+ if (Kind.isMergeableConst()) {
+ return getContext().getXCOFFSection(".rodata.cst",
----------------
DiggerLin wrote:
> hubert.reinterpretcast wrote:
> > As @jasonliu mentioned, there is not much precedent for this in the context of AIX. What is the rationale for not using the normal read-only data section?
> I implemented the Mergeable const as gcc did.
> 1 .gcc use a separate csect for all mergeable const. gcc generate is as
> .csect _mergeableconst.ro_[RO],4
> .align 3
> cnst32:
> .long 1073741824
> .long 50
> .space 24
> .globl cnst16
> .align 3
> cnst16:
> .long 1073741824
> .long 22
> .space 8
> .globl cnst8
> .align 2
> cnst8:
> .long 1073741832
> .space 4
> .globl cnst4
> .align 1
> cnst4:
> .short 16392
> .space 2
> .csect .text[PR]
> _section_.text:
> .csect .data[RW],4
> .long _section_.text
> 2. xlc use separate csect const32, const16,const8, const4 for mergeable const32 , mergeable const16, mergeable const8. mergeable const4.
>
>
> .csect cnst32{RO}, 3
> .long 0x40000000 # "@\0\0\0"
> .long 0x00000032 # "\0\0\0002"
> .long 0x00000000 # "\0\0\0\0"
> .long 0x00000000 # "\0\0\0\0"
> .long 0x00000000 # "\0\0\0\0"
> .long 0x00000000 # "\0\0\0\0"
> .long 0x00000000 # "\0\0\0\0"
> .long 0x00000000 # "\0\0\0\0"
>
> .csect cnst16{RO}, 3
> .long 0x40000000 # "@\0\0\0"
> .long 0x00000016 # "\0\0\0\026"
> .long 0x00000000 # "\0\0\0\0"
> .long 0x00000000 # "\0\0\0\0"
>
> .csect cnst8{RO}, 3
> .long 0x40000008 # "@\0\0\b"
> .long 0x00000000 # "\0\0\0\0"
>
> .csect cnst4{RO}
> .long 0x40080000 # "@\b\0\0"
>
In the assembly you list, the naming of the labels (for the GCC case) or csects (for the XL case) is suspect (they are indicative of declared variables). Declared variables are not mergeable in the general sense.
It is observed that GCC on AIX uses `.ro` and `.rw` as suffixes for read-only sections; however, the naming does not seem to indicate "mergeable" as a factor.
================
Comment at: llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-const.ll:2
+; This file tests the codegen of mergeable const in AIX assembly.
+; This file also tests mergeable const in xcoff object file generation.
+; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s
----------------
I believe we always use all-caps for XCOFF.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71551/new/
https://reviews.llvm.org/D71551
More information about the llvm-commits
mailing list