[llvm] aa86311 - [AIX][XCOFF] Support Mergeable2ByteCString and Mergeable4ByteCString
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 11:46:14 PST 2020
Author: diggerlin
Date: 2020-02-10T14:45:54-05:00
New Revision: aa86311e6204778db87cdeb85ef1a177bdc52a19
URL: https://github.com/llvm/llvm-project/commit/aa86311e6204778db87cdeb85ef1a177bdc52a19
DIFF: https://github.com/llvm/llvm-project/commit/aa86311e6204778db87cdeb85ef1a177bdc52a19.diff
LOG: [AIX][XCOFF] Support Mergeable2ByteCString and Mergeable4ByteCString
SUMMARY:
The patch is enable to support Mergeable2ByteCString and Mergeable4ByteCString
Reviewers: daltenty
Subscribers: wuzish, nemanjai, hiraditya
Differential Revision: https://reviews.llvm.org/D74164
Added:
Modified:
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 25df6466e886..7f4cf086f88a 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -1866,9 +1866,6 @@ MCSection *TargetLoweringObjectFileXCOFF::SelectSectionForGlobal(
}
if (Kind.isMergeableCString()) {
- if (!Kind.isMergeable1ByteCString())
- report_fatal_error("Unhandled multi-byte mergeable string kind.");
-
unsigned Align = GO->getParent()->getDataLayout().getPreferredAlignment(
cast<GlobalVariable>(GO));
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 6b708cad07f9..2348df2801a3 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1607,8 +1607,7 @@ void PPCAIXAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
if (GV->isDeclaration())
return;
- if ((!GVKind.isGlobalWriteableData() && !GVKind.isReadOnly()) ||
- GVKind.isMergeable2ByteCString() || GVKind.isMergeable4ByteCString())
+ if (!GVKind.isGlobalWriteableData() && !GVKind.isReadOnly())
report_fatal_error("Encountered a global variable kind that is "
"not supported yet.");
diff --git a/llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll b/llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll
index 3df01a08f3d5..db622a97d068 100644
--- a/llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll
@@ -3,14 +3,16 @@
; the test in this file should be merged into aix-xcoff-data.ll with additional
; tests for XCOFF object files.
-; RUN: llc -verify-machineinstrs -mcpu=pwr7 \
+; RUN: llc -verify-machineinstrs -mcpu=pwr4 \
; RUN: -mtriple powerpc-ibm-aix-xcoff < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -mcpu=pwr7 \
+; RUN: llc -verify-machineinstrs -mcpu=pwr4 \
; RUN: -mtriple powerpc64-ibm-aix-xcoff < %s | FileCheck %s
-; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
+; RUN: llc -verify-machineinstrs -mcpu=pwr4 -mtriple powerpc-ibm-aix-xcoff -filetype=obj -o %t.o < %s
; RUN: llvm-objdump -D %t.o | FileCheck --check-prefix=CHECKOBJ %s
+ at magic16 = private unnamed_addr constant [4 x i16] [i16 264, i16 272, i16 213, i16 0], align 2
+ at magic32 = private unnamed_addr constant [4 x i32] [i32 464, i32 472, i32 413, i32 0], align 4
@strA = private unnamed_addr constant [14 x i8] c"hello world!\0A\00", align 1
@.str = private unnamed_addr constant [9 x i8] c"abcdefgh\00", align 1
@p = global i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), align 4
@@ -23,7 +25,21 @@ entry:
ret i8 %1
}
-; CHECK: .csect .rodata.str1.1[RO]
+; CHECK: .csect .rodata.str2.2[RO]
+; CHECK-NEXT: .align 1
+; CHECK-NEXT: .Lmagic16:
+; CHECK-NEXT: .short 264 # 0x108
+; CHECK-NEXT: .short 272 # 0x110
+; CHECK-NEXT: .short 213 # 0xd5
+; CHECK-NEXT: .short 0 # 0x0
+; CHECK-NEXT: .csect .rodata.str4.4[RO]
+; CHECK-NEXT: .align 2
+; CHECK-NEXT: .Lmagic32:
+; CHECK-NEXT: .long 464 # 0x1d0
+; CHECK-NEXT: .long 472 # 0x1d8
+; CHECK-NEXT: .long 413 # 0x19d
+; CHECK-NEXT: .long 0 # 0x0
+; CHECK-NEXT: .csect .rodata.str1.1[RO]
; CHECK-NEXT: .LstrA:
; CHECK-NEXT: .byte 104
; CHECK-NEXT: .byte 101
@@ -50,13 +66,21 @@ entry:
; CHECK-NEXT: .byte 104
; CHECK-NEXT: .byte 0
-; CHECKOBJ: 00000010 .rodata.str1.1:
-; CHECKOBJ-NEXT: 10: 68 65 6c 6c xori 5, 3, 27756
-; CHECKOBJ-NEXT: 14: 6f 20 77 6f xoris 0, 25, 30575
-; CHECKOBJ-NEXT: 18: 72 6c 64 21 andi. 12, 19, 25633
-; CHECKOBJ-NEXT: 1c: 0a 00 61 62 tdlti 0, 24930{{[[:space:]] *}}
-; CHECKOBJ-NEXT: 0000001e .L.str:
-; CHECKOBJ-NEXT: 1e: 61 62 63 64 ori 2, 11, 25444
-; CHECKOBJ-NEXT: 22: 65 66 67 68 oris 6, 11, 26472
-; CHECKOBJ-NEXT: 26: 00 <unknown>
-; CHECKOBJ-NEXT: 27: 00 <unknown>
+; CHECKOBJ: 00000010 .rodata.str2.2:
+; CHECKOBJ-NEXT: 10: 01 08 01 10
+; CHECKOBJ-NEXT: 14: 00 d5 00 00 {{.*}}{{[[:space:]] *}}
+; CHECKOBJ-NEXT: 00000018 .rodata.str4.4:
+; CHECKOBJ-NEXT: 18: 00 00 01 d0
+; CHECKOBJ-NEXT: 1c: 00 00 01 d8
+; CHECKOBJ-NEXT: 20: 00 00 01 9d
+; CHECKOBJ-NEXT: 24: 00 00 00 00 {{.*}}{{[[:space:]] *}}
+; CHECKOBJ-NEXT: 00000028 .rodata.str1.1:
+; CHECKOBJ-NEXT: 28: 68 65 6c 6c
+; CHECKOBJ-NEXT: 2c: 6f 20 77 6f
+; CHECKOBJ-NEXT: 30: 72 6c 64 21
+; CHECKOBJ-NEXT: 34: 0a 00 61 62 {{.*}}{{[[:space:]] *}}
+; CHECKOBJ-NEXT: 00000036 .L.str:
+; CHECKOBJ-NEXT: 36: 61 62 63 64
+; CHECKOBJ-NEXT: 3a: 65 66 67 68
+; CHECKOBJ-NEXT: 3e: 00
+; CHECKOBJ-NEXT: 3f: 00
More information about the llvm-commits
mailing list