OLD | NEW |
1 //===- MCObjectStreamer.h - MCStreamer Object File Interface ----*- C++ -*-===// | 1 //===- MCObjectStreamer.h - MCStreamer Object File Interface ----*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 | 9 |
10 #ifndef LLVM_MC_MCOBJECTSTREAMER_H | 10 #ifndef LLVM_MC_MCOBJECTSTREAMER_H |
(...skipping 26 matching lines...) Expand all Loading... |
37 MCSectionData *CurSectionData; | 37 MCSectionData *CurSectionData; |
38 MCSectionData::iterator CurInsertionPoint; | 38 MCSectionData::iterator CurInsertionPoint; |
39 bool EmitEHFrame; | 39 bool EmitEHFrame; |
40 bool EmitDebugFrame; | 40 bool EmitDebugFrame; |
41 SmallVector<MCSymbolData *, 2> PendingLabels; | 41 SmallVector<MCSymbolData *, 2> PendingLabels; |
42 | 42 |
43 virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo&) = 0; | 43 virtual void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo&) = 0; |
44 void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override; | 44 void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame) override; |
45 void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override; | 45 void EmitCFIEndProcImpl(MCDwarfFrameInfo &Frame) override; |
46 | 46 |
47 // If any labels have been emitted but not assigned fragments, ensure that | |
48 // they get assigned, either to F if possible or to a new data fragment. | |
49 void flushPendingLabels(MCFragment *F); | |
50 | |
51 protected: | 47 protected: |
52 MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &_OS, | 48 MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &_OS, |
53 MCCodeEmitter *_Emitter); | 49 MCCodeEmitter *_Emitter); |
54 MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &_OS, | 50 MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, raw_ostream &_OS, |
55 MCCodeEmitter *_Emitter, MCAssembler *_Assembler); | 51 MCCodeEmitter *_Emitter, MCAssembler *_Assembler); |
56 ~MCObjectStreamer(); | 52 ~MCObjectStreamer(); |
57 | 53 |
58 public: | 54 public: |
59 /// state management | 55 /// state management |
60 void reset() override; | 56 void reset() override; |
(...skipping 17 matching lines...) Expand all Loading... |
78 void insert(MCFragment *F) { | 74 void insert(MCFragment *F) { |
79 flushPendingLabels(F); | 75 flushPendingLabels(F); |
80 CurSectionData->getFragmentList().insert(CurInsertionPoint, F); | 76 CurSectionData->getFragmentList().insert(CurInsertionPoint, F); |
81 F->setParent(CurSectionData); | 77 F->setParent(CurSectionData); |
82 } | 78 } |
83 | 79 |
84 /// Get a data fragment to write into, creating a new one if the current | 80 /// Get a data fragment to write into, creating a new one if the current |
85 /// fragment is not a data fragment. | 81 /// fragment is not a data fragment. |
86 MCDataFragment *getOrCreateDataFragment(); | 82 MCDataFragment *getOrCreateDataFragment(); |
87 | 83 |
| 84 /// If any labels have been emitted but not assigned fragments, ensure that |
| 85 /// they get assigned, either to F if possible or to a new data fragment. |
| 86 /// Optionally, it is also possible to provide an offset \p FOffset, which |
| 87 /// will be used as a symbol offset within the fragment. |
| 88 void flushPendingLabels(MCFragment *F, uint64_t FOffset = 0); |
| 89 |
88 public: | 90 public: |
89 void visitUsedSymbol(const MCSymbol &Sym) override; | 91 void visitUsedSymbol(const MCSymbol &Sym) override; |
90 | 92 |
91 MCAssembler &getAssembler() { return *Assembler; } | 93 MCAssembler &getAssembler() { return *Assembler; } |
92 | 94 |
93 /// @name MCStreamer Interface | 95 /// @name MCStreamer Interface |
94 /// @{ | 96 /// @{ |
95 | 97 |
96 void EmitLabel(MCSymbol *Symbol) override; | 98 void EmitLabel(MCSymbol *Symbol) override; |
97 void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; | 99 void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 void FinishImpl() override; | 136 void FinishImpl() override; |
135 | 137 |
136 bool mayHaveInstructions() const override { | 138 bool mayHaveInstructions() const override { |
137 return getCurrentSectionData()->hasInstructions(); | 139 return getCurrentSectionData()->hasInstructions(); |
138 } | 140 } |
139 }; | 141 }; |
140 | 142 |
141 } // end namespace llvm | 143 } // end namespace llvm |
142 | 144 |
143 #endif | 145 #endif |
OLD | NEW |