forked from OSchip/llvm-project
Revert r129518, "Change ELF systems to use CFI for producing the EH tables. This reduces the"
It broke several builds. llvm-svn: 129557
This commit is contained in:
parent
12bb05b75b
commit
b5e3e9dd27
|
@ -183,8 +183,6 @@ namespace llvm {
|
||||||
/// function.
|
/// function.
|
||||||
void EmitFunctionBody();
|
void EmitFunctionBody();
|
||||||
|
|
||||||
void emitPrologLabel(const MachineInstr &MI);
|
|
||||||
|
|
||||||
/// EmitConstantPool - Print to the current output stream assembly
|
/// EmitConstantPool - Print to the current output stream assembly
|
||||||
/// representations of the constants in the constant pool MCP. This is
|
/// representations of the constants in the constant pool MCP. This is
|
||||||
/// used to print out constants which have been "spilled to memory" by
|
/// used to print out constants which have been "spilled to memory" by
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "llvm/MC/MCStreamer.h"
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/Target/Mangler.h"
|
#include "llvm/Target/Mangler.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
#include "llvm/Target/TargetLowering.h"
|
#include "llvm/Target/TargetLowering.h"
|
||||||
|
@ -625,45 +624,6 @@ static bool EmitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsmPrinter::emitPrologLabel(const MachineInstr &MI) {
|
|
||||||
MCSymbol *Label = MI.getOperand(0).getMCSymbol();
|
|
||||||
if (MAI->getExceptionHandlingType() != ExceptionHandling::DwarfCFI) {
|
|
||||||
OutStreamer.EmitLabel(Label);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MachineFunction &MF = *MI.getParent()->getParent();
|
|
||||||
MachineModuleInfo &MMI = MF.getMMI();
|
|
||||||
std::vector<MachineMove> &Moves = MMI.getFrameMoves();
|
|
||||||
const MachineMove *Move = NULL;
|
|
||||||
for (std::vector<MachineMove>::iterator I = Moves.begin(),
|
|
||||||
E = Moves.end(); I != E; ++I) {
|
|
||||||
if (I->getLabel() == Label) {
|
|
||||||
Move = &*I;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert(Move);
|
|
||||||
|
|
||||||
const MachineLocation &Dst = Move->getDestination();
|
|
||||||
const MachineLocation &Src = Move->getSource();
|
|
||||||
const TargetAsmInfo &AsmInfo = OutContext.getTargetAsmInfo();
|
|
||||||
if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
|
|
||||||
if (Src.getReg() == MachineLocation::VirtualFP)
|
|
||||||
OutStreamer.EmitCFIDefCfaOffset(-Src.getOffset());
|
|
||||||
else {
|
|
||||||
unsigned Reg = AsmInfo.getDwarfRegNum(Src.getReg(), true);
|
|
||||||
OutStreamer.EmitCFIDefCfa(Reg, -Src.getOffset());
|
|
||||||
}
|
|
||||||
} else if (Src.isReg() && Src.getReg() == MachineLocation::VirtualFP) {
|
|
||||||
unsigned Reg = AsmInfo.getDwarfRegNum(Dst.getReg(), true);
|
|
||||||
OutStreamer.EmitCFIDefCfaRegister(Reg);
|
|
||||||
} else {
|
|
||||||
unsigned Reg = AsmInfo.getDwarfRegNum(Src.getReg(), true);
|
|
||||||
OutStreamer.EmitCFIOffset(Reg, -Dst.getOffset());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// EmitFunctionBody - This method emits the body and trailer for a
|
/// EmitFunctionBody - This method emits the body and trailer for a
|
||||||
/// function.
|
/// function.
|
||||||
void AsmPrinter::EmitFunctionBody() {
|
void AsmPrinter::EmitFunctionBody() {
|
||||||
|
@ -700,9 +660,6 @@ void AsmPrinter::EmitFunctionBody() {
|
||||||
|
|
||||||
switch (II->getOpcode()) {
|
switch (II->getOpcode()) {
|
||||||
case TargetOpcode::PROLOG_LABEL:
|
case TargetOpcode::PROLOG_LABEL:
|
||||||
emitPrologLabel(*II);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TargetOpcode::EH_LABEL:
|
case TargetOpcode::EH_LABEL:
|
||||||
case TargetOpcode::GC_LABEL:
|
case TargetOpcode::GC_LABEL:
|
||||||
OutStreamer.EmitLabel(II->getOperand(0).getMCSymbol());
|
OutStreamer.EmitLabel(II->getOperand(0).getMCSymbol());
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/Support/Dwarf.h"
|
#include "llvm/Support/Dwarf.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
|
||||||
#include "llvm/Support/FormattedStream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
|
@ -61,16 +60,11 @@ void DwarfCFIException::EndModule() {
|
||||||
// Begin eh frame section.
|
// Begin eh frame section.
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
|
Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
|
||||||
|
|
||||||
if ((PerEncoding & 0x70) != dwarf::DW_EH_PE_pcrel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Emit references to all used personality functions
|
// Emit references to all used personality functions
|
||||||
const std::vector<const Function*> &Personalities = MMI->getPersonalities();
|
const std::vector<const Function*> &Personalities = MMI->getPersonalities();
|
||||||
for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
|
for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("personality", i));
|
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("personality", i));
|
||||||
const MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
|
Asm->EmitReference(Personalities[i], PerEncoding);
|
||||||
unsigned Size = Asm->TM.getTargetData()->getPointerSize();
|
|
||||||
Asm->OutStreamer.EmitSymbolValue(Sym, Size);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +87,17 @@ void DwarfCFIException::BeginFunction(const MachineFunction *MF) {
|
||||||
|
|
||||||
shouldEmitTableModule |= shouldEmitTable;
|
shouldEmitTableModule |= shouldEmitTable;
|
||||||
|
|
||||||
if (shouldEmitMoves || shouldEmitTable)
|
if (shouldEmitMoves) {
|
||||||
|
const TargetFrameLowering *TFL = Asm->TM.getFrameLowering();
|
||||||
Asm->OutStreamer.EmitCFIStartProc();
|
Asm->OutStreamer.EmitCFIStartProc();
|
||||||
|
|
||||||
|
// Indicate locations of general callee saved registers in frame.
|
||||||
|
std::vector<MachineMove> Moves;
|
||||||
|
TFL->getInitialFrameState(Moves);
|
||||||
|
Asm->EmitCFIFrameMoves(Moves);
|
||||||
|
Asm->EmitCFIFrameMoves(MMI->getFrameMoves());
|
||||||
|
}
|
||||||
|
|
||||||
if (!shouldEmitTable)
|
if (!shouldEmitTable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -110,25 +112,11 @@ void DwarfCFIException::BeginFunction(const MachineFunction *MF) {
|
||||||
|
|
||||||
// Indicate personality routine, if any.
|
// Indicate personality routine, if any.
|
||||||
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
||||||
const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
|
if (PerEncoding != dwarf::DW_EH_PE_omit &&
|
||||||
if (PerEncoding == dwarf::DW_EH_PE_omit || !Per)
|
MMI->getPersonalities()[MMI->getPersonalityIndex()])
|
||||||
return;
|
Asm->OutStreamer.EmitCFIPersonality(Asm->GetTempSymbol("personality",
|
||||||
|
MMI->getPersonalityIndex()),
|
||||||
const MCSymbol *Sym;
|
PerEncoding);
|
||||||
switch (PerEncoding & 0x70) {
|
|
||||||
default:
|
|
||||||
report_fatal_error("We do not support this DWARF encoding yet!");
|
|
||||||
case dwarf::DW_EH_PE_absptr: {
|
|
||||||
Sym = Asm->Mang->getSymbol(Per);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case dwarf::DW_EH_PE_pcrel: {
|
|
||||||
Sym = Asm->GetTempSymbol("personality",
|
|
||||||
MMI->getPersonalityIndex());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EndFunction - Gather and emit post-function exception information.
|
/// EndFunction - Gather and emit post-function exception information.
|
||||||
|
|
|
@ -314,7 +314,7 @@ getExprForDwarfReference(const MCSymbol *Sym, Mangler *Mang,
|
||||||
MCStreamer &Streamer) const {
|
MCStreamer &Streamer) const {
|
||||||
const MCExpr *Res = MCSymbolRefExpr::Create(Sym, getContext());
|
const MCExpr *Res = MCSymbolRefExpr::Create(Sym, getContext());
|
||||||
|
|
||||||
switch (Encoding & 0x70) {
|
switch (Encoding & 0xF0) {
|
||||||
default:
|
default:
|
||||||
report_fatal_error("We do not support this DWARF encoding yet!");
|
report_fatal_error("We do not support this DWARF encoding yet!");
|
||||||
case dwarf::DW_EH_PE_absptr:
|
case dwarf::DW_EH_PE_absptr:
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||||
#include "llvm/MC/MCAsmInfo.h"
|
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
@ -477,15 +476,6 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||||
.addReg(StackPtr);
|
.addReg(StackPtr);
|
||||||
|
|
||||||
if (needsFrameMoves) {
|
if (needsFrameMoves) {
|
||||||
const MCAsmInfo &MAI = MMI.getContext().getAsmInfo();
|
|
||||||
if (MAI.getExceptionHandlingType() == ExceptionHandling::DwarfCFI) {
|
|
||||||
MCSymbol *FrameLabel0 = MMI.getContext().CreateTempSymbol();
|
|
||||||
BuildMI(MBB, MBBI, DL, TII.get(X86::PROLOG_LABEL)).addSym(FrameLabel0);
|
|
||||||
MachineLocation FPSrc0(FramePtr);
|
|
||||||
MachineLocation FPDst0(FramePtr, -2 * stackGrowth);
|
|
||||||
Moves.push_back(MachineMove(FrameLabel0, FPDst0, FPSrc0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark effective beginning of when frame pointer becomes valid.
|
// Mark effective beginning of when frame pointer becomes valid.
|
||||||
MCSymbol *FrameLabel = MMI.getContext().CreateTempSymbol();
|
MCSymbol *FrameLabel = MMI.getContext().CreateTempSymbol();
|
||||||
BuildMI(MBB, MBBI, DL, TII.get(X86::PROLOG_LABEL)).addSym(FrameLabel);
|
BuildMI(MBB, MBBI, DL, TII.get(X86::PROLOG_LABEL)).addSym(FrameLabel);
|
||||||
|
@ -625,7 +615,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||||
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit,
|
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit,
|
||||||
TII, *RegInfo);
|
TII, *RegInfo);
|
||||||
|
|
||||||
if (( (!HasFP && NumBytes) || PushedRegs) && needsFrameMoves) {
|
if ((NumBytes || PushedRegs) && needsFrameMoves) {
|
||||||
// Mark end of stack pointer adjustment.
|
// Mark end of stack pointer adjustment.
|
||||||
MCSymbol *Label = MMI.getContext().CreateTempSymbol();
|
MCSymbol *Label = MMI.getContext().CreateTempSymbol();
|
||||||
BuildMI(MBB, MBBI, DL, TII.get(X86::PROLOG_LABEL)).addSym(Label);
|
BuildMI(MBB, MBBI, DL, TII.get(X86::PROLOG_LABEL)).addSym(Label);
|
||||||
|
|
|
@ -89,9 +89,7 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) {
|
||||||
SupportsDebugInformation = true;
|
SupportsDebugInformation = true;
|
||||||
|
|
||||||
// Exceptions handling
|
// Exceptions handling
|
||||||
ExceptionsType = ExceptionHandling::DwarfCFI;
|
ExceptionsType = ExceptionHandling::DwarfTable;
|
||||||
|
|
||||||
DwarfRequiresFrameSection = false;
|
|
||||||
|
|
||||||
// OpenBSD has buggy support for .quad in 32-bit mode, just split into two
|
// OpenBSD has buggy support for .quad in 32-bit mode, just split into two
|
||||||
// .words.
|
// .words.
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -o - | FileCheck %s
|
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -o - | grep zPL
|
||||||
|
|
||||||
; CHECK: .cfi_lsda 0, .Lexception0
|
|
||||||
; CHECK: .cfi_personality 0, __gnat_eh_personality
|
|
||||||
|
|
||||||
@error = external global i8 ; <i8*> [#uses=2]
|
@error = external global i8 ; <i8*> [#uses=2]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
; RUN: llc < %s -march=x86-64 -mtriple=x86_64-unknown-linux-gnu | grep ^.L_Z1fv.eh
|
||||||
|
; RUN: llc < %s -march=x86 -mtriple=i686-unknown-linux-gnu | grep ^.L_Z1fv.eh
|
||||||
|
; RUN: llc < %s -march=x86-64 -mtriple=x86_64-apple-darwin9 | grep ^__Z1fv.eh
|
||||||
|
; RUN: llc < %s -march=x86 -mtriple=i386-apple-darwin9 | grep ^__Z1fv.eh
|
||||||
|
|
||||||
|
define void @_Z1fv() {
|
||||||
|
entry:
|
||||||
|
br label %return
|
||||||
|
|
||||||
|
return:
|
||||||
|
ret void
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -asm-verbose=false -o %t
|
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -asm-verbose=false -o %t
|
||||||
|
; RUN: grep { = } %t | count 16
|
||||||
|
; RUN: grep set %t | count 18
|
||||||
; RUN: grep globl %t | count 6
|
; RUN: grep globl %t | count 6
|
||||||
; RUN: grep weak %t | count 1
|
; RUN: grep weak %t | count 1
|
||||||
; RUN: grep hidden %t | count 1
|
; RUN: grep hidden %t | count 1
|
||||||
|
|
Loading…
Reference in New Issue