diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-09-02 21:17:18 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-01-07 23:04:38 +0000 |
commit | 0e1e0ce556810ad5f9d45485e686f0653530516c (patch) | |
tree | ab02ce7c4fafc0518430e9cec77d41201bce23f0 /contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | |
parent | c3eb0b7c19221f3a2133ab14d3ffffa61ec0c4bc (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index 630c786a3dc7..6ef219f216a3 100644 --- a/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/contrib/llvm-project/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -16,6 +16,7 @@ #include "TargetInfo/WebAssemblyTargetInfo.h" #include "Utils/WebAssemblyUtilities.h" #include "WebAssembly.h" +#include "WebAssemblyISelLowering.h" #include "WebAssemblyMachineFunctionInfo.h" #include "WebAssemblyTargetObjectFile.h" #include "WebAssemblyTargetTransformInfo.h" @@ -98,13 +99,6 @@ static Reloc::Model getEffectiveRelocModel(std::optional<Reloc::Model> RM, return Reloc::Static; } - if (!TT.isOSEmscripten()) { - // Relocation modes other than static are currently implemented in a way - // that only works for Emscripten, so disable them if we aren't targeting - // Emscripten. - return Reloc::Static; - } - return *RM; } @@ -464,6 +458,15 @@ void WebAssemblyPassConfig::addIRPasses() { } void WebAssemblyPassConfig::addISelPrepare() { + WebAssemblyTargetMachine *WasmTM = + static_cast<WebAssemblyTargetMachine *>(TM); + const WebAssemblySubtarget *Subtarget = + WasmTM->getSubtargetImpl(std::string(WasmTM->getTargetCPU()), + std::string(WasmTM->getTargetFeatureString())); + if (Subtarget->hasReferenceTypes()) { + // We need to remove allocas for reference types + addPass(createPromoteMemoryToRegisterPass(true)); + } // Lower atomics and TLS if necessary addPass(new CoalesceFeaturesAndStripAtomics(&getWebAssemblyTargetMachine())); |