summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorRichard Osborne <richard@xmos.com>2009-08-18 21:14:31 +0000
committerRichard Osborne <richard@xmos.com>2009-08-18 21:14:31 +0000
commit2349fb4d4521e6fc98a574d1a3fb6c3943714e1f (patch)
tree3a29f37ad3d7d246aa05d9c7997af138ee33bfe2 /llvm
parent1f18b9a3016b8e6809b678cb046667fe493bf9b4 (diff)
downloadbcm5719-llvm-2349fb4d4521e6fc98a574d1a3fb6c3943714e1f.tar.gz
bcm5719-llvm-2349fb4d4521e6fc98a574d1a3fb6c3943714e1f.zip
Add support for mergeable sections back into the XCore backend.
llvm-svn: 79368
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp23
-rw-r--r--llvm/test/CodeGen/XCore/constants.ll2
-rw-r--r--llvm/test/CodeGen/XCore/globals.ll2
3 files changed, 20 insertions, 7 deletions
diff --git a/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp b/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp
index 91cb11533df..c1990d6d0fc 100644
--- a/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp
+++ b/llvm/lib/Target/XCore/XCoreTargetObjectFile.cpp
@@ -28,11 +28,24 @@ void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
MCSectionXCore::SHF_DP_SECTION,
SectionKind::getBSS(), false, getContext());
- // For now, disable lowering of mergable sections, just drop everything into
- // ReadOnly.
- MergeableConst4Section = 0;
- MergeableConst8Section = 0;
- MergeableConst16Section = 0;
+ MergeableConst4Section =
+ MCSectionXCore::Create(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS,
+ MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
+ MCSectionXCore::SHF_CP_SECTION,
+ SectionKind::getMergeableConst4(), false,
+ getContext());
+ MergeableConst8Section =
+ MCSectionXCore::Create(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS,
+ MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
+ MCSectionXCore::SHF_CP_SECTION,
+ SectionKind::getMergeableConst8(), false,
+ getContext());
+ MergeableConst16Section =
+ MCSectionXCore::Create(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS,
+ MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
+ MCSectionXCore::SHF_CP_SECTION,
+ SectionKind::getMergeableConst16(), false,
+ getContext());
// TLS globals are lowered in the backend to arrays indexed by the current
// thread id. After lowering they require no special handling by the linker
diff --git a/llvm/test/CodeGen/XCore/constants.ll b/llvm/test/CodeGen/XCore/constants.ll
index 2aee6a26c4e..8ba8b5c6a76 100644
--- a/llvm/test/CodeGen/XCore/constants.ll
+++ b/llvm/test/CodeGen/XCore/constants.ll
@@ -1,6 +1,6 @@
; RUN: llvm-as < %s | llc -march=xcore -mcpu=xs1b-generic | FileCheck %s
-; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK: .section .cp.rodata.cst4,"aMc",@progbits,4
; CHECK: .LCPI1_0:
; CHECK: .long 12345678
; CHECK: f:
diff --git a/llvm/test/CodeGen/XCore/globals.ll b/llvm/test/CodeGen/XCore/globals.ll
index 8cb2ef36694..9bc0f53de71 100644
--- a/llvm/test/CodeGen/XCore/globals.ll
+++ b/llvm/test/CodeGen/XCore/globals.ll
@@ -68,7 +68,7 @@ entry:
; CHECK: G2:
@G3 = constant i32 9401
-; CHECK: .section .cp.rodata,"ac",@progbits
+; CHECK: .section .cp.rodata.cst4,"aMc",@progbits,4
; CHECK: G3:
@G4 = global i32* @G1
OpenPOWER on IntegriCloud