Skip to content

Commit b9180c5

Browse files
tltaoTony Tao
andauthored
[SystemZ] Move some SystemZTargetStreamer classes to proper file (#132476)
Now that we have a SystemZTargetStreamer file from #130535, move some TargetStreamer classes and methods from TargetDesc to the proper file. --------- Co-authored-by: Tony Tao <[email protected]>
1 parent fe7776e commit b9180c5

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -183,47 +183,13 @@ static MCInstPrinter *createSystemZMCInstPrinter(const Triple &T,
183183
return new SystemZGNUInstPrinter(MAI, MII, MRI);
184184
}
185185

186-
void SystemZTargetStreamer::emitConstantPools() {
187-
// Emit EXRL target instructions.
188-
if (EXRLTargets2Sym.empty())
189-
return;
190-
// Switch to the .text section.
191-
const MCObjectFileInfo &OFI = *Streamer.getContext().getObjectFileInfo();
192-
Streamer.switchSection(OFI.getTextSection());
193-
for (auto &I : EXRLTargets2Sym) {
194-
Streamer.emitLabel(I.second);
195-
const MCInstSTIPair &MCI_STI = I.first;
196-
Streamer.emitInstruction(MCI_STI.first, *MCI_STI.second);
197-
}
198-
EXRLTargets2Sym.clear();
199-
}
200-
201-
namespace {
202-
class SystemZTargetAsmStreamer : public SystemZTargetStreamer {
203-
formatted_raw_ostream &OS;
204-
205-
public:
206-
SystemZTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
207-
: SystemZTargetStreamer(S), OS(OS) {}
208-
void emitMachine(StringRef CPU) override {
209-
OS << "\t.machine " << CPU << "\n";
210-
}
211-
};
212-
213-
class SystemZTargetELFStreamer : public SystemZTargetStreamer {
214-
public:
215-
SystemZTargetELFStreamer(MCStreamer &S) : SystemZTargetStreamer(S) {}
216-
void emitMachine(StringRef CPU) override {}
217-
};
218-
} // end namespace
219-
220186
static MCTargetStreamer *createAsmTargetStreamer(MCStreamer &S,
221187
formatted_raw_ostream &OS,
222188
MCInstPrinter *InstPrint) {
223189
if (S.getContext().getTargetTriple().isOSzOS())
224190
return new SystemZTargetHLASMStreamer(S, OS);
225191
else
226-
return new SystemZTargetAsmStreamer(S, OS);
192+
return new SystemZTargetGNUStreamer(S, OS);
227193
}
228194

229195
static MCStreamer *createAsmStreamer(MCContext &Ctx,

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZTargetStreamer.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,25 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "SystemZTargetStreamer.h"
16+
#include "llvm/MC/MCObjectFileInfo.h"
1617

1718
using namespace llvm;
1819

20+
void SystemZTargetStreamer::emitConstantPools() {
21+
// Emit EXRL target instructions.
22+
if (EXRLTargets2Sym.empty())
23+
return;
24+
// Switch to the .text section.
25+
const MCObjectFileInfo &OFI = *Streamer.getContext().getObjectFileInfo();
26+
Streamer.switchSection(OFI.getTextSection());
27+
for (auto &I : EXRLTargets2Sym) {
28+
Streamer.emitLabel(I.second);
29+
const MCInstSTIPair &MCI_STI = I.first;
30+
Streamer.emitInstruction(MCI_STI.first, *MCI_STI.second);
31+
}
32+
EXRLTargets2Sym.clear();
33+
}
34+
1935
void SystemZTargetHLASMStreamer::emitExtern(StringRef Sym) {
2036
getStreamer().emitRawText(Twine(" EXTRN ") + Twine(Sym));
2137
}

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZTargetStreamer.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ class SystemZTargetHLASMStreamer : public SystemZTargetStreamer {
8282
const MCSymbol *Lo) override;
8383
};
8484

85+
class SystemZTargetELFStreamer : public SystemZTargetStreamer {
86+
public:
87+
SystemZTargetELFStreamer(MCStreamer &S) : SystemZTargetStreamer(S) {}
88+
void emitMachine(StringRef CPU) override {}
89+
};
90+
91+
class SystemZTargetGNUStreamer : public SystemZTargetStreamer {
92+
formatted_raw_ostream &OS;
93+
94+
public:
95+
SystemZTargetGNUStreamer(MCStreamer &S, formatted_raw_ostream &OS)
96+
: SystemZTargetStreamer(S), OS(OS) {}
97+
void emitMachine(StringRef CPU) override {
98+
OS << "\t.machine " << CPU << "\n";
99+
}
100+
};
101+
85102
} // end namespace llvm
86103

87104
#endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETSTREAMER_H

0 commit comments

Comments
 (0)