mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-15 07:18:33 +00:00
[WebAssembly] Add options for using the nontrapping-fptoint feature.
This adds ways to control use of WebAssembly's new nontrapping-fptoint feature. llvm-svn: 319129
This commit is contained in:
parent
cdd48b8a6b
commit
0811cd1d15
@ -1837,6 +1837,8 @@ def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>,
|
||||
|
||||
def msimd128 : Flag<["-"], "msimd128">, Group<m_wasm_Features_Group>;
|
||||
def mno_simd128 : Flag<["-"], "mno-simd128">, Group<m_wasm_Features_Group>;
|
||||
def mnontrapping_fptoint : Flag<["-"], "mnontrapping-fptoint">, Group<m_wasm_Features_Group>;
|
||||
def mno_nontrapping_fptoint : Flag<["-"], "mno-nontrapping-fptoint">, Group<m_wasm_Features_Group>;
|
||||
|
||||
def mamdgpu_debugger_abi : Joined<["-"], "mamdgpu-debugger-abi=">,
|
||||
Flags<[HelpHidden]>,
|
||||
|
@ -32,6 +32,7 @@ const Builtin::Info WebAssemblyTargetInfo::BuiltinInfo[] = {
|
||||
bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
|
||||
return llvm::StringSwitch<bool>(Feature)
|
||||
.Case("simd128", SIMDLevel >= SIMD128)
|
||||
.Case("nontrapping-fptoint", HasNontrappingFPToInt)
|
||||
.Default(false);
|
||||
}
|
||||
|
||||
@ -61,6 +62,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
|
||||
SIMDLevel = std::min(SIMDLevel, SIMDEnum(SIMD128 - 1));
|
||||
continue;
|
||||
}
|
||||
if (Feature == "+nontrapping-fptoint") {
|
||||
HasNontrappingFPToInt = true;
|
||||
continue;
|
||||
}
|
||||
if (Feature == "-nontrapping-fptoint") {
|
||||
HasNontrappingFPToInt = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
Diags.Report(diag::err_opt_not_valid_with_opt)
|
||||
<< Feature << "-target-feature";
|
||||
|
@ -30,9 +30,11 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
|
||||
SIMD128,
|
||||
} SIMDLevel;
|
||||
|
||||
bool HasNontrappingFPToInt;
|
||||
|
||||
public:
|
||||
explicit WebAssemblyTargetInfo(const llvm::Triple &T, const TargetOptions &)
|
||||
: TargetInfo(T), SIMDLevel(NoSIMD) {
|
||||
: TargetInfo(T), SIMDLevel(NoSIMD), HasNontrappingFPToInt(false) {
|
||||
NoAsmVariants = true;
|
||||
SuitableAlign = 128;
|
||||
LargeArrayMinWidth = 128;
|
||||
@ -55,8 +57,10 @@ private:
|
||||
initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
|
||||
StringRef CPU,
|
||||
const std::vector<std::string> &FeaturesVec) const override {
|
||||
if (CPU == "bleeding-edge")
|
||||
if (CPU == "bleeding-edge") {
|
||||
Features["simd128"] = true;
|
||||
Features["nontrapping-fptoint"] = true;
|
||||
}
|
||||
return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user