|
24 | 24 |
|
25 | 25 | using namespace llvm; |
26 | 26 |
|
27 | | -MCGOFFStreamer::MCGOFFStreamer(MCContext &Context, |
28 | | - std::unique_ptr<MCAsmBackend> MAB, |
29 | | - std::unique_ptr<MCObjectWriter> OW, |
30 | | - std::unique_ptr<MCCodeEmitter> Emitter) |
31 | | - : MCObjectStreamer(Context, std::move(MAB), std::move(OW), |
32 | | - std::move(Emitter)) {} |
33 | | - |
34 | | -MCGOFFStreamer::~MCGOFFStreamer() = default; |
35 | | - |
36 | | -void MCGOFFStreamer::finishImpl() { |
37 | | - getWriter().setRootSD(static_cast<MCSectionGOFF *>( |
38 | | - getContext().getObjectFileInfo()->getTextSection()) |
39 | | - ->getParent()); |
40 | | - MCObjectStreamer::finishImpl(); |
41 | | -} |
42 | | - |
43 | | -GOFFObjectWriter &MCGOFFStreamer::getWriter() { |
44 | | - return static_cast<GOFFObjectWriter &>(getAssembler().getWriter()); |
45 | | -} |
46 | | - |
47 | | -void MCGOFFStreamer::changeSection(MCSection *Section, uint32_t Subsection) { |
48 | | - // Make sure that all section are registered in the correct order. |
49 | | - SmallVector<MCSectionGOFF *> Sections; |
50 | | - for (auto *S = static_cast<MCSectionGOFF *>(Section); S; S = S->getParent()) |
51 | | - Sections.push_back(S); |
52 | | - while (!Sections.empty()) { |
53 | | - auto *S = Sections.pop_back_val(); |
54 | | - MCObjectStreamer::changeSection(S, Sections.empty() ? Subsection : 0); |
55 | | - } |
56 | | -} |
57 | | - |
58 | | -void MCGOFFStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) { |
59 | | - MCObjectStreamer::emitLabel(Symbol, Loc); |
60 | | -} |
61 | | - |
62 | | -bool MCGOFFStreamer::emitSymbolAttribute(MCSymbol *Sym, |
63 | | - MCSymbolAttr Attribute) { |
64 | | - auto *Symbol = static_cast<MCSymbolGOFF *>(Sym); |
| 27 | +namespace llvm { |
| 28 | +namespace goff { |
| 29 | +bool setSymbolAttribute(MCSymbolGOFF *Symbol, MCSymbolAttr Attribute) { |
65 | 30 | switch (Attribute) { |
66 | 31 | case MCSA_Invalid: |
67 | 32 | case MCSA_Cold: |
@@ -118,6 +83,48 @@ bool MCGOFFStreamer::emitSymbolAttribute(MCSymbol *Sym, |
118 | 83 |
|
119 | 84 | return true; |
120 | 85 | } |
| 86 | +} // namespace goff |
| 87 | +} // namespace llvm |
| 88 | + |
| 89 | +MCGOFFStreamer::MCGOFFStreamer(MCContext &Context, |
| 90 | + std::unique_ptr<MCAsmBackend> MAB, |
| 91 | + std::unique_ptr<MCObjectWriter> OW, |
| 92 | + std::unique_ptr<MCCodeEmitter> Emitter) |
| 93 | + : MCObjectStreamer(Context, std::move(MAB), std::move(OW), |
| 94 | + std::move(Emitter)) {} |
| 95 | + |
| 96 | +MCGOFFStreamer::~MCGOFFStreamer() = default; |
| 97 | + |
| 98 | +void MCGOFFStreamer::finishImpl() { |
| 99 | + getWriter().setRootSD(static_cast<MCSectionGOFF *>( |
| 100 | + getContext().getObjectFileInfo()->getTextSection()) |
| 101 | + ->getParent()); |
| 102 | + MCObjectStreamer::finishImpl(); |
| 103 | +} |
| 104 | + |
| 105 | +GOFFObjectWriter &MCGOFFStreamer::getWriter() { |
| 106 | + return static_cast<GOFFObjectWriter &>(getAssembler().getWriter()); |
| 107 | +} |
| 108 | + |
| 109 | +void MCGOFFStreamer::changeSection(MCSection *Section, uint32_t Subsection) { |
| 110 | + // Make sure that all section are registered in the correct order. |
| 111 | + SmallVector<MCSectionGOFF *> Sections; |
| 112 | + for (auto *S = static_cast<MCSectionGOFF *>(Section); S; S = S->getParent()) |
| 113 | + Sections.push_back(S); |
| 114 | + while (!Sections.empty()) { |
| 115 | + auto *S = Sections.pop_back_val(); |
| 116 | + MCObjectStreamer::changeSection(S, Sections.empty() ? Subsection : 0); |
| 117 | + } |
| 118 | +} |
| 119 | + |
| 120 | +void MCGOFFStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) { |
| 121 | + MCObjectStreamer::emitLabel(Symbol, Loc); |
| 122 | +} |
| 123 | + |
| 124 | +bool MCGOFFStreamer::emitSymbolAttribute(MCSymbol *Sym, |
| 125 | + MCSymbolAttr Attribute) { |
| 126 | + return goff::setSymbolAttribute(static_cast<MCSymbolGOFF *>(Sym), Attribute); |
| 127 | +} |
121 | 128 |
|
122 | 129 | void MCGOFFStreamer::emitExterns() {} |
123 | 130 |
|
|
0 commit comments