Check for feature with pre-interned symbol

This commit is contained in:
Christopher Serr 2020-06-26 17:53:52 +02:00
parent 94cd4f15d6
commit b2490299fc
3 changed files with 10 additions and 10 deletions

View file

@ -18,6 +18,7 @@ use rustc_data_structures::small_c_str::SmallCStr;
use rustc_hir::def_id::DefId;
use rustc_middle::ty::layout::TyAndLayout;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::sym;
use rustc_target::abi::{self, Align, Size};
use rustc_target::spec::{HasTargetSpec, Target};
use std::borrow::Cow;
@ -478,7 +479,11 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
let llptr = self.struct_gep(place.llval, i as u64);
let load = self.load(llptr, align);
scalar_load_metadata(self, load, scalar);
if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load }
if scalar.is_bool() {
self.trunc(load, self.type_i1())
} else {
load
}
};
OperandValue::Pair(
@ -654,10 +659,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
if self.sess().target.target.arch == "wasm32"
&& self
.sess()
.target_features
.contains(&rustc_span::symbol::Symbol::intern("nontrapping-fptoint"))
&& self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint)
{
let src_ty = self.cx.val_ty(val);
let float_width = self.cx.float_width(src_ty);
@ -679,10 +681,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
fn fptosi_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
if self.sess().target.target.arch == "wasm32"
&& self
.sess()
.target_features
.contains(&rustc_span::symbol::Symbol::intern("nontrapping-fptoint"))
&& self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint)
{
let src_ty = self.cx.val_ty(val);
let float_width = self.cx.float_width(src_ty);

View file

@ -253,7 +253,7 @@ const RISCV_WHITELIST: &[(&str, Option<Symbol>)] = &[
const WASM_WHITELIST: &[(&str, Option<Symbol>)] = &[
("simd128", Some(sym::wasm_target_feature)),
("atomics", Some(sym::wasm_target_feature)),
("nontrapping-fptoint", Some(sym::wasm_target_feature)), // TODO: Maybe None?
("nontrapping-fptoint", Some(sym::wasm_target_feature)),
];
/// When rustdoc is running, provide a list of all known features so that all their respective

View file

@ -844,6 +844,7 @@ symbols! {
warn,
wasm_import_module,
wasm_target_feature,
wasm_nontrapping_fptoint: "nontrapping-fptoint",
while_let,
windows,
windows_subsystem,