Daniel Dunbar | 8a3c9d9 | 2010-06-16 20:04:22 +0000 | [diff] [blame] | 1 | //===- lib/MC/MCObjectStreamer.cpp - Object File MCStreamer Interface -----===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "llvm/MC/MCObjectStreamer.h" |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 11 | #include "llvm/ADT/STLExtras.h" |
Craig Topper | 6e80c28 | 2012-03-26 06:58:25 +0000 | [diff] [blame] | 12 | #include "llvm/MC/MCAsmBackend.h" |
| 13 | #include "llvm/MC/MCAsmInfo.h" |
Daniel Dunbar | 8a3c9d9 | 2010-06-16 20:04:22 +0000 | [diff] [blame] | 14 | #include "llvm/MC/MCAssembler.h" |
Benjamin Kramer | a3e0ddb | 2010-07-29 17:48:06 +0000 | [diff] [blame] | 15 | #include "llvm/MC/MCCodeEmitter.h" |
Rafael Espindola | 0a017a6 | 2010-12-10 07:39:47 +0000 | [diff] [blame] | 16 | #include "llvm/MC/MCContext.h" |
Rafael Espindola | 72b5488 | 2010-11-01 16:27:31 +0000 | [diff] [blame] | 17 | #include "llvm/MC/MCDwarf.h" |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 18 | #include "llvm/MC/MCExpr.h" |
Craig Topper | 6e80c28 | 2012-03-26 06:58:25 +0000 | [diff] [blame] | 19 | #include "llvm/MC/MCObjectWriter.h" |
Serge Pavlov | 24a3ebb | 2013-06-27 14:35:03 +0000 | [diff] [blame] | 20 | #include "llvm/MC/MCSection.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 21 | #include "llvm/MC/MCSymbol.h" |
Craig Topper | 6e80c28 | 2012-03-26 06:58:25 +0000 | [diff] [blame] | 22 | #include "llvm/Support/ErrorHandling.h" |
Rafael Espindola | 105270f | 2015-03-18 19:08:20 +0000 | [diff] [blame] | 23 | #include "llvm/Support/TargetRegistry.h" |
Daniel Dunbar | 8a3c9d9 | 2010-06-16 20:04:22 +0000 | [diff] [blame] | 24 | using namespace llvm; |
| 25 | |
Rafael Espindola | 24ea09e | 2014-01-26 06:06:37 +0000 | [diff] [blame] | 26 | MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, |
Rafael Espindola | 5560a4c | 2015-04-14 22:14:34 +0000 | [diff] [blame] | 27 | raw_pwrite_stream &OS, |
| 28 | MCCodeEmitter *Emitter_) |
Rafael Espindola | 24ea09e | 2014-01-26 06:06:37 +0000 | [diff] [blame] | 29 | : MCStreamer(Context), |
Chandler Carruth | de093ef | 2013-01-31 23:29:57 +0000 | [diff] [blame] | 30 | Assembler(new MCAssembler(Context, TAB, *Emitter_, |
David Majnemer | 83c862a | 2015-09-01 23:19:38 +0000 | [diff] [blame] | 31 | *TAB.createObjectWriter(OS))), |
Rafael Espindola | 2f9bdd8 | 2015-05-27 20:52:32 +0000 | [diff] [blame] | 32 | EmitEHFrame(true), EmitDebugFrame(false) {} |
Daniel Dunbar | 8a3c9d9 | 2010-06-16 20:04:22 +0000 | [diff] [blame] | 33 | |
| 34 | MCObjectStreamer::~MCObjectStreamer() { |
Benjamin Kramer | a3e0ddb | 2010-07-29 17:48:06 +0000 | [diff] [blame] | 35 | delete &Assembler->getBackend(); |
| 36 | delete &Assembler->getEmitter(); |
Daniel Dunbar | 42a037a | 2010-12-17 02:45:41 +0000 | [diff] [blame] | 37 | delete &Assembler->getWriter(); |
Daniel Dunbar | 8a3c9d9 | 2010-06-16 20:04:22 +0000 | [diff] [blame] | 38 | delete Assembler; |
| 39 | } |
Daniel Dunbar | b2347fe | 2010-06-16 20:04:25 +0000 | [diff] [blame] | 40 | |
Petr Hosek | 9e0c890 | 2015-04-12 23:42:25 +0000 | [diff] [blame] | 41 | void MCObjectStreamer::flushPendingLabels(MCFragment *F, uint64_t FOffset) { |
Rafael Espindola | 81413c0 | 2015-10-03 00:57:12 +0000 | [diff] [blame] | 42 | if (PendingLabels.empty()) |
| 43 | return; |
| 44 | if (!F) { |
| 45 | F = new MCDataFragment(); |
| 46 | MCSection *CurSection = getCurrentSectionOnly(); |
| 47 | CurSection->getFragmentList().insert(CurInsertionPoint, F); |
| 48 | F->setParent(CurSection); |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 49 | } |
Rafael Espindola | 81413c0 | 2015-10-03 00:57:12 +0000 | [diff] [blame] | 50 | for (MCSymbol *Sym : PendingLabels) { |
| 51 | Sym->setFragment(F); |
| 52 | Sym->setOffset(FOffset); |
| 53 | } |
| 54 | PendingLabels.clear(); |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 55 | } |
| 56 | |
Rafael Espindola | 7c6e6e4 | 2015-06-11 18:58:08 +0000 | [diff] [blame] | 57 | void MCObjectStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi, |
Duncan P. N. Exon Smith | 0b73d71 | 2015-05-21 02:41:23 +0000 | [diff] [blame] | 58 | const MCSymbol *Lo, |
| 59 | unsigned Size) { |
Rafael Espindola | 7c6e6e4 | 2015-06-11 18:58:08 +0000 | [diff] [blame] | 60 | // If not assigned to the same (valid) fragment, fallback. |
Rafael Espindola | e3a20f5 | 2015-10-05 12:07:05 +0000 | [diff] [blame] | 61 | if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment() || |
| 62 | Hi->isVariable() || Lo->isVariable()) { |
Rafael Espindola | 7c6e6e4 | 2015-06-11 18:58:08 +0000 | [diff] [blame] | 63 | MCStreamer::emitAbsoluteSymbolDiff(Hi, Lo, Size); |
| 64 | return; |
| 65 | } |
Duncan P. N. Exon Smith | 0b73d71 | 2015-05-21 02:41:23 +0000 | [diff] [blame] | 66 | |
Rafael Espindola | 1467250 | 2015-05-29 17:48:04 +0000 | [diff] [blame] | 67 | EmitIntValue(Hi->getOffset() - Lo->getOffset(), Size); |
Duncan P. N. Exon Smith | 0b73d71 | 2015-05-21 02:41:23 +0000 | [diff] [blame] | 68 | } |
| 69 | |
Pedro Artigas | 7212ee4 | 2012-12-12 22:59:46 +0000 | [diff] [blame] | 70 | void MCObjectStreamer::reset() { |
Pedro Artigas | b95c53e | 2012-12-14 18:52:11 +0000 | [diff] [blame] | 71 | if (Assembler) |
| 72 | Assembler->reset(); |
Rafael Espindola | a32d0e9 | 2015-05-27 15:14:11 +0000 | [diff] [blame] | 73 | CurInsertionPoint = MCSection::iterator(); |
Rafael Espindola | 3dd8ef6 | 2014-05-12 14:02:44 +0000 | [diff] [blame] | 74 | EmitEHFrame = true; |
| 75 | EmitDebugFrame = false; |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 76 | PendingLabels.clear(); |
Pedro Artigas | 7212ee4 | 2012-12-12 22:59:46 +0000 | [diff] [blame] | 77 | MCStreamer::reset(); |
| 78 | } |
| 79 | |
Rafael Espindola | 3dd8ef6 | 2014-05-12 14:02:44 +0000 | [diff] [blame] | 80 | void MCObjectStreamer::EmitFrames(MCAsmBackend *MAB) { |
| 81 | if (!getNumFrameInfos()) |
| 82 | return; |
| 83 | |
| 84 | if (EmitEHFrame) |
| 85 | MCDwarfFrameEmitter::Emit(*this, MAB, true); |
| 86 | |
| 87 | if (EmitDebugFrame) |
| 88 | MCDwarfFrameEmitter::Emit(*this, MAB, false); |
| 89 | } |
| 90 | |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 91 | MCFragment *MCObjectStreamer::getCurrentFragment() const { |
Rafael Espindola | 983bec6 | 2015-05-27 21:04:14 +0000 | [diff] [blame] | 92 | assert(getCurrentSectionOnly() && "No current section!"); |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 93 | |
Rafael Espindola | 983bec6 | 2015-05-27 21:04:14 +0000 | [diff] [blame] | 94 | if (CurInsertionPoint != getCurrentSectionOnly()->getFragmentList().begin()) |
Duncan P. N. Exon Smith | a5f45da | 2015-10-10 00:13:11 +0000 | [diff] [blame] | 95 | return &*std::prev(CurInsertionPoint); |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 96 | |
Craig Topper | bb694de | 2014-04-13 04:57:38 +0000 | [diff] [blame] | 97 | return nullptr; |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 98 | } |
| 99 | |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 100 | MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() { |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 101 | MCDataFragment *F = dyn_cast_or_null<MCDataFragment>(getCurrentFragment()); |
Derek Schuff | 8878bcc9 | 2013-02-15 22:50:52 +0000 | [diff] [blame] | 102 | // When bundling is enabled, we don't want to add data to a fragment that |
| 103 | // already has instructions (see MCELFStreamer::EmitInstToData for details) |
Petr Hosek | 9e0c890 | 2015-04-12 23:42:25 +0000 | [diff] [blame] | 104 | if (!F || (Assembler->isBundlingEnabled() && !Assembler->getRelaxAll() && |
| 105 | F->hasInstructions())) { |
David Blaikie | 4d3b043 | 2014-04-10 21:53:47 +0000 | [diff] [blame] | 106 | F = new MCDataFragment(); |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 107 | insert(F); |
| 108 | } |
Michael J. Spencer | e2da0a4 | 2010-07-19 06:13:10 +0000 | [diff] [blame] | 109 | return F; |
| 110 | } |
| 111 | |
Rafael Espindola | 2be1281 | 2014-06-25 15:29:54 +0000 | [diff] [blame] | 112 | void MCObjectStreamer::visitUsedSymbol(const MCSymbol &Sym) { |
Rafael Espindola | b5d316b | 2015-05-29 20:21:02 +0000 | [diff] [blame] | 113 | Assembler->registerSymbol(Sym); |
Rafael Espindola | 2be1281 | 2014-06-25 15:29:54 +0000 | [diff] [blame] | 114 | } |
| 115 | |
Rafael Espindola | 3dd8ef6 | 2014-05-12 14:02:44 +0000 | [diff] [blame] | 116 | void MCObjectStreamer::EmitCFISections(bool EH, bool Debug) { |
| 117 | MCStreamer::EmitCFISections(EH, Debug); |
| 118 | EmitEHFrame = EH; |
| 119 | EmitDebugFrame = Debug; |
| 120 | } |
| 121 | |
Kevin Enderby | 96918bc | 2014-04-22 17:27:29 +0000 | [diff] [blame] | 122 | void MCObjectStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, |
Craig Topper | 3c76c52 | 2015-09-20 23:35:59 +0000 | [diff] [blame] | 123 | SMLoc Loc) { |
Rafael Espindola | 591c641 | 2014-06-25 18:37:33 +0000 | [diff] [blame] | 124 | MCStreamer::EmitValueImpl(Value, Size, Loc); |
Rafael Espindola | a084fd6 | 2010-11-28 23:08:47 +0000 | [diff] [blame] | 125 | MCDataFragment *DF = getOrCreateDataFragment(); |
Petr Hosek | 3294670 | 2015-06-27 01:54:17 +0000 | [diff] [blame] | 126 | flushPendingLabels(DF, DF->getContents().size()); |
Rafael Espindola | a084fd6 | 2010-11-28 23:08:47 +0000 | [diff] [blame] | 127 | |
David Majnemer | 8cc3078 | 2016-01-21 01:59:03 +0000 | [diff] [blame] | 128 | MCDwarfLineEntry::Make(this, getCurrentSection().first); |
Cameron Zwarich | 80cbcd2 | 2013-05-25 21:56:53 +0000 | [diff] [blame] | 129 | |
Rafael Espindola | a084fd6 | 2010-11-28 23:08:47 +0000 | [diff] [blame] | 130 | // Avoid fixups when possible. |
| 131 | int64_t AbsValue; |
Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 132 | if (Value->evaluateAsAbsolute(AbsValue, getAssembler())) { |
Rafael Espindola | 64e1af8 | 2013-07-02 15:49:13 +0000 | [diff] [blame] | 133 | EmitIntValue(AbsValue, Size); |
Rafael Espindola | 4c70eea | 2010-12-03 02:54:21 +0000 | [diff] [blame] | 134 | return; |
Rafael Espindola | a084fd6 | 2010-11-28 23:08:47 +0000 | [diff] [blame] | 135 | } |
Eli Bendersky | a31a894 | 2012-12-07 19:13:57 +0000 | [diff] [blame] | 136 | DF->getFixups().push_back( |
Jim Grosbach | 63661f8 | 2015-05-15 19:13:05 +0000 | [diff] [blame] | 137 | MCFixup::create(DF->getContents().size(), Value, |
Kevin Enderby | 96918bc | 2014-04-22 17:27:29 +0000 | [diff] [blame] | 138 | MCFixup::getKindForSize(Size, false), Loc)); |
Rafael Espindola | 4c70eea | 2010-12-03 02:54:21 +0000 | [diff] [blame] | 139 | DF->getContents().resize(DF->getContents().size() + Size, 0); |
Rafael Espindola | a084fd6 | 2010-11-28 23:08:47 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Oliver Stannard | cf6bfb1 | 2014-11-03 12:19:03 +0000 | [diff] [blame] | 142 | void MCObjectStreamer::EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) { |
| 143 | // We need to create a local symbol to avoid relocations. |
Jim Grosbach | 6f48200 | 2015-05-18 18:43:14 +0000 | [diff] [blame] | 144 | Frame.Begin = getContext().createTempSymbol(); |
Oliver Stannard | cf6bfb1 | 2014-11-03 12:19:03 +0000 | [diff] [blame] | 145 | EmitLabel(Frame.Begin); |
Rafael Espindola | 3824120 | 2012-01-07 22:42:19 +0000 | [diff] [blame] | 146 | } |
| 147 | |
Rafael Espindola | f28213c | 2012-01-09 00:17:29 +0000 | [diff] [blame] | 148 | void MCObjectStreamer::EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) { |
Jim Grosbach | 6f48200 | 2015-05-18 18:43:14 +0000 | [diff] [blame] | 149 | Frame.End = getContext().createTempSymbol(); |
Rafael Espindola | 49bbfd0 | 2014-06-25 00:13:59 +0000 | [diff] [blame] | 150 | EmitLabel(Frame.End); |
Rafael Espindola | f28213c | 2012-01-09 00:17:29 +0000 | [diff] [blame] | 151 | } |
| 152 | |
Rafael Espindola | e5b7415 | 2010-11-28 17:18:55 +0000 | [diff] [blame] | 153 | void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) { |
Rafael Espindola | 27c0c9b | 2011-04-27 15:21:19 +0000 | [diff] [blame] | 154 | MCStreamer::EmitLabel(Symbol); |
Rafael Espindola | e5b7415 | 2010-11-28 17:18:55 +0000 | [diff] [blame] | 155 | |
Rafael Espindola | b5d316b | 2015-05-29 20:21:02 +0000 | [diff] [blame] | 156 | getAssembler().registerSymbol(*Symbol); |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 157 | |
| 158 | // If there is a current fragment, mark the symbol as pointing into it. |
| 159 | // Otherwise queue the label and set its fragment pointer when we emit the |
| 160 | // next fragment. |
Petr Hosek | 9e0c890 | 2015-04-12 23:42:25 +0000 | [diff] [blame] | 161 | auto *F = dyn_cast_or_null<MCDataFragment>(getCurrentFragment()); |
| 162 | if (F && !(getAssembler().isBundlingEnabled() && |
| 163 | getAssembler().getRelaxAll())) { |
Rafael Espindola | 4d37b2a | 2015-05-29 21:45:01 +0000 | [diff] [blame] | 164 | Symbol->setFragment(F); |
Rafael Espindola | 1467250 | 2015-05-29 17:48:04 +0000 | [diff] [blame] | 165 | Symbol->setOffset(F->getContents().size()); |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 166 | } else { |
Rafael Espindola | 66ccf49 | 2015-05-29 17:41:59 +0000 | [diff] [blame] | 167 | PendingLabels.push_back(Symbol); |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 168 | } |
Rafael Espindola | e5b7415 | 2010-11-28 17:18:55 +0000 | [diff] [blame] | 169 | } |
| 170 | |
Rafael Espindola | 6aea592 | 2011-04-21 23:39:26 +0000 | [diff] [blame] | 171 | void MCObjectStreamer::EmitULEB128Value(const MCExpr *Value) { |
Rafael Espindola | 675fbb2 | 2010-12-03 01:19:49 +0000 | [diff] [blame] | 172 | int64_t IntValue; |
Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 173 | if (Value->evaluateAsAbsolute(IntValue, getAssembler())) { |
Rafael Espindola | 6aea592 | 2011-04-21 23:39:26 +0000 | [diff] [blame] | 174 | EmitULEB128IntValue(IntValue); |
Rafael Espindola | 675fbb2 | 2010-12-03 01:19:49 +0000 | [diff] [blame] | 175 | return; |
| 176 | } |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 177 | insert(new MCLEBFragment(*Value, false)); |
Rafael Espindola | 5e87498 | 2010-11-02 17:22:24 +0000 | [diff] [blame] | 178 | } |
| 179 | |
Rafael Espindola | 6aea592 | 2011-04-21 23:39:26 +0000 | [diff] [blame] | 180 | void MCObjectStreamer::EmitSLEB128Value(const MCExpr *Value) { |
Rafael Espindola | 675fbb2 | 2010-12-03 01:19:49 +0000 | [diff] [blame] | 181 | int64_t IntValue; |
Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 182 | if (Value->evaluateAsAbsolute(IntValue, getAssembler())) { |
Rafael Espindola | 6aea592 | 2011-04-21 23:39:26 +0000 | [diff] [blame] | 183 | EmitSLEB128IntValue(IntValue); |
Rafael Espindola | 675fbb2 | 2010-12-03 01:19:49 +0000 | [diff] [blame] | 184 | return; |
| 185 | } |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 186 | insert(new MCLEBFragment(*Value, true)); |
Rafael Espindola | 5e87498 | 2010-11-02 17:22:24 +0000 | [diff] [blame] | 187 | } |
| 188 | |
Rafael Espindola | 1614597 | 2010-11-01 14:28:48 +0000 | [diff] [blame] | 189 | void MCObjectStreamer::EmitWeakReference(MCSymbol *Alias, |
| 190 | const MCSymbol *Symbol) { |
| 191 | report_fatal_error("This file format doesn't support weak aliases."); |
| 192 | } |
| 193 | |
Rafael Espindola | 0709a7b | 2015-05-21 19:20:38 +0000 | [diff] [blame] | 194 | void MCObjectStreamer::ChangeSection(MCSection *Section, |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 195 | const MCExpr *Subsection) { |
Rafael Espindola | 36a15cb | 2015-03-20 20:00:01 +0000 | [diff] [blame] | 196 | changeSectionImpl(Section, Subsection); |
| 197 | } |
| 198 | |
Rafael Espindola | 0709a7b | 2015-05-21 19:20:38 +0000 | [diff] [blame] | 199 | bool MCObjectStreamer::changeSectionImpl(MCSection *Section, |
Rafael Espindola | 36a15cb | 2015-03-20 20:00:01 +0000 | [diff] [blame] | 200 | const MCExpr *Subsection) { |
Daniel Dunbar | b2347fe | 2010-06-16 20:04:25 +0000 | [diff] [blame] | 201 | assert(Section && "Cannot switch to a null section!"); |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 202 | flushPendingLabels(nullptr); |
Daniel Dunbar | b2347fe | 2010-06-16 20:04:25 +0000 | [diff] [blame] | 203 | |
Rafael Espindola | bb9a71c | 2015-05-26 15:07:25 +0000 | [diff] [blame] | 204 | bool Created = getAssembler().registerSection(*Section); |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 205 | |
| 206 | int64_t IntSubsection = 0; |
| 207 | if (Subsection && |
Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 208 | !Subsection->evaluateAsAbsolute(IntSubsection, getAssembler())) |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 209 | report_fatal_error("Cannot evaluate subsection number"); |
| 210 | if (IntSubsection < 0 || IntSubsection > 8192) |
| 211 | report_fatal_error("Subsection number out of range"); |
| 212 | CurInsertionPoint = |
Rafael Espindola | 2f9bdd8 | 2015-05-27 20:52:32 +0000 | [diff] [blame] | 213 | Section->getSubsectionInsertionPoint(unsigned(IntSubsection)); |
Rafael Espindola | 36a15cb | 2015-03-20 20:00:01 +0000 | [diff] [blame] | 214 | return Created; |
Daniel Dunbar | b2347fe | 2010-06-16 20:04:25 +0000 | [diff] [blame] | 215 | } |
| 216 | |
Eli Bendersky | ea2824d | 2012-12-07 17:42:41 +0000 | [diff] [blame] | 217 | void MCObjectStreamer::EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) { |
Rafael Espindola | b5d316b | 2015-05-29 20:21:02 +0000 | [diff] [blame] | 218 | getAssembler().registerSymbol(*Symbol); |
Zoran Jovanovic | 28221d8 | 2014-03-20 09:44:49 +0000 | [diff] [blame] | 219 | MCStreamer::EmitAssignment(Symbol, Value); |
Eli Bendersky | ea2824d | 2012-12-07 17:42:41 +0000 | [diff] [blame] | 220 | } |
| 221 | |
Rafael Espindola | cd62518 | 2015-05-25 18:34:26 +0000 | [diff] [blame] | 222 | bool MCObjectStreamer::mayHaveInstructions(MCSection &Sec) const { |
| 223 | return Sec.hasInstructions(); |
| 224 | } |
| 225 | |
Rafael Espindola | 591c641 | 2014-06-25 18:37:33 +0000 | [diff] [blame] | 226 | void MCObjectStreamer::EmitInstruction(const MCInst &Inst, |
| 227 | const MCSubtargetInfo &STI) { |
| 228 | MCStreamer::EmitInstruction(Inst, STI); |
Rafael Espindola | 72b5488 | 2010-11-01 16:27:31 +0000 | [diff] [blame] | 229 | |
Rafael Espindola | 983bec6 | 2015-05-27 21:04:14 +0000 | [diff] [blame] | 230 | MCSection *Sec = getCurrentSectionOnly(); |
Rafael Espindola | 3d2aeb2 | 2015-05-26 14:48:11 +0000 | [diff] [blame] | 231 | Sec->setHasInstructions(true); |
Rafael Espindola | 72b5488 | 2010-11-01 16:27:31 +0000 | [diff] [blame] | 232 | |
| 233 | // Now that a machine instruction has been assembled into this section, make |
| 234 | // a line entry for any .loc directive that has been seen. |
David Majnemer | 8cc3078 | 2016-01-21 01:59:03 +0000 | [diff] [blame] | 235 | MCDwarfLineEntry::Make(this, getCurrentSection().first); |
Rafael Espindola | 72b5488 | 2010-11-01 16:27:31 +0000 | [diff] [blame] | 236 | |
| 237 | // If this instruction doesn't need relaxation, just emit it as data. |
Eli Bendersky | f483ff9 | 2012-12-20 19:05:53 +0000 | [diff] [blame] | 238 | MCAssembler &Assembler = getAssembler(); |
| 239 | if (!Assembler.getBackend().mayNeedRelaxation(Inst)) { |
David Woodhouse | 6f3c73f | 2014-01-28 23:12:49 +0000 | [diff] [blame] | 240 | EmitInstToData(Inst, STI); |
Rafael Espindola | 72b5488 | 2010-11-01 16:27:31 +0000 | [diff] [blame] | 241 | return; |
| 242 | } |
| 243 | |
Eli Bendersky | f483ff9 | 2012-12-20 19:05:53 +0000 | [diff] [blame] | 244 | // Otherwise, relax and emit it as data if either: |
| 245 | // - The RelaxAll flag was passed |
| 246 | // - Bundling is enabled and this instruction is inside a bundle-locked |
| 247 | // group. We want to emit all such instructions into the same data |
| 248 | // fragment. |
| 249 | if (Assembler.getRelaxAll() || |
Rafael Espindola | 3d2aeb2 | 2015-05-26 14:48:11 +0000 | [diff] [blame] | 250 | (Assembler.isBundlingEnabled() && Sec->isBundleLocked())) { |
Rafael Espindola | 72b5488 | 2010-11-01 16:27:31 +0000 | [diff] [blame] | 251 | MCInst Relaxed; |
Jim Grosbach | aba3de9 | 2012-01-18 18:52:16 +0000 | [diff] [blame] | 252 | getAssembler().getBackend().relaxInstruction(Inst, Relaxed); |
| 253 | while (getAssembler().getBackend().mayNeedRelaxation(Relaxed)) |
| 254 | getAssembler().getBackend().relaxInstruction(Relaxed, Relaxed); |
David Woodhouse | 6f3c73f | 2014-01-28 23:12:49 +0000 | [diff] [blame] | 255 | EmitInstToData(Relaxed, STI); |
Rafael Espindola | 72b5488 | 2010-11-01 16:27:31 +0000 | [diff] [blame] | 256 | return; |
| 257 | } |
| 258 | |
| 259 | // Otherwise emit to a separate fragment. |
David Woodhouse | 6f3c73f | 2014-01-28 23:12:49 +0000 | [diff] [blame] | 260 | EmitInstToFragment(Inst, STI); |
Rafael Espindola | 72b5488 | 2010-11-01 16:27:31 +0000 | [diff] [blame] | 261 | } |
| 262 | |
David Woodhouse | 6f3c73f | 2014-01-28 23:12:49 +0000 | [diff] [blame] | 263 | void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst, |
| 264 | const MCSubtargetInfo &STI) { |
Petr Hosek | 9e0c890 | 2015-04-12 23:42:25 +0000 | [diff] [blame] | 265 | if (getAssembler().getRelaxAll() && getAssembler().isBundlingEnabled()) |
| 266 | llvm_unreachable("All instructions should have already been relaxed"); |
| 267 | |
Eli Bendersky | f483ff9 | 2012-12-20 19:05:53 +0000 | [diff] [blame] | 268 | // Always create a new, separate fragment here, because its size can change |
| 269 | // during relaxation. |
David Woodhouse | f5199f6 | 2014-01-28 23:12:53 +0000 | [diff] [blame] | 270 | MCRelaxableFragment *IF = new MCRelaxableFragment(Inst, STI); |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 271 | insert(IF); |
Rafael Espindola | 3fa6fc1 | 2010-12-02 05:44:06 +0000 | [diff] [blame] | 272 | |
Eli Friedman | b2545fb | 2011-04-18 20:54:46 +0000 | [diff] [blame] | 273 | SmallString<128> Code; |
| 274 | raw_svector_ostream VecOS(Code); |
Jim Grosbach | 91df21f | 2015-05-15 19:13:16 +0000 | [diff] [blame] | 275 | getAssembler().getEmitter().encodeInstruction(Inst, VecOS, IF->getFixups(), |
David Woodhouse | 9784cef | 2014-01-28 23:13:07 +0000 | [diff] [blame] | 276 | STI); |
Eli Bendersky | a31a894 | 2012-12-07 19:13:57 +0000 | [diff] [blame] | 277 | IF->getContents().append(Code.begin(), Code.end()); |
Rafael Espindola | 3fa6fc1 | 2010-12-02 05:44:06 +0000 | [diff] [blame] | 278 | } |
| 279 | |
Matt Beaumont-Gay | 5ae7208 | 2013-02-15 23:12:33 +0000 | [diff] [blame] | 280 | #ifndef NDEBUG |
Craig Topper | d3a34f8 | 2013-07-16 01:17:10 +0000 | [diff] [blame] | 281 | static const char *const BundlingNotImplementedMsg = |
Eli Bendersky | f483ff9 | 2012-12-20 19:05:53 +0000 | [diff] [blame] | 282 | "Aligned bundling is not implemented for this object format"; |
Matt Beaumont-Gay | 5ae7208 | 2013-02-15 23:12:33 +0000 | [diff] [blame] | 283 | #endif |
Eli Bendersky | f483ff9 | 2012-12-20 19:05:53 +0000 | [diff] [blame] | 284 | |
| 285 | void MCObjectStreamer::EmitBundleAlignMode(unsigned AlignPow2) { |
| 286 | llvm_unreachable(BundlingNotImplementedMsg); |
| 287 | } |
| 288 | |
Eli Bendersky | 802b628 | 2013-01-07 21:51:08 +0000 | [diff] [blame] | 289 | void MCObjectStreamer::EmitBundleLock(bool AlignToEnd) { |
Eli Bendersky | f483ff9 | 2012-12-20 19:05:53 +0000 | [diff] [blame] | 290 | llvm_unreachable(BundlingNotImplementedMsg); |
| 291 | } |
| 292 | |
| 293 | void MCObjectStreamer::EmitBundleUnlock() { |
| 294 | llvm_unreachable(BundlingNotImplementedMsg); |
| 295 | } |
| 296 | |
Ulrich Weigand | 64f4405 | 2013-06-19 21:27:27 +0000 | [diff] [blame] | 297 | void MCObjectStreamer::EmitDwarfLocDirective(unsigned FileNo, unsigned Line, |
| 298 | unsigned Column, unsigned Flags, |
| 299 | unsigned Isa, |
| 300 | unsigned Discriminator, |
| 301 | StringRef FileName) { |
| 302 | // In case we see two .loc directives in a row, make sure the |
| 303 | // first one gets a line entry. |
David Majnemer | 8cc3078 | 2016-01-21 01:59:03 +0000 | [diff] [blame] | 304 | MCDwarfLineEntry::Make(this, getCurrentSection().first); |
Ulrich Weigand | 64f4405 | 2013-06-19 21:27:27 +0000 | [diff] [blame] | 305 | |
| 306 | this->MCStreamer::EmitDwarfLocDirective(FileNo, Line, Column, Flags, |
| 307 | Isa, Discriminator, FileName); |
| 308 | } |
| 309 | |
Rafael Espindola | 3851808 | 2014-08-15 14:31:47 +0000 | [diff] [blame] | 310 | static const MCExpr *buildSymbolDiff(MCObjectStreamer &OS, const MCSymbol *A, |
| 311 | const MCSymbol *B) { |
| 312 | MCContext &Context = OS.getContext(); |
| 313 | MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None; |
Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 314 | const MCExpr *ARef = MCSymbolRefExpr::create(A, Variant, Context); |
| 315 | const MCExpr *BRef = MCSymbolRefExpr::create(B, Variant, Context); |
Rafael Espindola | 3851808 | 2014-08-15 14:31:47 +0000 | [diff] [blame] | 316 | const MCExpr *AddrDelta = |
Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 317 | MCBinaryExpr::create(MCBinaryExpr::Sub, ARef, BRef, Context); |
Rafael Espindola | 3851808 | 2014-08-15 14:31:47 +0000 | [diff] [blame] | 318 | return AddrDelta; |
| 319 | } |
| 320 | |
Frederic Riss | a5ab844 | 2015-08-07 15:14:08 +0000 | [diff] [blame] | 321 | static void emitDwarfSetLineAddr(MCObjectStreamer &OS, |
| 322 | MCDwarfLineTableParams Params, |
| 323 | int64_t LineDelta, const MCSymbol *Label, |
| 324 | int PointerSize) { |
Rafael Espindola | 5e955fb | 2014-08-15 14:43:02 +0000 | [diff] [blame] | 325 | // emit the sequence to set the address |
| 326 | OS.EmitIntValue(dwarf::DW_LNS_extended_op, 1); |
| 327 | OS.EmitULEB128IntValue(PointerSize + 1); |
| 328 | OS.EmitIntValue(dwarf::DW_LNE_set_address, 1); |
| 329 | OS.EmitSymbolValue(Label, PointerSize); |
| 330 | |
| 331 | // emit the sequence for the LineDelta (from 1) and a zero address delta. |
Frederic Riss | a5ab844 | 2015-08-07 15:14:08 +0000 | [diff] [blame] | 332 | MCDwarfLineAddr::Emit(&OS, Params, LineDelta, 0); |
Rafael Espindola | 5e955fb | 2014-08-15 14:43:02 +0000 | [diff] [blame] | 333 | } |
| 334 | |
Rafael Espindola | 57ab708 | 2010-12-03 00:55:40 +0000 | [diff] [blame] | 335 | void MCObjectStreamer::EmitDwarfAdvanceLineAddr(int64_t LineDelta, |
| 336 | const MCSymbol *LastLabel, |
Evan Cheng | c7ac690 | 2011-07-14 05:43:07 +0000 | [diff] [blame] | 337 | const MCSymbol *Label, |
| 338 | unsigned PointerSize) { |
Rafael Espindola | 57ab708 | 2010-12-03 00:55:40 +0000 | [diff] [blame] | 339 | if (!LastLabel) { |
Frederic Riss | a5ab844 | 2015-08-07 15:14:08 +0000 | [diff] [blame] | 340 | emitDwarfSetLineAddr(*this, Assembler->getDWARFLinetableParams(), LineDelta, |
| 341 | Label, PointerSize); |
Rafael Espindola | 57ab708 | 2010-12-03 00:55:40 +0000 | [diff] [blame] | 342 | return; |
| 343 | } |
Rafael Espindola | 3851808 | 2014-08-15 14:31:47 +0000 | [diff] [blame] | 344 | const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel); |
Rafael Espindola | 57ab708 | 2010-12-03 00:55:40 +0000 | [diff] [blame] | 345 | int64_t Res; |
Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 346 | if (AddrDelta->evaluateAsAbsolute(Res, getAssembler())) { |
Frederic Riss | a5ab844 | 2015-08-07 15:14:08 +0000 | [diff] [blame] | 347 | MCDwarfLineAddr::Emit(this, Assembler->getDWARFLinetableParams(), LineDelta, |
| 348 | Res); |
Rafael Espindola | 57ab708 | 2010-12-03 00:55:40 +0000 | [diff] [blame] | 349 | return; |
| 350 | } |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 351 | insert(new MCDwarfLineAddrFragment(LineDelta, *AddrDelta)); |
Rafael Espindola | 57ab708 | 2010-12-03 00:55:40 +0000 | [diff] [blame] | 352 | } |
| 353 | |
Rafael Espindola | 736a35d | 2010-12-28 05:39:27 +0000 | [diff] [blame] | 354 | void MCObjectStreamer::EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel, |
| 355 | const MCSymbol *Label) { |
Rafael Espindola | 3851808 | 2014-08-15 14:31:47 +0000 | [diff] [blame] | 356 | const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel); |
Rafael Espindola | 736a35d | 2010-12-28 05:39:27 +0000 | [diff] [blame] | 357 | int64_t Res; |
Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 358 | if (AddrDelta->evaluateAsAbsolute(Res, getAssembler())) { |
Rafael Espindola | 736a35d | 2010-12-28 05:39:27 +0000 | [diff] [blame] | 359 | MCDwarfFrameEmitter::EmitAdvanceLoc(*this, Res); |
| 360 | return; |
| 361 | } |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 362 | insert(new MCDwarfCallFrameFragment(*AddrDelta)); |
Rafael Espindola | 736a35d | 2010-12-28 05:39:27 +0000 | [diff] [blame] | 363 | } |
| 364 | |
Rafael Espindola | 64e1af8 | 2013-07-02 15:49:13 +0000 | [diff] [blame] | 365 | void MCObjectStreamer::EmitBytes(StringRef Data) { |
David Majnemer | 8cc3078 | 2016-01-21 01:59:03 +0000 | [diff] [blame] | 366 | MCDwarfLineEntry::Make(this, getCurrentSection().first); |
Petr Hosek | 3294670 | 2015-06-27 01:54:17 +0000 | [diff] [blame] | 367 | MCDataFragment *DF = getOrCreateDataFragment(); |
| 368 | flushPendingLabels(DF, DF->getContents().size()); |
| 369 | DF->getContents().append(Data.begin(), Data.end()); |
Benjamin Kramer | 64ddcb0 | 2012-10-04 13:12:43 +0000 | [diff] [blame] | 370 | } |
| 371 | |
| 372 | void MCObjectStreamer::EmitValueToAlignment(unsigned ByteAlignment, |
| 373 | int64_t Value, |
| 374 | unsigned ValueSize, |
| 375 | unsigned MaxBytesToEmit) { |
| 376 | if (MaxBytesToEmit == 0) |
| 377 | MaxBytesToEmit = ByteAlignment; |
Peter Collingbourne | 2f495b9 | 2013-04-17 21:18:16 +0000 | [diff] [blame] | 378 | insert(new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit)); |
Benjamin Kramer | 64ddcb0 | 2012-10-04 13:12:43 +0000 | [diff] [blame] | 379 | |
| 380 | // Update the maximum alignment on the current section if necessary. |
Rafael Espindola | 967d6a6 | 2015-05-21 21:02:35 +0000 | [diff] [blame] | 381 | MCSection *CurSec = getCurrentSection().first; |
| 382 | if (ByteAlignment > CurSec->getAlignment()) |
| 383 | CurSec->setAlignment(ByteAlignment); |
Benjamin Kramer | 64ddcb0 | 2012-10-04 13:12:43 +0000 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment, |
| 387 | unsigned MaxBytesToEmit) { |
| 388 | EmitValueToAlignment(ByteAlignment, 0, 1, MaxBytesToEmit); |
| 389 | cast<MCAlignFragment>(getCurrentFragment())->setEmitNops(true); |
| 390 | } |
| 391 | |
Rafael Espindola | 7ae65d8 | 2015-11-04 23:59:18 +0000 | [diff] [blame] | 392 | void MCObjectStreamer::emitValueToOffset(const MCExpr *Offset, |
Jim Grosbach | 5aac954 | 2012-01-26 23:47:45 +0000 | [diff] [blame] | 393 | unsigned char Value) { |
Rafael Espindola | 04d3926 | 2015-11-04 23:50:29 +0000 | [diff] [blame] | 394 | insert(new MCOrgFragment(*Offset, Value)); |
Rafael Espindola | 9065bfc6 | 2010-12-02 05:59:38 +0000 | [diff] [blame] | 395 | } |
| 396 | |
Akira Hatanaka | f5ddf13 | 2011-11-23 22:18:04 +0000 | [diff] [blame] | 397 | // Associate GPRel32 fixup with data and resize data area |
| 398 | void MCObjectStreamer::EmitGPRel32Value(const MCExpr *Value) { |
| 399 | MCDataFragment *DF = getOrCreateDataFragment(); |
Petr Hosek | 3294670 | 2015-06-27 01:54:17 +0000 | [diff] [blame] | 400 | flushPendingLabels(DF, DF->getContents().size()); |
Akira Hatanaka | f5ddf13 | 2011-11-23 22:18:04 +0000 | [diff] [blame] | 401 | |
Jim Grosbach | 63661f8 | 2015-05-15 19:13:05 +0000 | [diff] [blame] | 402 | DF->getFixups().push_back(MCFixup::create(DF->getContents().size(), |
Eli Bendersky | a31a894 | 2012-12-07 19:13:57 +0000 | [diff] [blame] | 403 | Value, FK_GPRel_4)); |
Akira Hatanaka | f5ddf13 | 2011-11-23 22:18:04 +0000 | [diff] [blame] | 404 | DF->getContents().resize(DF->getContents().size() + 4, 0); |
| 405 | } |
| 406 | |
Jack Carter | 77064c0 | 2012-08-22 00:49:30 +0000 | [diff] [blame] | 407 | // Associate GPRel32 fixup with data and resize data area |
| 408 | void MCObjectStreamer::EmitGPRel64Value(const MCExpr *Value) { |
| 409 | MCDataFragment *DF = getOrCreateDataFragment(); |
Petr Hosek | 3294670 | 2015-06-27 01:54:17 +0000 | [diff] [blame] | 410 | flushPendingLabels(DF, DF->getContents().size()); |
Jack Carter | 77064c0 | 2012-08-22 00:49:30 +0000 | [diff] [blame] | 411 | |
Jim Grosbach | 63661f8 | 2015-05-15 19:13:05 +0000 | [diff] [blame] | 412 | DF->getFixups().push_back(MCFixup::create(DF->getContents().size(), |
Eli Bendersky | a31a894 | 2012-12-07 19:13:57 +0000 | [diff] [blame] | 413 | Value, FK_GPRel_4)); |
Jack Carter | 77064c0 | 2012-08-22 00:49:30 +0000 | [diff] [blame] | 414 | DF->getContents().resize(DF->getContents().size() + 8, 0); |
| 415 | } |
| 416 | |
Daniel Sanders | 9f6ad49 | 2015-11-12 13:33:00 +0000 | [diff] [blame] | 417 | bool MCObjectStreamer::EmitRelocDirective(const MCExpr &Offset, StringRef Name, |
| 418 | const MCExpr *Expr, SMLoc Loc) { |
| 419 | int64_t OffsetValue; |
| 420 | if (!Offset.evaluateAsAbsolute(OffsetValue)) |
| 421 | llvm_unreachable("Offset is not absolute"); |
| 422 | |
David Majnemer | ce10842 | 2016-01-19 23:05:27 +0000 | [diff] [blame] | 423 | if (OffsetValue < 0) |
| 424 | llvm_unreachable("Offset is negative"); |
| 425 | |
Daniel Sanders | 9f6ad49 | 2015-11-12 13:33:00 +0000 | [diff] [blame] | 426 | MCDataFragment *DF = getOrCreateDataFragment(); |
| 427 | flushPendingLabels(DF, DF->getContents().size()); |
| 428 | |
David Majnemer | ce10842 | 2016-01-19 23:05:27 +0000 | [diff] [blame] | 429 | Optional<MCFixupKind> MaybeKind = Assembler->getBackend().getFixupKind(Name); |
| 430 | if (!MaybeKind.hasValue()) |
Daniel Sanders | 9f6ad49 | 2015-11-12 13:33:00 +0000 | [diff] [blame] | 431 | return true; |
| 432 | |
David Majnemer | ce10842 | 2016-01-19 23:05:27 +0000 | [diff] [blame] | 433 | MCFixupKind Kind = *MaybeKind; |
| 434 | |
Daniel Sanders | 9f6ad49 | 2015-11-12 13:33:00 +0000 | [diff] [blame] | 435 | if (Expr == nullptr) |
| 436 | Expr = |
| 437 | MCSymbolRefExpr::create(getContext().createTempSymbol(), getContext()); |
| 438 | DF->getFixups().push_back(MCFixup::create(OffsetValue, Expr, Kind, Loc)); |
| 439 | return false; |
| 440 | } |
| 441 | |
Rafael Espindola | 64e1af8 | 2013-07-02 15:49:13 +0000 | [diff] [blame] | 442 | void MCObjectStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) { |
Michael Ilseman | 5be22a1 | 2014-12-12 21:48:03 +0000 | [diff] [blame] | 443 | const MCSection *Sec = getCurrentSection().first; |
Rafael Espindola | 1a7e8b4 | 2016-01-19 16:57:08 +0000 | [diff] [blame] | 444 | (void)Sec; |
Michael Ilseman | 5be22a1 | 2014-12-12 21:48:03 +0000 | [diff] [blame] | 445 | assert(Sec && "need a section"); |
Rafael Espindola | 1a7e8b4 | 2016-01-19 16:57:08 +0000 | [diff] [blame] | 446 | insert(new MCFillFragment(FillValue, NumBytes)); |
Serge Pavlov | 24a3ebb | 2013-06-27 14:35:03 +0000 | [diff] [blame] | 447 | } |
| 448 | |
Rafael Espindola | 0708209 | 2012-01-07 03:13:18 +0000 | [diff] [blame] | 449 | void MCObjectStreamer::FinishImpl() { |
Kevin Enderby | e7739d4 | 2011-12-09 18:09:40 +0000 | [diff] [blame] | 450 | // If we are generating dwarf for assembly source files dump out the sections. |
| 451 | if (getContext().getGenDwarfForAssembly()) |
David Blaikie | 8bf66c4 | 2014-04-01 07:35:52 +0000 | [diff] [blame] | 452 | MCGenDwarfInfo::Emit(this); |
| 453 | |
| 454 | // Dump out the dwarf file & directory tables and line tables. |
Frederic Riss | a5ab844 | 2015-08-07 15:14:08 +0000 | [diff] [blame] | 455 | MCDwarfLineTable::Emit(this, getAssembler().getDWARFLinetableParams()); |
Kevin Enderby | e7739d4 | 2011-12-09 18:09:40 +0000 | [diff] [blame] | 456 | |
Derek Schuff | 5f708e5 | 2014-10-22 22:38:06 +0000 | [diff] [blame] | 457 | flushPendingLabels(nullptr); |
Daniel Dunbar | b2347fe | 2010-06-16 20:04:25 +0000 | [diff] [blame] | 458 | getAssembler().Finish(); |
| 459 | } |