wzssyqa created this revision. wzssyqa added reviewers: MaskRay, atanasyan. Herald added subscribers: StephenFan, jrtc27, hiraditya, arichardson, sdardis. Herald added a project: All. wzssyqa requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits.
When we use llc or lld to compiler IR files, the features +nan2008 and +fpxx/+fp64 are not used. Thus wrong format files are produced. In IR files, the attributes are only set for function while not the whole compile units. So we output `.nan 2008` and `.module fp=xx/64` before every function. `isFPXXDefault`: for o32, the FPXX is always should be the default, no matter about the vendors. Of course some distributions with FP64 default enabled should be listed explicit. Let's add them in future if we know about one. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D138179 Files: clang/lib/Driver/ToolChains/Arch/Mips.cpp llvm/lib/Target/Mips/MipsAsmPrinter.cpp Index: llvm/lib/Target/Mips/MipsAsmPrinter.cpp =================================================================== --- llvm/lib/Target/Mips/MipsAsmPrinter.cpp +++ llvm/lib/Target/Mips/MipsAsmPrinter.cpp @@ -400,6 +400,16 @@ void MipsAsmPrinter::emitFunctionEntryLabel() { MipsTargetStreamer &TS = getTargetStreamer(); + TS.updateABIInfo(*Subtarget); + if (Subtarget->isNaN2008()) + TS.emitDirectiveNaN2008(); + const MipsTargetMachine &MTM = static_cast<const MipsTargetMachine &>(TM); + const MipsABIInfo &ABI = MTM.getABI(); + + if ((ABI.IsO32() && (Subtarget->isABI_FPXX() || Subtarget->isFP64bit())) || + Subtarget->useSoftFloat()) + TS.emitDirectiveModuleFP(); + // NaCl sandboxing requires that indirect call instructions are masked. // This means that function entry points should be bundle-aligned. if (Subtarget->isTargetNaCl()) Index: clang/lib/Driver/ToolChains/Arch/Mips.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/Mips.cpp +++ clang/lib/Driver/ToolChains/Arch/Mips.cpp @@ -467,11 +467,6 @@ bool mips::isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, StringRef ABIName, mips::FloatABI FloatABI) { - if (Triple.getVendor() != llvm::Triple::ImaginationTechnologies && - Triple.getVendor() != llvm::Triple::MipsTechnologies && - !Triple.isAndroid()) - return false; - if (ABIName != "32") return false;
Index: llvm/lib/Target/Mips/MipsAsmPrinter.cpp =================================================================== --- llvm/lib/Target/Mips/MipsAsmPrinter.cpp +++ llvm/lib/Target/Mips/MipsAsmPrinter.cpp @@ -400,6 +400,16 @@ void MipsAsmPrinter::emitFunctionEntryLabel() { MipsTargetStreamer &TS = getTargetStreamer(); + TS.updateABIInfo(*Subtarget); + if (Subtarget->isNaN2008()) + TS.emitDirectiveNaN2008(); + const MipsTargetMachine &MTM = static_cast<const MipsTargetMachine &>(TM); + const MipsABIInfo &ABI = MTM.getABI(); + + if ((ABI.IsO32() && (Subtarget->isABI_FPXX() || Subtarget->isFP64bit())) || + Subtarget->useSoftFloat()) + TS.emitDirectiveModuleFP(); + // NaCl sandboxing requires that indirect call instructions are masked. // This means that function entry points should be bundle-aligned. if (Subtarget->isTargetNaCl()) Index: clang/lib/Driver/ToolChains/Arch/Mips.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/Mips.cpp +++ clang/lib/Driver/ToolChains/Arch/Mips.cpp @@ -467,11 +467,6 @@ bool mips::isFPXXDefault(const llvm::Triple &Triple, StringRef CPUName, StringRef ABIName, mips::FloatABI FloatABI) { - if (Triple.getVendor() != llvm::Triple::ImaginationTechnologies && - Triple.getVendor() != llvm::Triple::MipsTechnologies && - !Triple.isAndroid()) - return false; - if (ABIName != "32") return false;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits