1 //===- lib/MC/MCDwarf.cpp - MCDwarf implementation ------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCAsmInfo.h"
11 #include "llvm/MC/MCDwarf.h"
12 #include "llvm/MC/MCAssembler.h"
13 #include "llvm/MC/MCStreamer.h"
14 #include "llvm/MC/MCSymbol.h"
15 #include "llvm/MC/MCExpr.h"
16 #include "llvm/MC/MCContext.h"
17 #include "llvm/MC/MCObjectWriter.h"
18 #include "llvm/ADT/SmallString.h"
19 #include "llvm/Support/Debug.h"
20 #include "llvm/Support/raw_ostream.h"
21 #include "llvm/Target/TargetAsmBackend.h"
22 #include "llvm/Target/TargetAsmInfo.h"
25 // Given a special op, return the address skip amount (in units of
26 // DWARF2_LINE_MIN_INSN_LENGTH.
27 #define SPECIAL_ADDR(op) (((op) - DWARF2_LINE_OPCODE_BASE)/DWARF2_LINE_RANGE)
29 // The maximum address skip amount that can be encoded with a special op.
30 #define MAX_SPECIAL_ADDR_DELTA SPECIAL_ADDR(255)
32 // First special line opcode - leave room for the standard opcodes.
33 // Note: If you want to change this, you'll have to update the
34 // "standard_opcode_lengths" table that is emitted in DwarfFileTable::Emit().
35 #define DWARF2_LINE_OPCODE_BASE 13
37 // Minimum line offset in a special line info. opcode. This value
38 // was chosen to give a reasonable range of values.
39 #define DWARF2_LINE_BASE -5
41 // Range of line offsets in a special line info. opcode.
42 # define DWARF2_LINE_RANGE 14
44 // Define the architecture-dependent minimum instruction length (in bytes).
45 // This value should be rather too small than too big.
46 # define DWARF2_LINE_MIN_INSN_LENGTH 1
48 // Note: when DWARF2_LINE_MIN_INSN_LENGTH == 1 which is the current setting,
49 // this routine is a nop and will be optimized away.
50 static inline uint64_t ScaleAddrDelta(uint64_t AddrDelta)
52 if (DWARF2_LINE_MIN_INSN_LENGTH == 1)
54 if (AddrDelta % DWARF2_LINE_MIN_INSN_LENGTH != 0) {
55 // TODO: report this error, but really only once.
58 return AddrDelta / DWARF2_LINE_MIN_INSN_LENGTH;
62 // This is called when an instruction is assembled into the specified section
63 // and if there is information from the last .loc directive that has yet to have
64 // a line entry made for it is made.
66 void MCLineEntry::Make(MCStreamer *MCOS, const MCSection *Section) {
67 if (!MCOS->getContext().getDwarfLocSeen())
70 // Create a symbol at in the current section for use in the line entry.
71 MCSymbol *LineSym = MCOS->getContext().CreateTempSymbol();
72 // Set the value of the symbol to use for the MCLineEntry.
73 MCOS->EmitLabel(LineSym);
75 // Get the current .loc info saved in the context.
76 const MCDwarfLoc &DwarfLoc = MCOS->getContext().getCurrentDwarfLoc();
78 // Create a (local) line entry with the symbol and the current .loc info.
79 MCLineEntry LineEntry(LineSym, DwarfLoc);
81 // clear DwarfLocSeen saying the current .loc info is now used.
82 MCOS->getContext().ClearDwarfLocSeen();
84 // Get the MCLineSection for this section, if one does not exist for this
86 const DenseMap<const MCSection *, MCLineSection *> &MCLineSections =
87 MCOS->getContext().getMCLineSections();
88 MCLineSection *LineSection = MCLineSections.lookup(Section);
90 // Create a new MCLineSection. This will be deleted after the dwarf line
91 // table is created using it by iterating through the MCLineSections
93 LineSection = new MCLineSection;
94 // Save a pointer to the new LineSection into the MCLineSections DenseMap.
95 MCOS->getContext().addMCLineSection(Section, LineSection);
98 // Add the line entry to this section's entries.
99 LineSection->addLineEntry(LineEntry);
103 // This helper routine returns an expression of End - Start + IntVal .
105 static inline const MCExpr *MakeStartMinusEndExpr(const MCStreamer &MCOS,
106 const MCSymbol &Start,
109 MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
111 MCSymbolRefExpr::Create(&End, Variant, MCOS.getContext());
113 MCSymbolRefExpr::Create(&Start, Variant, MCOS.getContext());
115 MCBinaryExpr::Create(MCBinaryExpr::Sub, Res, RHS, MCOS.getContext());
117 MCConstantExpr::Create(IntVal, MCOS.getContext());
119 MCBinaryExpr::Create(MCBinaryExpr::Sub, Res1, Res2, MCOS.getContext());
124 // This emits the Dwarf line table for the specified section from the entries
125 // in the LineSection.
127 static inline void EmitDwarfLineTable(MCStreamer *MCOS,
128 const MCSection *Section,
129 const MCLineSection *LineSection) {
130 unsigned FileNum = 1;
131 unsigned LastLine = 1;
133 unsigned Flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0;
135 MCSymbol *LastLabel = NULL;
137 // Loop through each MCLineEntry and encode the dwarf line number table.
138 for (MCLineSection::const_iterator
139 it = LineSection->getMCLineEntries()->begin(),
140 ie = LineSection->getMCLineEntries()->end(); it != ie; ++it) {
142 if (FileNum != it->getFileNum()) {
143 FileNum = it->getFileNum();
144 MCOS->EmitIntValue(dwarf::DW_LNS_set_file, 1);
145 MCOS->EmitULEB128IntValue(FileNum);
147 if (Column != it->getColumn()) {
148 Column = it->getColumn();
149 MCOS->EmitIntValue(dwarf::DW_LNS_set_column, 1);
150 MCOS->EmitULEB128IntValue(Column);
152 if (Isa != it->getIsa()) {
154 MCOS->EmitIntValue(dwarf::DW_LNS_set_isa, 1);
155 MCOS->EmitULEB128IntValue(Isa);
157 if ((it->getFlags() ^ Flags) & DWARF2_FLAG_IS_STMT) {
158 Flags = it->getFlags();
159 MCOS->EmitIntValue(dwarf::DW_LNS_negate_stmt, 1);
161 if (it->getFlags() & DWARF2_FLAG_BASIC_BLOCK)
162 MCOS->EmitIntValue(dwarf::DW_LNS_set_basic_block, 1);
163 if (it->getFlags() & DWARF2_FLAG_PROLOGUE_END)
164 MCOS->EmitIntValue(dwarf::DW_LNS_set_prologue_end, 1);
165 if (it->getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)
166 MCOS->EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
168 int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;
169 MCSymbol *Label = it->getLabel();
171 // At this point we want to emit/create the sequence to encode the delta in
172 // line numbers and the increment of the address from the previous Label
173 // and the current Label.
174 MCOS->EmitDwarfAdvanceLineAddr(LineDelta, LastLabel, Label);
176 LastLine = it->getLine();
180 // Emit a DW_LNE_end_sequence for the end of the section.
181 // Using the pointer Section create a temporary label at the end of the
182 // section and use that and the LastLabel to compute the address delta
183 // and use INT64_MAX as the line delta which is the signal that this is
184 // actually a DW_LNE_end_sequence.
186 // Switch to the section to be able to create a symbol at its end.
187 MCOS->SwitchSection(Section);
189 MCContext &context = MCOS->getContext();
190 // Create a symbol at the end of the section.
191 MCSymbol *SectionEnd = context.CreateTempSymbol();
192 // Set the value of the symbol, as we are at the end of the section.
193 MCOS->EmitLabel(SectionEnd);
195 // Switch back the the dwarf line section.
196 MCOS->SwitchSection(context.getTargetAsmInfo().getDwarfLineSection());
198 MCOS->EmitDwarfAdvanceLineAddr(INT64_MAX, LastLabel, SectionEnd);
202 // This emits the Dwarf file and the line tables.
204 void MCDwarfFileTable::Emit(MCStreamer *MCOS) {
205 MCContext &context = MCOS->getContext();
206 // Switch to the section where the table will be emitted into.
207 MCOS->SwitchSection(context.getTargetAsmInfo().getDwarfLineSection());
209 // Create a symbol at the beginning of this section.
210 MCSymbol *LineStartSym = context.CreateTempSymbol();
211 // Set the value of the symbol, as we are at the start of the section.
212 MCOS->EmitLabel(LineStartSym);
214 // Create a symbol for the end of the section (to be set when we get there).
215 MCSymbol *LineEndSym = context.CreateTempSymbol();
217 // The first 4 bytes is the total length of the information for this
218 // compilation unit (not including these 4 bytes for the length).
219 MCOS->EmitAbsValue(MakeStartMinusEndExpr(*MCOS, *LineStartSym, *LineEndSym,4),
222 // Next 2 bytes is the Version, which is Dwarf 2.
223 MCOS->EmitIntValue(2, 2);
225 // Create a symbol for the end of the prologue (to be set when we get there).
226 MCSymbol *ProEndSym = context.CreateTempSymbol(); // Lprologue_end
228 // Length of the prologue, is the next 4 bytes. Which is the start of the
229 // section to the end of the prologue. Not including the 4 bytes for the
230 // total length, the 2 bytes for the version, and these 4 bytes for the
231 // length of the prologue.
232 MCOS->EmitAbsValue(MakeStartMinusEndExpr(*MCOS, *LineStartSym, *ProEndSym,
236 // Parameters of the state machine, are next.
237 MCOS->EmitIntValue(DWARF2_LINE_MIN_INSN_LENGTH, 1);
238 MCOS->EmitIntValue(DWARF2_LINE_DEFAULT_IS_STMT, 1);
239 MCOS->EmitIntValue(DWARF2_LINE_BASE, 1);
240 MCOS->EmitIntValue(DWARF2_LINE_RANGE, 1);
241 MCOS->EmitIntValue(DWARF2_LINE_OPCODE_BASE, 1);
243 // Standard opcode lengths
244 MCOS->EmitIntValue(0, 1); // length of DW_LNS_copy
245 MCOS->EmitIntValue(1, 1); // length of DW_LNS_advance_pc
246 MCOS->EmitIntValue(1, 1); // length of DW_LNS_advance_line
247 MCOS->EmitIntValue(1, 1); // length of DW_LNS_set_file
248 MCOS->EmitIntValue(1, 1); // length of DW_LNS_set_column
249 MCOS->EmitIntValue(0, 1); // length of DW_LNS_negate_stmt
250 MCOS->EmitIntValue(0, 1); // length of DW_LNS_set_basic_block
251 MCOS->EmitIntValue(0, 1); // length of DW_LNS_const_add_pc
252 MCOS->EmitIntValue(1, 1); // length of DW_LNS_fixed_advance_pc
253 MCOS->EmitIntValue(0, 1); // length of DW_LNS_set_prologue_end
254 MCOS->EmitIntValue(0, 1); // length of DW_LNS_set_epilogue_begin
255 MCOS->EmitIntValue(1, 1); // DW_LNS_set_isa
257 // Put out the directory and file tables.
259 // First the directory table.
260 const std::vector<StringRef> &MCDwarfDirs =
261 context.getMCDwarfDirs();
262 for (unsigned i = 0; i < MCDwarfDirs.size(); i++) {
263 MCOS->EmitBytes(MCDwarfDirs[i], 0); // the DirectoryName
264 MCOS->EmitBytes(StringRef("\0", 1), 0); // the null term. of the string
266 MCOS->EmitIntValue(0, 1); // Terminate the directory list
268 // Second the file table.
269 const std::vector<MCDwarfFile *> &MCDwarfFiles =
270 MCOS->getContext().getMCDwarfFiles();
271 for (unsigned i = 1; i < MCDwarfFiles.size(); i++) {
272 MCOS->EmitBytes(MCDwarfFiles[i]->getName(), 0); // FileName
273 MCOS->EmitBytes(StringRef("\0", 1), 0); // the null term. of the string
275 MCOS->EmitULEB128IntValue(MCDwarfFiles[i]->getDirIndex());
276 MCOS->EmitIntValue(0, 1); // last modification timestamp (always 0)
277 MCOS->EmitIntValue(0, 1); // filesize (always 0)
279 MCOS->EmitIntValue(0, 1); // Terminate the file list
281 // This is the end of the prologue, so set the value of the symbol at the
282 // end of the prologue (that was used in a previous expression).
283 MCOS->EmitLabel(ProEndSym);
285 // Put out the line tables.
286 const DenseMap<const MCSection *, MCLineSection *> &MCLineSections =
287 MCOS->getContext().getMCLineSections();
288 const std::vector<const MCSection *> &MCLineSectionOrder =
289 MCOS->getContext().getMCLineSectionOrder();
290 for (std::vector<const MCSection*>::const_iterator it =
291 MCLineSectionOrder.begin(), ie = MCLineSectionOrder.end(); it != ie;
293 const MCSection *Sec = *it;
294 const MCLineSection *Line = MCLineSections.lookup(Sec);
295 EmitDwarfLineTable(MCOS, Sec, Line);
297 // Now delete the MCLineSections that were created in MCLineEntry::Make()
298 // and used to emit the line table.
302 if (MCOS->getContext().getAsmInfo().getLinkerRequiresNonEmptyDwarfLines()
303 && MCLineSectionOrder.begin() == MCLineSectionOrder.end()) {
304 // The darwin9 linker has a bug (see PR8715). For for 32-bit architectures
306 // total_length >= prologue_length + 10
307 // We are 4 bytes short, since we have total_length = 51 and
308 // prologue_length = 45
310 // The regular end_sequence should be sufficient.
311 MCDwarfLineAddr::Emit(MCOS, INT64_MAX, 0);
314 // This is the end of the section, so set the value of the symbol at the end
315 // of this section (that was used in a previous expression).
316 MCOS->EmitLabel(LineEndSym);
319 /// Utility function to write the encoding to an object writer.
320 void MCDwarfLineAddr::Write(MCObjectWriter *OW, int64_t LineDelta,
321 uint64_t AddrDelta) {
322 SmallString<256> Tmp;
323 raw_svector_ostream OS(Tmp);
324 MCDwarfLineAddr::Encode(LineDelta, AddrDelta, OS);
325 OW->WriteBytes(OS.str());
328 /// Utility function to emit the encoding to a streamer.
329 void MCDwarfLineAddr::Emit(MCStreamer *MCOS, int64_t LineDelta,
330 uint64_t AddrDelta) {
331 SmallString<256> Tmp;
332 raw_svector_ostream OS(Tmp);
333 MCDwarfLineAddr::Encode(LineDelta, AddrDelta, OS);
334 MCOS->EmitBytes(OS.str(), /*AddrSpace=*/0);
337 /// Utility function to encode a Dwarf pair of LineDelta and AddrDeltas.
338 void MCDwarfLineAddr::Encode(int64_t LineDelta, uint64_t AddrDelta,
340 uint64_t Temp, Opcode;
341 bool NeedCopy = false;
343 // Scale the address delta by the minimum instruction length.
344 AddrDelta = ScaleAddrDelta(AddrDelta);
346 // A LineDelta of INT64_MAX is a signal that this is actually a
347 // DW_LNE_end_sequence. We cannot use special opcodes here, since we want the
348 // end_sequence to emit the matrix entry.
349 if (LineDelta == INT64_MAX) {
350 if (AddrDelta == MAX_SPECIAL_ADDR_DELTA)
351 OS << char(dwarf::DW_LNS_const_add_pc);
353 OS << char(dwarf::DW_LNS_advance_pc);
355 raw_svector_ostream OSE(Tmp);
356 MCObjectWriter::EncodeULEB128(AddrDelta, OSE);
359 OS << char(dwarf::DW_LNS_extended_op);
361 OS << char(dwarf::DW_LNE_end_sequence);
365 // Bias the line delta by the base.
366 Temp = LineDelta - DWARF2_LINE_BASE;
368 // If the line increment is out of range of a special opcode, we must encode
369 // it with DW_LNS_advance_line.
370 if (Temp >= DWARF2_LINE_RANGE) {
371 OS << char(dwarf::DW_LNS_advance_line);
373 raw_svector_ostream OSE(Tmp);
374 MCObjectWriter::EncodeSLEB128(LineDelta, OSE);
378 Temp = 0 - DWARF2_LINE_BASE;
382 // Use DW_LNS_copy instead of a "line +0, addr +0" special opcode.
383 if (LineDelta == 0 && AddrDelta == 0) {
384 OS << char(dwarf::DW_LNS_copy);
388 // Bias the opcode by the special opcode base.
389 Temp += DWARF2_LINE_OPCODE_BASE;
391 // Avoid overflow when addr_delta is large.
392 if (AddrDelta < 256 + MAX_SPECIAL_ADDR_DELTA) {
393 // Try using a special opcode.
394 Opcode = Temp + AddrDelta * DWARF2_LINE_RANGE;
400 // Try using DW_LNS_const_add_pc followed by special op.
401 Opcode = Temp + (AddrDelta - MAX_SPECIAL_ADDR_DELTA) * DWARF2_LINE_RANGE;
403 OS << char(dwarf::DW_LNS_const_add_pc);
409 // Otherwise use DW_LNS_advance_pc.
410 OS << char(dwarf::DW_LNS_advance_pc);
412 raw_svector_ostream OSE(Tmp);
413 MCObjectWriter::EncodeULEB128(AddrDelta, OSE);
417 OS << char(dwarf::DW_LNS_copy);
422 void MCDwarfFile::print(raw_ostream &OS) const {
423 OS << '"' << getName() << '"';
426 void MCDwarfFile::dump() const {
430 static int getDataAlignmentFactor(MCStreamer &streamer) {
431 MCContext &context = streamer.getContext();
432 const TargetAsmInfo &asmInfo = context.getTargetAsmInfo();
433 int size = asmInfo.getPointerSize();
434 if (asmInfo.getStackGrowthDirection() == TargetFrameInfo::StackGrowsUp)
440 /// EmitFrameMoves - Emit frame instructions to describe the layout of the
442 static void EmitFrameMoves(MCStreamer &streamer,
443 const std::vector<MachineMove> &Moves,
444 MCSymbol *BaseLabel, bool isEH) {
445 MCContext &context = streamer.getContext();
446 const TargetAsmInfo &asmInfo = context.getTargetAsmInfo();
447 int dataAlignmentFactor = getDataAlignmentFactor(streamer);
449 for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
450 const MachineMove &Move = Moves[i];
451 MCSymbol *Label = Move.getLabel();
452 // Throw out move if the label is invalid.
453 if (Label && !Label->isDefined()) continue; // Not emitted, in dead code.
455 const MachineLocation &Dst = Move.getDestination();
456 const MachineLocation &Src = Move.getSource();
458 // Advance row if new location.
459 if (BaseLabel && Label) {
460 MCSymbol *ThisSym = Label;
461 if (ThisSym != BaseLabel) {
462 streamer.EmitIntValue(dwarf::DW_CFA_advance_loc4, 1);
463 const MCExpr *Length = MakeStartMinusEndExpr(streamer, *BaseLabel,
465 streamer.EmitValue(Length, 4);
471 if (Dst.isReg() && Dst.getReg() == MachineLocation::VirtualFP) {
472 assert(!Src.isReg() && "Machine move not supported yet.");
474 if (Src.getReg() == MachineLocation::VirtualFP) {
475 streamer.EmitIntValue(dwarf::DW_CFA_def_cfa_offset, 1);
477 streamer.EmitIntValue(dwarf::DW_CFA_def_cfa, 1);
478 streamer.EmitULEB128IntValue(asmInfo.getDwarfRegNum(Src.getReg(), isEH),
482 streamer.EmitULEB128IntValue(-Src.getOffset(), 1);
486 if (Src.isReg() && Src.getReg() == MachineLocation::VirtualFP) {
487 assert(Dst.isReg() && "Machine move not supported yet.");
488 streamer.EmitIntValue(dwarf::DW_CFA_def_cfa_register, 1);
489 streamer.EmitULEB128IntValue(asmInfo.getDwarfRegNum(Dst.getReg(), isEH));
493 unsigned Reg = asmInfo.getDwarfRegNum(Src.getReg(), isEH);
494 int Offset = Dst.getOffset() / dataAlignmentFactor;
497 streamer.EmitIntValue(dwarf::DW_CFA_offset_extended_sf, 1);
498 streamer.EmitULEB128IntValue(Reg);
499 streamer.EmitSLEB128IntValue(Offset);
500 } else if (Reg < 64) {
501 streamer.EmitIntValue(dwarf::DW_CFA_offset + Reg, 1);
502 streamer.EmitULEB128IntValue(Offset, 1);
504 streamer.EmitIntValue(dwarf::DW_CFA_offset_extended, 1);
505 streamer.EmitULEB128IntValue(Reg, 1);
506 streamer.EmitULEB128IntValue(Offset, 1);
511 static const MCSymbol &EmitCIE(MCStreamer &streamer) {
512 MCContext &context = streamer.getContext();
513 const TargetAsmInfo &asmInfo = context.getTargetAsmInfo();
514 const MCSection §ion = *asmInfo.getEHFrameSection();
515 streamer.SwitchSection(§ion);
516 MCSymbol *sectionStart = streamer.getContext().CreateTempSymbol();
517 MCSymbol *sectionEnd = streamer.getContext().CreateTempSymbol();
520 const MCExpr *Length = MakeStartMinusEndExpr(streamer, *sectionStart,
522 streamer.EmitLabel(sectionStart);
523 streamer.EmitValue(Length, 4);
526 streamer.EmitIntValue(0, 4);
529 streamer.EmitIntValue(dwarf::DW_CIE_VERSION, 1);
531 // Augmentation String
532 SmallString<8> Augmentation;
533 Augmentation += "zR";
534 streamer.EmitBytes(Augmentation.str(), 0);
535 streamer.EmitIntValue(0, 1);
537 // Code Alignment Factor
538 streamer.EmitULEB128IntValue(1);
540 // Data Alignment Factor
541 streamer.EmitSLEB128IntValue(getDataAlignmentFactor(streamer));
543 // Return Address Register
544 streamer.EmitULEB128IntValue(asmInfo.getDwarfRARegNum(true));
546 // Augmentation Data Length (optional)
547 MCSymbol *augmentationStart = streamer.getContext().CreateTempSymbol();
548 MCSymbol *augmentationEnd = streamer.getContext().CreateTempSymbol();
549 const MCExpr *augmentationLength = MakeStartMinusEndExpr(streamer,
551 *augmentationEnd, 0);
552 streamer.EmitULEB128Value(augmentationLength);
554 // Augmentation Data (optional)
555 streamer.EmitLabel(augmentationStart);
556 streamer.EmitIntValue(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4, 1);
557 streamer.EmitLabel(augmentationEnd);
559 // Initial Instructions
561 const std::vector<MachineMove> Moves = asmInfo.getInitialFrameState();
563 EmitFrameMoves(streamer, Moves, NULL, true);
566 streamer.EmitValueToAlignment(asmInfo.getPointerSize());
568 streamer.EmitLabel(sectionEnd);
569 return *sectionStart;
572 static MCSymbol *EmitFDE(MCStreamer &streamer,
573 const MCSymbol &cieStart,
574 const MCDwarfFrameInfo &frame) {
575 MCSymbol *fdeStart = streamer.getContext().CreateTempSymbol();
576 MCSymbol *fdeEnd = streamer.getContext().CreateTempSymbol();
579 const MCExpr *Length = MakeStartMinusEndExpr(streamer, *fdeStart, *fdeEnd, 0);
580 streamer.EmitValue(Length, 4);
582 streamer.EmitLabel(fdeStart);
584 const MCExpr *offset = MakeStartMinusEndExpr(streamer, cieStart, *fdeStart,
586 streamer.EmitValue(offset, 4);
589 streamer.EmitPCRelSymbolValue(frame.Begin, 4);
592 const MCExpr *Range = MakeStartMinusEndExpr(streamer, *frame.Begin,
594 streamer.EmitValue(Range, 4);
596 // Augmentation Data Length
597 streamer.EmitULEB128IntValue(0);
600 // Call Frame Instructions
603 streamer.EmitValueToAlignment(4);
608 void MCDwarfFrameEmitter::Emit(MCStreamer &streamer) {
609 const MCContext &context = streamer.getContext();
610 const TargetAsmInfo &asmInfo = context.getTargetAsmInfo();
611 const MCSymbol &cieStart = EmitCIE(streamer);
612 MCSymbol *fdeEnd = NULL;
613 for (unsigned i = 0, n = streamer.getNumFrameInfos(); i < n; ++i) {
614 fdeEnd = EmitFDE(streamer, cieStart, streamer.getFrameInfo(i));
616 streamer.EmitLabel(fdeEnd);
618 streamer.EmitValueToAlignment(asmInfo.getPointerSize());
620 streamer.EmitLabel(fdeEnd);