aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorAnirudh Prasad <anirudh_prasad@hotmail.com>2021-07-27 11:26:00 -0400
committerAnirudh Prasad <anirudh_prasad@hotmail.com>2021-07-27 11:29:15 -0400
commita8cfa4b9bda3014a88e089cadcc6d366317aec5b (patch)
treec3b057352f74db78c1201f31061d70df0aa50971 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent8ee5759fd50d147328f9e2a7ca9d6894721d0770 (diff)
downloadllvm-a8cfa4b9bda3014a88e089cadcc6d366317aec5b.zip
llvm-a8cfa4b9bda3014a88e089cadcc6d366317aec5b.tar.gz
llvm-a8cfa4b9bda3014a88e089cadcc6d366317aec5b.tar.bz2
[SystemZ][z/OS] Initial code to generate assembly files on z/OS
- This patch consists of the bare basic code needed in order to generate some assembly for the z/OS target. - Only the .text and the .bss sections are added for now. - The relevant MCSectionGOFF/Symbol interfaces have been added. This enables us to print out the GOFF machine code sections. - This patch enables us to add simple lit tests wherever possible, and contribute to the testing coverage for the z/OS target - Further improvements and additions will be made in future patches. Reviewed By: tmatheson Differential Revision: https://reviews.llvm.org/D106380
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 8d8838f..add34ec 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -48,6 +48,7 @@
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSectionELF.h"
+#include "llvm/MC/MCSectionGOFF.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSectionWasm.h"
#include "llvm/MC/MCSectionXCOFF.h"
@@ -2521,3 +2522,24 @@ MCSection *TargetLoweringObjectFileXCOFF::getSectionForTOCEntry(
TM.getCodeModel() == CodeModel::Large ? XCOFF::XMC_TE : XCOFF::XMC_TC,
XCOFF::XTY_SD));
}
+
+//===----------------------------------------------------------------------===//
+// GOFF
+//===----------------------------------------------------------------------===//
+TargetLoweringObjectFileGOFF::TargetLoweringObjectFileGOFF()
+ : TargetLoweringObjectFile() {}
+
+MCSection *TargetLoweringObjectFileGOFF::getExplicitSectionGlobal(
+ const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
+ return SelectSectionForGlobal(GO, Kind, TM);
+}
+
+MCSection *TargetLoweringObjectFileGOFF::SelectSectionForGlobal(
+ const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
+ auto *Symbol = TM.getSymbol(GO);
+ if (Kind.isBSS())
+ return getContext().getGOFFSection(Symbol->getName(),
+ SectionKind::getBSS());
+
+ return getContext().getObjectFileInfo()->getTextSection();
+}