summaryrefslogtreecommitdiff
path: root/lib/Target/SystemZ/MCTargetDesc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/SystemZ/MCTargetDesc')
-rw-r--r--lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp3
-rw-r--r--lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp9
-rw-r--r--lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp41
-rw-r--r--lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h5
4 files changed, 11 insertions, 47 deletions
diff --git a/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp b/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
index 51ac410a9c81..e035c3b87a40 100644
--- a/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
+++ b/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
@@ -66,7 +66,8 @@ public:
llvm_unreachable("SystemZ does do not have assembler relaxation");
}
bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override;
- MCObjectWriter *createObjectWriter(raw_pwrite_stream &OS) const override {
+ std::unique_ptr<MCObjectWriter>
+ createObjectWriter(raw_pwrite_stream &OS) const override {
return createSystemZObjectWriter(OS, OSABI);
}
};
diff --git a/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp b/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
index df0a8161e6e7..238926d6c8e0 100644
--- a/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
+++ b/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
@@ -13,6 +13,7 @@
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
+#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
@@ -160,8 +161,8 @@ unsigned SystemZObjectWriter::getRelocType(MCContext &Ctx,
}
}
-MCObjectWriter *llvm::createSystemZObjectWriter(raw_pwrite_stream &OS,
- uint8_t OSABI) {
- MCELFObjectTargetWriter *MOTW = new SystemZObjectWriter(OSABI);
- return createELFObjectWriter(MOTW, OS, /*IsLittleEndian=*/false);
+std::unique_ptr<MCObjectWriter>
+llvm::createSystemZObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI) {
+ return createELFObjectWriter(llvm::make_unique<SystemZObjectWriter>(OSABI),
+ OS, /*IsLittleEndian=*/false);
}
diff --git a/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp b/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
index 727ab921daf9..05688ed8efbb 100644
--- a/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
+++ b/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
@@ -173,43 +173,6 @@ createSystemZMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
return createSystemZMCSubtargetInfoImpl(TT, CPU, FS);
}
-static void adjustCodeGenOpts(const Triple &TT, Reloc::Model RM,
- CodeModel::Model &CM) {
- // For SystemZ we define the models as follows:
- //
- // Small: BRASL can call any function and will use a stub if necessary.
- // Locally-binding symbols will always be in range of LARL.
- //
- // Medium: BRASL can call any function and will use a stub if necessary.
- // GOT slots and locally-defined text will always be in range
- // of LARL, but other symbols might not be.
- //
- // Large: Equivalent to Medium for now.
- //
- // Kernel: Equivalent to Medium for now.
- //
- // This means that any PIC module smaller than 4GB meets the
- // requirements of Small, so Small seems like the best default there.
- //
- // All symbols bind locally in a non-PIC module, so the choice is less
- // obvious. There are two cases:
- //
- // - When creating an executable, PLTs and copy relocations allow
- // us to treat external symbols as part of the executable.
- // Any executable smaller than 4GB meets the requirements of Small,
- // so that seems like the best default.
- //
- // - When creating JIT code, stubs will be in range of BRASL if the
- // image is less than 4GB in size. GOT entries will likewise be
- // in range of LARL. However, the JIT environment has no equivalent
- // of copy relocs, so locally-binding data symbols might not be in
- // the range of LARL. We need the Medium model in that case.
- if (CM == CodeModel::Default)
- CM = CodeModel::Small;
- else if (CM == CodeModel::JITDefault)
- CM = RM == Reloc::PIC_ ? CodeModel::Small : CodeModel::Medium;
-}
-
static MCInstPrinter *createSystemZMCInstPrinter(const Triple &T,
unsigned SyntaxVariant,
const MCAsmInfo &MAI,
@@ -223,10 +186,6 @@ extern "C" void LLVMInitializeSystemZTargetMC() {
TargetRegistry::RegisterMCAsmInfo(getTheSystemZTarget(),
createSystemZMCAsmInfo);
- // Register the adjustCodeGenOpts.
- TargetRegistry::registerMCAdjustCodeGenOpts(getTheSystemZTarget(),
- adjustCodeGenOpts);
-
// Register the MCCodeEmitter.
TargetRegistry::RegisterMCCodeEmitter(getTheSystemZTarget(),
createSystemZMCCodeEmitter);
diff --git a/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h b/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h
index dbca3485290a..99b157e37275 100644
--- a/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h
+++ b/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h
@@ -12,6 +12,8 @@
#include "llvm/Support/DataTypes.h"
+#include <memory>
+
namespace llvm {
class MCAsmBackend;
@@ -91,7 +93,8 @@ MCAsmBackend *createSystemZMCAsmBackend(const Target &T,
const Triple &TT, StringRef CPU,
const MCTargetOptions &Options);
-MCObjectWriter *createSystemZObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI);
+std::unique_ptr<MCObjectWriter> createSystemZObjectWriter(raw_pwrite_stream &OS,
+ uint8_t OSABI);
} // end namespace llvm
// Defines symbolic names for SystemZ registers.