[SystemZ][z/OS] Add entry point marker to PPA
Differential Revision: https://reviews.llvm.org/D115269
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
SM.reset();
|
||||
return AsmPrinter::doInitialization(M);
|
||||
}
|
||||
void emitFunctionEntryLabel() override;
|
||||
|
||||
private:
|
||||
void LowerFENTRY_CALL(const MachineInstr &MI, SystemZMCInstLower &MCIL);
|
||||
|
||||
15
llvm/test/MC/GOFF/ppa1.ll
Normal file
15
llvm/test/MC/GOFF/ppa1.ll
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user