Add the getExprForFDESymbol method that responsible for computing the

expressions used in the FDE to refer to symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2011-04-28 21:04:39 +00:00
parent 77562c74e5
commit a0057ca13f
5 changed files with 21 additions and 16 deletions

View File

@ -328,6 +328,9 @@ namespace llvm {
getExprForPersonalitySymbol(const MCSymbol *Sym,
MCStreamer &Streamer) const;
virtual const MCExpr *
getExprForFDESymbol(const MCSymbol *Sym, MCStreamer &Streamer) const;
bool usesSunStyleELFSectionSwitchSyntax() const {
return SunStyleELFSectionSwitchSyntax;
}

View File

@ -26,8 +26,7 @@ namespace llvm {
struct MCAsmInfoDarwin : public MCAsmInfo {
explicit MCAsmInfoDarwin();
virtual const MCExpr *
getExprForPersonalitySymbol(const MCSymbol *Sym,
MCStreamer &Streamer) const;
getExprForFDESymbol(const MCSymbol *Sym, MCStreamer &Streamer) const;
};
}

View File

@ -112,5 +112,11 @@ unsigned MCAsmInfo::getSLEB128Size(int Value) {
const MCExpr *
MCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,
MCStreamer &Streamer) const {
return getExprForFDESymbol(Sym, Streamer);
}
const MCExpr *
MCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
MCStreamer &Streamer) const {
return MCSymbolRefExpr::Create(Sym, Streamer.getContext());
}

View File

@ -61,8 +61,8 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
}
const MCExpr *
MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym,
MCStreamer &Streamer) const {
MCAsmInfoDarwin::getExprForFDESymbol(const MCSymbol *Sym,
MCStreamer &Streamer) const {
MCContext &Context = Streamer.getContext();
const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context);
MCSymbol *PCSym = Context.CreateTempSymbol();

View File

@ -465,19 +465,16 @@ static unsigned getSizeForEncoding(MCStreamer &streamer,
static void EmitSymbol(MCStreamer &streamer, const MCSymbol &symbol,
unsigned symbolEncoding) {
MCContext &context = streamer.getContext();
const MCAsmInfo &asmInfo = context.getAsmInfo();
const MCExpr *v = asmInfo.getExprForFDESymbol(&symbol,
streamer);
unsigned size = getSizeForEncoding(streamer, symbolEncoding);
unsigned application = symbolEncoding & 0x70;
switch (application) {
default:
assert(0 && "Unknown Encoding");
break;
case 0:
streamer.EmitSymbolValue(&symbol, size);
break;
case dwarf::DW_EH_PE_pcrel:
streamer.EmitPCRelSymbolValue(&symbol, size);
break;
}
if (isa<MCSymbolRefExpr>(v) && application == dwarf::DW_EH_PE_pcrel)
streamer.EmitPCRelValue(v, size);
else
streamer.EmitAbsValue(v, size);
}
static void EmitPersonality(MCStreamer &streamer, const MCSymbol &symbol,
@ -756,7 +753,7 @@ MCSymbol *FrameEmitterImpl::EmitFDE(MCStreamer &streamer,
unsigned size = getSizeForEncoding(streamer, fdeEncoding);
// PC Begin
streamer.EmitPCRelSymbolValue(frame.Begin, size);
EmitSymbol(streamer, *frame.Begin, fdeEncoding);
// PC Range
const MCExpr *Range = MakeStartMinusEndExpr(streamer, *frame.Begin,