[PATCH] D115269: [SystemZ][z/OS] Add entry point marker to PPA
Yusra Syeda via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 14 10:53:56 PST 2021
yusra.syeda updated this revision to Diff 394314.
yusra.syeda added a comment.
Removed the FIXME
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115269/new/
https://reviews.llvm.org/D115269
Files:
llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
llvm/test/MC/GOFF/ppa1.ll
Index: llvm/test/MC/GOFF/ppa1.ll
===================================================================
--- /dev/null
+++ 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
+}
Index: llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
===================================================================
--- llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
+++ llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
@@ -52,6 +52,7 @@
SM.reset();
return AsmPrinter::doInitialization(M);
}
+ void emitFunctionEntryLabel() override;
private:
void LowerFENTRY_CALL(const MachineInstr &MI, SystemZMCInstLower &MCIL);
Index: llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -786,6 +786,50 @@
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());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115269.394314.patch
Type: text/x-patch
Size: 3056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211214/b598a04e/attachment.bin>
More information about the llvm-commits
mailing list