From 344a3780b2e33f6ca763666c380202b18aab72a3 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 29 Jul 2021 22:15:26 +0200 Subject: Vendor import of llvm-project main 88e66fa60ae5, the last commit before the upstream release/13.x branch was created. --- llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp') diff --git a/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp b/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp index 7b78dc4ad13a..a886f9b9d814 100644 --- a/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp +++ b/llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp @@ -97,6 +97,15 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU, return Ret; } +static std::unique_ptr createTLOF(const Triple &TT) { + if (TT.isOSzOS()) + return std::make_unique(); + + // Note: Some times run with -triple s390x-unknown. + // In this case, default to ELF unless z/OS specifically provided. + return std::make_unique(); +} + static Reloc::Model getEffectiveRelocModel(Optional RM) { // Static code is suitable for use in a dynamic executable; there is no // separate DynamicNoPIC model. @@ -160,7 +169,7 @@ SystemZTargetMachine::SystemZTargetMachine(const Target &T, const Triple &TT, getEffectiveRelocModel(RM), getEffectiveSystemZCodeModel(CM, getEffectiveRelocModel(RM), JIT), OL), - TLOF(std::make_unique()) { + TLOF(createTLOF(getTargetTriple())) { initAsmInfo(); } @@ -179,9 +188,7 @@ SystemZTargetMachine::getSubtargetImpl(const Function &F) const { // FIXME: This is related to the code below to reset the target options, // we need to know whether or not the soft float flag is set on the // function, so we can enable it as a subtarget feature. - bool softFloat = - F.hasFnAttribute("use-soft-float") && - F.getFnAttribute("use-soft-float").getValueAsString() == "true"; + bool softFloat = F.getFnAttribute("use-soft-float").getValueAsBool(); if (softFloat) FS += FS.empty() ? "+soft-float" : ",+soft-float"; -- cgit v1.3