[llvm-commits] [llvm] r120767 - in /llvm/trunk: include/llvm/MC/MCDwarf.h include/llvm/MC/MCExpr.h include/llvm/MC/MCObjectStreamer.h include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp lib/MC/MCDwarf.cpp lib/MC/MCELFStreamer.cpp lib/MC/MCExpr.cpp lib/MC/MCLoggingStreamer.cpp lib/MC/MCMachOStreamer.cpp lib/MC/MCNullStreamer.cpp lib/MC/MCObjectStreamer.cpp lib/MC/MCStreamer.cpp lib/Target/PTX/PTXMCAsmStreamer.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu Dec 2 16:55:41 PST 2010
Author: rafael
Date: Thu Dec 2 18:55:40 2010
New Revision: 120767
URL: http://llvm.org/viewvc/llvm-project?rev=120767&view=rev
Log:
Try to resolve symbol differences early, and if successful create a plain
data fragment. This reduces the time to assemble the test in 8711 from 60s to
54s.
Modified:
llvm/trunk/include/llvm/MC/MCDwarf.h
llvm/trunk/include/llvm/MC/MCExpr.h
llvm/trunk/include/llvm/MC/MCObjectStreamer.h
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/MC/MCAsmStreamer.cpp
llvm/trunk/lib/MC/MCDwarf.cpp
llvm/trunk/lib/MC/MCELFStreamer.cpp
llvm/trunk/lib/MC/MCExpr.cpp
llvm/trunk/lib/MC/MCLoggingStreamer.cpp
llvm/trunk/lib/MC/MCMachOStreamer.cpp
llvm/trunk/lib/MC/MCNullStreamer.cpp
llvm/trunk/lib/MC/MCObjectStreamer.cpp
llvm/trunk/lib/MC/MCStreamer.cpp
llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp
Modified: llvm/trunk/include/llvm/MC/MCDwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCDwarf.h (original)
+++ llvm/trunk/include/llvm/MC/MCDwarf.h Thu Dec 2 18:55:40 2010
@@ -209,7 +209,6 @@
// This emits the Dwarf file and the line tables.
//
static void Emit(MCStreamer *MCOS, const MCSection *DwarfLineSection,
- MCSectionData *DLS, int PointerSize,
const MCSection *TextSection = NULL);
};
Modified: llvm/trunk/include/llvm/MC/MCExpr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCExpr.h?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCExpr.h (original)
+++ llvm/trunk/include/llvm/MC/MCExpr.h Thu Dec 2 18:55:40 2010
@@ -16,6 +16,7 @@
namespace llvm {
class MCAsmInfo;
class MCAsmLayout;
+class MCAssembler;
class MCContext;
class MCSymbol;
class MCValue;
@@ -43,7 +44,8 @@
protected:
explicit MCExpr(ExprKind _Kind) : Kind(_Kind) {}
- bool EvaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
+ const MCAsmLayout *Layout,
bool InSet) const;
public:
/// @name Accessors
@@ -69,7 +71,11 @@
/// values. If not given, then only non-symbolic expressions will be
/// evaluated.
/// @result - True on success.
- bool EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout = 0) const;
+ bool EvaluateAsAbsolute(int64_t &Res) const;
+ bool EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const;
+ bool EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout) const;
+ bool EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
+ const MCAsmLayout *Layout) const;
/// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable
/// value, i.e. an expression of the fixed form (a - b + constant).
Modified: llvm/trunk/include/llvm/MC/MCObjectStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectStreamer.h?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectStreamer.h Thu Dec 2 18:55:40 2010
@@ -69,6 +69,9 @@
virtual void EmitInstruction(const MCInst &Inst);
virtual void EmitInstToFragment(const MCInst &Inst);
virtual void EmitValueToOffset(const MCExpr *Offset, unsigned char Value);
+ virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label);
virtual void Finish();
/// @}
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Thu Dec 2 18:55:40 2010
@@ -351,6 +351,13 @@
unsigned Isa,
unsigned Discriminator);
+ virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label) = 0;
+
+ void EmitDwarfSetLineAddr(int64_t LineDelta, const MCSymbol *Label,
+ int PointerSize);
+
virtual bool EmitCFIStartProc();
virtual bool EmitCFIEndProc();
virtual bool EmitCFIDefCfaOffset(int64_t Offset);
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Thu Dec 2 18:55:40 2010
@@ -121,6 +121,9 @@
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value);
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
+ virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label);
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
@@ -298,6 +301,12 @@
EmitEOL();
}
+void MCAsmStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label) {
+ EmitDwarfSetLineAddr(LineDelta, Label, PointerSize);
+}
+
void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) {
switch (Attribute) {
@@ -885,10 +894,9 @@
void MCAsmStreamer::Finish() {
// Dump out the dwarf file & directory tables and line tables.
- if (getContext().hasDwarfFiles() && TLOF) {
- MCDwarfFileTable::Emit(this, TLOF->getDwarfLineSection(), NULL,
- PointerSize, TLOF->getTextSection());
- }
+ if (getContext().hasDwarfFiles() && TLOF)
+ MCDwarfFileTable::Emit(this, TLOF->getDwarfLineSection(),
+ TLOF->getTextSection());
}
MCStreamer *llvm::createAsmStreamer(MCContext &Context,
Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Thu Dec 2 18:55:40 2010
@@ -117,21 +117,6 @@
return Res3;
}
-//
-// This emits an "absolute" address used in the start of a dwarf line number
-// table. This will result in a relocatation entry for the address.
-//
-static inline void EmitDwarfSetAddress(MCStreamer *MCOS,
- MCSymbol *Symbol,
- int PointerSize) {
- MCOS->EmitIntValue(dwarf::DW_LNS_extended_op, 1);
-
- MCOS->EmitULEB128IntValue(PointerSize + 1);
-
- MCOS->EmitIntValue(dwarf::DW_LNE_set_address, 1);
- MCOS->EmitSymbolValue(Symbol, PointerSize);
-}
-
//
// This emits the Dwarf line table for the specified section from the entries
// in the LineSection.
@@ -139,9 +124,7 @@
static inline void EmitDwarfLineTable(MCStreamer *MCOS,
const MCSection *Section,
const MCLineSection *LineSection,
- const MCSection *DwarfLineSection,
- MCSectionData *DLS,
- int PointerSize) {
+ const MCSection *DwarfLineSection) {
unsigned FileNum = 1;
unsigned LastLine = 1;
unsigned Column = 0;
@@ -186,19 +169,7 @@
// At this point we want to emit/create the sequence to encode the delta in
// line numbers and the increment of the address from the previous Label
// and the current Label.
- if (LastLabel == NULL || DLS == NULL) {
- // emit the sequence to set the address
- EmitDwarfSetAddress(MCOS, Label, PointerSize);
- // emit the sequence for the LineDelta (from 1) and a zero address delta.
- MCDwarfLineAddr::Emit(MCOS, LineDelta, 0);
- }
- else {
- // Create an expression for the address delta from the LastLabel and
- // this Label (plus 0).
- const MCExpr *AddrDelta = MakeStartMinusEndExpr(MCOS, LastLabel, Label,0);
- // Create a Dwarf Line fragment for the LineDelta and AddrDelta.
- new MCDwarfLineAddrFragment(LineDelta, *AddrDelta, DLS);
- }
+ MCOS->EmitDwarfAdvanceLineAddr(LineDelta, LastLabel, Label);
LastLine = it->getLine();
LastLabel = Label;
@@ -220,19 +191,7 @@
// Switch back the the dwarf line section.
MCOS->SwitchSection(DwarfLineSection);
- if (DLS == NULL) {
- // emit the sequence to set the address
- EmitDwarfSetAddress(MCOS, SectionEnd, PointerSize);
- // emit the sequence for the LineDelta (from 1) and a zero address delta.
- MCDwarfLineAddr::Emit(MCOS, INT64_MAX, 0);
- } else {
- // Create an expression for the address delta from the LastLabel and this
- // SectionEnd label.
- const MCExpr *AddrDelta = MakeStartMinusEndExpr(MCOS, LastLabel, SectionEnd,
- 0);
- // Create a Dwarf Line fragment for the LineDelta and AddrDelta.
- new MCDwarfLineAddrFragment(INT64_MAX, *AddrDelta, DLS);
- }
+ MCOS->EmitDwarfAdvanceLineAddr(INT64_MAX, LastLabel, SectionEnd);
}
//
@@ -240,8 +199,6 @@
//
void MCDwarfFileTable::Emit(MCStreamer *MCOS,
const MCSection *DwarfLineSection,
- MCSectionData *DLS,
- int PointerSize,
const MCSection *TextSection) {
// Switch to the section where the table will be emitted into.
MCOS->SwitchSection(DwarfLineSection);
@@ -332,8 +289,7 @@
++it) {
const MCSection *Sec = *it;
const MCLineSection *Line = MCLineSections.lookup(Sec);
- EmitDwarfLineTable(MCOS, Sec, Line, DwarfLineSection, DLS,
- PointerSize);
+ EmitDwarfLineTable(MCOS, Sec, Line, DwarfLineSection);
// Now delete the MCLineSections that were created in MCLineEntry::Make()
// and used to emit the line table.
@@ -351,10 +307,7 @@
// Switch back the the dwarf line section.
MCOS->SwitchSection(DwarfLineSection);
- // emit the sequence to set the address
- EmitDwarfSetAddress(MCOS, SectionEnd, PointerSize);
- // emit the sequence for the LineDelta (from 1) and a zero address delta.
- MCDwarfLineAddr::Emit(MCOS, INT64_MAX, 0);
+ MCOS->EmitDwarfAdvanceLineAddr(INT64_MAX, NULL, SectionEnd);
}
// This is the end of the section, so set the value of the symbol at the end
Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCELFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCELFStreamer.cpp Thu Dec 2 18:55:40 2010
@@ -484,10 +484,7 @@
const MCSection *DwarfLineSection =
getContext().getELFSection(".debug_line", 0, 0,
SectionKind::getDataRelLocal());
- MCSectionData &DLS =
- getAssembler().getOrCreateSectionData(*DwarfLineSection);
- int PointerSize = getAssembler().getBackend().getPointerSize();
- MCDwarfFileTable::Emit(this, DwarfLineSection, &DLS, PointerSize);
+ MCDwarfFileTable::Emit(this, DwarfLineSection);
}
for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(),
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Thu Dec 2 18:55:40 2010
@@ -237,7 +237,24 @@
/* *** */
-bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout) const {
+bool MCExpr::EvaluateAsAbsolute(int64_t &Res) const {
+ return EvaluateAsAbsolute(Res, 0, 0);
+}
+
+bool MCExpr::EvaluateAsAbsolute(int64_t &Res,
+ const MCAsmLayout *Layout) const {
+ if (Layout)
+ return EvaluateAsAbsolute(Res, &Layout->getAssembler(), Layout);
+ else
+ return EvaluateAsAbsolute(Res, 0, 0);
+}
+
+bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const {
+ return EvaluateAsAbsolute(Res, Asm, 0);
+}
+
+bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
+ const MCAsmLayout *Layout) const {
MCValue Value;
// Fast path constants.
@@ -246,7 +263,8 @@
return true;
}
- if (!EvaluateAsRelocatable(Value, Layout) || !Value.isAbsolute()) {
+ if (!EvaluateAsRelocatableImpl(Value, Asm, Layout, false) ||
+ !Value.isAbsolute()) {
// EvaluateAsAbsolute is defined to return the "current value" of
// the expression if we are given a Layout object, even in cases
// when the value is not fixed.
@@ -268,7 +286,9 @@
return true;
}
-static bool EvaluateSymbolicAdd(const MCAsmLayout *Layout, bool InSet,
+static bool EvaluateSymbolicAdd(const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
+ bool InSet,
const MCValue &LHS,const MCSymbolRefExpr *RHS_A,
const MCSymbolRefExpr *RHS_B, int64_t RHS_Cst,
MCValue &Res) {
@@ -291,14 +311,15 @@
// Absolutize symbol differences between defined symbols when we have a
// layout object and the target requests it.
- if (Layout && A && B) {
+ assert(!(Layout && !Asm));
+
+ if ((Layout || Asm) && A && B) {
const MCSymbol &SA = A->getSymbol();
const MCSymbol &SB = B->getSymbol();
- const MCAssembler &Asm = Layout->getAssembler();
- const MCObjectFormat &F = Asm.getBackend().getObjectFormat();
+ const MCObjectFormat &F = Asm->getBackend().getObjectFormat();
if (SA.isDefined() && SB.isDefined() && F.isAbsolute(InSet, SA, SB)) {
- MCSymbolData &AD = Asm.getSymbolData(A->getSymbol());
- MCSymbolData &BD = Asm.getSymbolData(B->getSymbol());
+ MCSymbolData &AD = Asm->getSymbolData(A->getSymbol());
+ MCSymbolData &BD = Asm->getSymbolData(B->getSymbol());
if (AD.getFragment() == BD.getFragment()) {
Res = MCValue::get(+ AD.getOffset()
@@ -308,25 +329,31 @@
return true;
}
- Res = MCValue::get(+ Layout->getSymbolAddress(&AD)
- - Layout->getSymbolAddress(&BD)
- + LHS.getConstant()
- + RHS_Cst);
- return true;
+ if (Layout) {
+ Res = MCValue::get(+ Layout->getSymbolAddress(&AD)
+ - Layout->getSymbolAddress(&BD)
+ + LHS.getConstant()
+ + RHS_Cst);
+ return true;
+ }
}
}
-
Res = MCValue::get(A, B, LHS.getConstant() + RHS_Cst);
return true;
}
bool MCExpr::EvaluateAsRelocatable(MCValue &Res,
const MCAsmLayout *Layout) const {
- return EvaluateAsRelocatableImpl(Res, Layout, false);
+ if (Layout)
+ return EvaluateAsRelocatableImpl(Res, &Layout->getAssembler(), Layout,
+ false);
+ else
+ return EvaluateAsRelocatableImpl(Res, 0, 0, false);
}
bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
+ const MCAssembler *Asm,
const MCAsmLayout *Layout,
bool InSet) const {
++stats::MCExprEvaluate;
@@ -345,7 +372,8 @@
// Evaluate recursively if this is a variable.
if (Sym.isVariable() && SRE->getKind() == MCSymbolRefExpr::VK_None) {
- bool Ret = Sym.getVariableValue()->EvaluateAsRelocatableImpl(Res, Layout,
+ bool Ret = Sym.getVariableValue()->EvaluateAsRelocatableImpl(Res, Asm,
+ Layout,
true);
// If we failed to simplify this to a constant, let the target
// handle it.
@@ -361,7 +389,8 @@
const MCUnaryExpr *AUE = cast<MCUnaryExpr>(this);
MCValue Value;
- if (!AUE->getSubExpr()->EvaluateAsRelocatableImpl(Value, Layout, InSet))
+ if (!AUE->getSubExpr()->EvaluateAsRelocatableImpl(Value, Asm, Layout,
+ InSet))
return false;
switch (AUE->getOpcode()) {
@@ -394,8 +423,10 @@
const MCBinaryExpr *ABE = cast<MCBinaryExpr>(this);
MCValue LHSValue, RHSValue;
- if (!ABE->getLHS()->EvaluateAsRelocatableImpl(LHSValue, Layout, InSet) ||
- !ABE->getRHS()->EvaluateAsRelocatableImpl(RHSValue, Layout, InSet))
+ if (!ABE->getLHS()->EvaluateAsRelocatableImpl(LHSValue, Asm, Layout,
+ InSet) ||
+ !ABE->getRHS()->EvaluateAsRelocatableImpl(RHSValue, Asm, Layout,
+ InSet))
return false;
// We only support a few operations on non-constant expressions, handle
@@ -406,13 +437,13 @@
return false;
case MCBinaryExpr::Sub:
// Negate RHS and add.
- return EvaluateSymbolicAdd(Layout, InSet, LHSValue,
+ return EvaluateSymbolicAdd(Layout, Asm, InSet, LHSValue,
RHSValue.getSymB(), RHSValue.getSymA(),
-RHSValue.getConstant(),
Res);
case MCBinaryExpr::Add:
- return EvaluateSymbolicAdd(Layout, InSet, LHSValue,
+ return EvaluateSymbolicAdd(Layout, Asm, InSet, LHSValue,
RHSValue.getSymA(), RHSValue.getSymB(),
RHSValue.getConstant(),
Res);
Modified: llvm/trunk/lib/MC/MCLoggingStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCLoggingStreamer.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCLoggingStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCLoggingStreamer.cpp Thu Dec 2 18:55:40 2010
@@ -84,6 +84,13 @@
return Child->EmitWeakReference(Alias, Symbol);
}
+ virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label) {
+ LogCall("EmitDwarfAdvanceLineAddr");
+ return Child->EmitDwarfAdvanceLineAddr(LineDelta, LastLabel, Label);
+ }
+
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) {
LogCall("EmitSymbolAttribute");
return Child->EmitSymbolAttribute(Symbol, Attribute);
Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Thu Dec 2 18:55:40 2010
@@ -357,10 +357,7 @@
"__debug_line",
MCSectionMachO::S_ATTR_DEBUG,
0, SectionKind::getDataRelLocal());
- MCSectionData &DLS =
- getAssembler().getOrCreateSectionData(*DwarfLineSection);
- int PointerSize = getAssembler().getBackend().getPointerSize();
- MCDwarfFileTable::Emit(this, DwarfLineSection, &DLS, PointerSize);
+ MCDwarfFileTable::Emit(this, DwarfLineSection);
}
// We have to set the fragment atom associations so we can relax properly for
Modified: llvm/trunk/lib/MC/MCNullStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCNullStreamer.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCNullStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCNullStreamer.cpp Thu Dec 2 18:55:40 2010
@@ -44,6 +44,9 @@
virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) {}
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol){}
+ virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label) {}
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute){}
Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Thu Dec 2 18:55:40 2010
@@ -179,6 +179,30 @@
getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, IF->getFixups());
}
+void MCObjectStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label) {
+ if (!LastLabel) {
+ int PointerSize = getAssembler().getBackend().getPointerSize();
+ EmitDwarfSetLineAddr(LineDelta, Label, PointerSize);
+ return;
+ }
+ MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
+ const MCExpr *LabelRef =
+ MCSymbolRefExpr::Create(Label, Variant, getContext());
+ const MCExpr *LastLabelRef =
+ MCSymbolRefExpr::Create(LastLabel, Variant, getContext());
+ const MCExpr *AddrDelta =
+ MCBinaryExpr::Create(MCBinaryExpr::Sub, LabelRef, LastLabelRef,
+ getContext());
+ int64_t Res;
+ if (AddrDelta->EvaluateAsAbsolute(Res, &getAssembler())) {
+ MCDwarfLineAddr::Emit(this, LineDelta, Res);
+ return;
+ }
+ new MCDwarfLineAddrFragment(LineDelta, *AddrDelta, getCurrentSectionData());
+}
+
void MCObjectStreamer::EmitValueToOffset(const MCExpr *Offset,
unsigned char Value) {
new MCOrgFragment(*Offset, Value, getCurrentSectionData());
Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Thu Dec 2 18:55:40 2010
@@ -30,6 +30,17 @@
return nulls();
}
+void MCStreamer::EmitDwarfSetLineAddr(int64_t LineDelta,
+ const MCSymbol *Label, int PointerSize) {
+ // emit the sequence to set the address
+ EmitIntValue(dwarf::DW_LNS_extended_op, 1);
+ EmitULEB128IntValue(PointerSize + 1);
+ EmitIntValue(dwarf::DW_LNE_set_address, 1);
+ EmitSymbolValue(Label, PointerSize);
+
+ // emit the sequence for the LineDelta (from 1) and a zero address delta.
+ MCDwarfLineAddr::Emit(this, LineDelta, 0);
+}
/// EmitIntValue - Special case of EmitValue that avoids the client having to
/// pass in a MCExpr for constant integers.
Modified: llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp?rev=120767&r1=120766&r2=120767&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/Target/PTX/PTXMCAsmStreamer.cpp Thu Dec 2 18:55:40 2010
@@ -118,6 +118,10 @@
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
+ virtual void EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label);
+
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue);
@@ -263,6 +267,12 @@
EmitEOL();
}
+void PTXMCAsmStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta,
+ const MCSymbol *LastLabel,
+ const MCSymbol *Label) {
+ report_fatal_error("Unimplemented.");
+}
+
void PTXMCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) {}
More information about the llvm-commits
mailing list