aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCObjectStreamer.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-12-03 00:55:40 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-12-03 00:55:40 +0000
commit32a006e606742b1c5401e49607e33717bb5441f0 (patch)
treea0f3328f54b7df420f636fcd4ece07f4accd2f6c /lib/MC/MCObjectStreamer.cpp
parent0bdf0c05b990b4f2d29719b34f4ce44f16176f09 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120767 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCObjectStreamer.cpp')
-rw-r--r--lib/MC/MCObjectStreamer.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp
index a514858545..506c963c59 100644
--- a/lib/MC/MCObjectStreamer.cpp
+++ b/lib/MC/MCObjectStreamer.cpp
@@ -179,6 +179,30 @@ void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst) {
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());