Prepare support of Itanium ABI on ARM as opposed to EHABI by

conditionally emitting .fnstart and friends only for EHABI.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207718 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joerg Sonnenberger 2014-04-30 22:43:13 +00:00
parent e4c1d49b1d
commit 6c0458d2b4
2 changed files with 20 additions and 15 deletions

View File

@ -57,7 +57,8 @@ void ARMException::endModule() {
/// beginFunction - Gather pre-function exception information. Assumes it's /// beginFunction - Gather pre-function exception information. Assumes it's
/// being emitted immediately after the function entry point. /// being emitted immediately after the function entry point.
void ARMException::beginFunction(const MachineFunction *MF) { void ARMException::beginFunction(const MachineFunction *MF) {
getTargetStreamer().emitFnStart(); if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM)
getTargetStreamer().emitFnStart();
if (Asm->MF->getFunction()->needsUnwindTableEntry()) if (Asm->MF->getFunction()->needsUnwindTableEntry())
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin", Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_func_begin",
Asm->getFunctionNumber())); Asm->getFunctionNumber()));
@ -104,7 +105,8 @@ void ARMException::endFunction(const MachineFunction *) {
} }
} }
ATS.emitFnEnd(); if (Asm->MAI->getExceptionHandlingType() == ExceptionHandling::ARM)
ATS.emitFnEnd();
} }
void ARMException::EmitTypeInfos(unsigned TTypeEncoding) { void ARMException::EmitTypeInfos(unsigned TTypeEncoding) {

View File

@ -993,7 +993,8 @@ void ARMAsmPrinter::EmitUnwindingInstruction(const MachineInstr *MI) {
RegList.push_back(SrcReg); RegList.push_back(SrcReg);
break; break;
} }
ATS.emitRegSave(RegList, Opc == ARM::VSTMDDB_UPD); if (MAI->getExceptionHandlingType() == ExceptionHandling::ARM)
ATS.emitRegSave(RegList, Opc == ARM::VSTMDDB_UPD);
} else { } else {
// Changes of stack / frame pointer. // Changes of stack / frame pointer.
if (SrcReg == ARM::SP) { if (SrcReg == ARM::SP) {
@ -1038,18 +1039,20 @@ void ARMAsmPrinter::EmitUnwindingInstruction(const MachineInstr *MI) {
} }
} }
if (DstReg == FramePtr && FramePtr != ARM::SP) if (MAI->getExceptionHandlingType() == ExceptionHandling::ARM) {
// Set-up of the frame pointer. Positive values correspond to "add" if (DstReg == FramePtr && FramePtr != ARM::SP)
// instruction. // Set-up of the frame pointer. Positive values correspond to "add"
ATS.emitSetFP(FramePtr, ARM::SP, -Offset); // instruction.
else if (DstReg == ARM::SP) { ATS.emitSetFP(FramePtr, ARM::SP, -Offset);
// Change of SP by an offset. Positive values correspond to "sub" else if (DstReg == ARM::SP) {
// instruction. // Change of SP by an offset. Positive values correspond to "sub"
ATS.emitPad(Offset); // instruction.
} else { ATS.emitPad(Offset);
// Move of SP to a register. Positive values correspond to an "add" } else {
// instruction. // Move of SP to a register. Positive values correspond to an "add"
ATS.emitMovSP(DstReg, -Offset); // instruction.
ATS.emitMovSP(DstReg, -Offset);
}
} }
} else if (DstReg == ARM::SP) { } else if (DstReg == ARM::SP) {
MI->dump(); MI->dump();