Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,47 +183,13 @@ static MCInstPrinter *createSystemZMCInstPrinter(const Triple &T,
return new SystemZGNUInstPrinter(MAI, MII, MRI);
}

void SystemZTargetStreamer::emitConstantPools() {
// Emit EXRL target instructions.
if (EXRLTargets2Sym.empty())
return;
// Switch to the .text section.
const MCObjectFileInfo &OFI = *Streamer.getContext().getObjectFileInfo();
Streamer.switchSection(OFI.getTextSection());
for (auto &I : EXRLTargets2Sym) {
Streamer.emitLabel(I.second);
const MCInstSTIPair &MCI_STI = I.first;
Streamer.emitInstruction(MCI_STI.first, *MCI_STI.second);
}
EXRLTargets2Sym.clear();
}

namespace {
class SystemZTargetAsmStreamer : public SystemZTargetStreamer {
formatted_raw_ostream &OS;

public:
SystemZTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
: SystemZTargetStreamer(S), OS(OS) {}
void emitMachine(StringRef CPU) override {
OS << "\t.machine " << CPU << "\n";
}
};

class SystemZTargetELFStreamer : public SystemZTargetStreamer {
public:
SystemZTargetELFStreamer(MCStreamer &S) : SystemZTargetStreamer(S) {}
void emitMachine(StringRef CPU) override {}
};
} // end namespace

static MCTargetStreamer *createAsmTargetStreamer(MCStreamer &S,
formatted_raw_ostream &OS,
MCInstPrinter *InstPrint) {
if (S.getContext().getTargetTriple().isOSzOS())
return new SystemZTargetHLASMStreamer(S, OS);
else
return new SystemZTargetAsmStreamer(S, OS);
return new SystemZTargetGNUStreamer(S, OS);
}

static MCStreamer *createAsmStreamer(MCContext &Ctx,
Expand Down
16 changes: 16 additions & 0 deletions llvm/lib/Target/SystemZ/MCTargetDesc/SystemZTargetStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,25 @@
//===----------------------------------------------------------------------===//

#include "SystemZTargetStreamer.h"
#include "llvm/MC/MCObjectFileInfo.h"

using namespace llvm;

void SystemZTargetStreamer::emitConstantPools() {
// Emit EXRL target instructions.
if (EXRLTargets2Sym.empty())
return;
// Switch to the .text section.
const MCObjectFileInfo &OFI = *Streamer.getContext().getObjectFileInfo();
Streamer.switchSection(OFI.getTextSection());
for (auto &I : EXRLTargets2Sym) {
Streamer.emitLabel(I.second);
const MCInstSTIPair &MCI_STI = I.first;
Streamer.emitInstruction(MCI_STI.first, *MCI_STI.second);
}
EXRLTargets2Sym.clear();
}

void SystemZTargetHLASMStreamer::emitExtern(StringRef Sym) {
getStreamer().emitRawText(Twine(" EXTRN ") + Twine(Sym));
}
Expand Down
17 changes: 17 additions & 0 deletions llvm/lib/Target/SystemZ/MCTargetDesc/SystemZTargetStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ class SystemZTargetHLASMStreamer : public SystemZTargetStreamer {
const MCSymbol *Lo) override;
};

class SystemZTargetELFStreamer : public SystemZTargetStreamer {
public:
SystemZTargetELFStreamer(MCStreamer &S) : SystemZTargetStreamer(S) {}
void emitMachine(StringRef CPU) override {}
};

class SystemZTargetGNUStreamer : public SystemZTargetStreamer {
formatted_raw_ostream &OS;

public:
SystemZTargetGNUStreamer(MCStreamer &S, formatted_raw_ostream &OS)
: SystemZTargetStreamer(S), OS(OS) {}
void emitMachine(StringRef CPU) override {
OS << "\t.machine " << CPU << "\n";
}
};

} // end namespace llvm

#endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETSTREAMER_H