[llvm] r215717 - Make BuildSymbolDiff an static helper.
Rafael Espindola
rafael.espindola at gmail.com
Fri Aug 15 07:31:47 PDT 2014
Author: rafael
Date: Fri Aug 15 09:31:47 2014
New Revision: 215717
URL: http://llvm.org/viewvc/llvm-project?rev=215717&view=rev
Log:
Make BuildSymbolDiff an static helper.
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/MC/MCObjectStreamer.cpp
llvm/trunk/lib/MC/MCStreamer.cpp
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=215717&r1=215716&r2=215717&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Fri Aug 15 09:31:47 2014
@@ -196,9 +196,6 @@ class MCStreamer {
protected:
MCStreamer(MCContext &Ctx);
- const MCExpr *BuildSymbolDiff(MCContext &Context, const MCSymbol *A,
- const MCSymbol *B);
-
virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame);
virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame);
Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=215717&r1=215716&r2=215717&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Fri Aug 15 09:31:47 2014
@@ -264,6 +264,17 @@ void MCObjectStreamer::EmitDwarfLocDirec
Isa, Discriminator, FileName);
}
+static const MCExpr *buildSymbolDiff(MCObjectStreamer &OS, const MCSymbol *A,
+ const MCSymbol *B) {
+ MCContext &Context = OS.getContext();
+ MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
+ const MCExpr *ARef = MCSymbolRefExpr::Create(A, Variant, Context);
+ const MCExpr *BRef = MCSymbolRefExpr::Create(B, Variant, Context);
+ const MCExpr *AddrDelta =
+ MCBinaryExpr::Create(MCBinaryExpr::Sub, ARef, BRef, Context);
+ return AddrDelta;
+}
+
void MCObjectStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
const MCSymbol *LastLabel,
const MCSymbol *Label,
@@ -272,7 +283,7 @@ void MCObjectStreamer::EmitDwarfAdvanceL
EmitDwarfSetLineAddr(LineDelta, Label, PointerSize);
return;
}
- const MCExpr *AddrDelta = BuildSymbolDiff(getContext(), Label, LastLabel);
+ const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel);
int64_t Res;
if (AddrDelta->EvaluateAsAbsolute(Res, getAssembler())) {
MCDwarfLineAddr::Emit(this, LineDelta, Res);
@@ -283,7 +294,7 @@ void MCObjectStreamer::EmitDwarfAdvanceL
void MCObjectStreamer::EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
const MCSymbol *Label) {
- const MCExpr *AddrDelta = BuildSymbolDiff(getContext(), Label, LastLabel);
+ const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel);
int64_t Res;
if (AddrDelta->EvaluateAsAbsolute(Res, getAssembler())) {
MCDwarfFrameEmitter::EmitAdvanceLoc(*this, Res);
Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=215717&r1=215716&r2=215717&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Fri Aug 15 09:31:47 2014
@@ -56,19 +56,6 @@ void MCStreamer::reset() {
SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>());
}
-const MCExpr *MCStreamer::BuildSymbolDiff(MCContext &Context,
- const MCSymbol *A,
- const MCSymbol *B) {
- MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
- const MCExpr *ARef =
- MCSymbolRefExpr::Create(A, Variant, Context);
- const MCExpr *BRef =
- MCSymbolRefExpr::Create(B, Variant, Context);
- const MCExpr *AddrDelta =
- MCBinaryExpr::Create(MCBinaryExpr::Sub, ARef, BRef, Context);
- return AddrDelta;
-}
-
static const MCExpr *forceExpAbs(MCStreamer &OS, const MCExpr* Expr) {
MCContext &Context = OS.getContext();
assert(!isa<MCSymbolRefExpr>(Expr));
More information about the llvm-commits
mailing list