[llvm] fc8a087 - [SystemZ][z/OS] Add entry point marker to PPA
Neumann Hon via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 6 18:29:43 PST 2022
Author: Yusra Syeda
Date: 2022-01-06T21:29:20-05:00
New Revision: fc8a08765af8f32663776a42e85b28362b5658ce
URL: https://github.com/llvm/llvm-project/commit/fc8a08765af8f32663776a42e85b28362b5658ce
DIFF: https://github.com/llvm/llvm-project/commit/fc8a08765af8f32663776a42e85b28362b5658ce.diff
LOG: [SystemZ][z/OS] Add entry point marker to PPA
Differential Revision: https://reviews.llvm.org/D115269
Added:
llvm/test/MC/GOFF/ppa1.ll
Modified:
llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index defab665f9249..e01adcce04ab1 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -786,6 +786,50 @@ void SystemZAsmPrinter::emitEndOfAsmFile(Module &M) {
emitStackMaps(SM);
}
+void SystemZAsmPrinter::emitFunctionEntryLabel() {
+ const SystemZSubtarget &Subtarget =
+ static_cast<const SystemZSubtarget &>(MF->getSubtarget());
+
+ if (Subtarget.getTargetTriple().isOSzOS()) {
+ MCContext &OutContext = OutStreamer->getContext();
+ MCSymbol *EPMarkerSym = OutContext.createTempSymbol("CM_", true);
+
+ // EntryPoint Marker
+ const MachineFrameInfo &MFFrame = MF->getFrameInfo();
+ bool IsUsingAlloca = MFFrame.hasVarSizedObjects();
+
+ // Set Flags
+ uint8_t Flags = 0;
+ if (IsUsingAlloca)
+ Flags |= 0x04;
+
+ uint32_t DSASize = MFFrame.getStackSize();
+
+ // Combine into top 27 bits of DSASize and bottom 5 bits of Flags.
+ uint32_t DSAAndFlags = DSASize & 0xFFFFFFE0; // (x/32) << 5
+ DSAAndFlags |= Flags;
+
+ // Emit entry point marker section.
+ OutStreamer->AddComment("XPLINK Routine Layout Entry");
+ OutStreamer->emitLabel(EPMarkerSym);
+ OutStreamer->AddComment("Eyecatcher 0x00C300C500C500");
+ OutStreamer->emitIntValueInHex(0x00C300C500C500, 7); // Eyecatcher.
+ OutStreamer->AddComment("Mark Type C'1'");
+ OutStreamer->emitInt8(0xF1); // Mark Type.
+ if (OutStreamer->isVerboseAsm()) {
+ OutStreamer->AddComment("DSA Size 0x" + Twine::utohexstr(DSASize));
+ OutStreamer->AddComment("Entry Flags");
+ if (Flags & 0x04)
+ OutStreamer->AddComment(" Bit 2: 1 = Uses alloca");
+ else
+ OutStreamer->AddComment(" Bit 2: 0 = Does not use alloca");
+ }
+ OutStreamer->emitInt32(DSAAndFlags);
+ }
+
+ AsmPrinter::emitFunctionEntryLabel();
+}
+
// Force static initialization.
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZAsmPrinter() {
RegisterAsmPrinter<SystemZAsmPrinter> X(getTheSystemZTarget());
diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
index 47a3336b8e63b..80d68d1b93ff7 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
@@ -51,6 +51,7 @@ class LLVM_LIBRARY_VISIBILITY SystemZAsmPrinter : public AsmPrinter {
SM.reset();
return AsmPrinter::doInitialization(M);
}
+ void emitFunctionEntryLabel() override;
private:
void LowerFENTRY_CALL(const MachineInstr &MI, SystemZMCInstLower &MCIL);
diff --git a/llvm/test/MC/GOFF/ppa1.ll b/llvm/test/MC/GOFF/ppa1.ll
new file mode 100644
index 0000000000000..df7aa6b7b4fc0
--- /dev/null
+++ b/llvm/test/MC/GOFF/ppa1.ll
@@ -0,0 +1,15 @@
+; RUN: llc -mtriple s390x-ibm-zos < %s | FileCheck %s
+
+; CHECK: @@CM_0: * @void_test
+; CHECK: * XPLINK Routine Layout Entry
+; CHECK: .long 12779717 * Eyecatcher 0x00C300C500C500
+; CHECK: .short 197
+; CHECK: .byte 0
+; CHECK: .byte 241 * Mark Type C'1'
+; CHECK: .long 128 * DSA Size 0x80
+; CHECK: * Entry Flags
+; CHECK: * Bit 2: 0 = Does not use alloca
+define void @void_test() {
+entry:
+ ret void
+}
More information about the llvm-commits
mailing list