mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 08:14:12 +00:00
rustup: update to nightly-2022-03-01.
This commit is contained in:
parent
57eed8394e
commit
f0baf78ade
@ -792,7 +792,7 @@ fn trans_intrinsic_type<'tcx>(
|
||||
|
||||
// fn type_from_variant_discriminant<'tcx, P: FromPrimitive>(
|
||||
// cx: &CodegenCx<'tcx>,
|
||||
// const_: &'tcx Const<'tcx>,
|
||||
// const_: Const<'tcx>,
|
||||
// ) -> P {
|
||||
// let adt_def = const_.ty.ty_adt_def().unwrap();
|
||||
// assert!(adt_def.is_enum());
|
||||
@ -845,10 +845,10 @@ fn trans_intrinsic_type<'tcx>(
|
||||
|
||||
fn const_int_value<'tcx, P: FromPrimitive>(
|
||||
cx: &CodegenCx<'tcx>,
|
||||
const_: &'tcx Const<'tcx>,
|
||||
const_: Const<'tcx>,
|
||||
) -> Result<P, ErrorReported> {
|
||||
assert!(const_.ty.is_integral());
|
||||
let value = const_.eval_bits(cx.tcx, ParamEnv::reveal_all(), const_.ty);
|
||||
assert!(const_.ty().is_integral());
|
||||
let value = const_.eval_bits(cx.tcx, ParamEnv::reveal_all(), const_.ty());
|
||||
match P::from_u128(value) {
|
||||
Some(v) => Ok(v),
|
||||
None => {
|
||||
|
@ -375,15 +375,19 @@ impl CheckSpirvAttrVisitor<'_> {
|
||||
Err(MultipleAttrs {
|
||||
prev_span,
|
||||
category,
|
||||
}) => self
|
||||
.tcx
|
||||
.sess
|
||||
.struct_span_err(
|
||||
span,
|
||||
&format!("only one {} attribute is allowed on a {}", category, target),
|
||||
)
|
||||
.span_note(prev_span, &format!("previous {} attribute", category))
|
||||
.emit(),
|
||||
}) => {
|
||||
self.tcx
|
||||
.sess
|
||||
.struct_span_err(
|
||||
span,
|
||||
&format!(
|
||||
"only one {} attribute is allowed on a {}",
|
||||
category, target
|
||||
),
|
||||
)
|
||||
.span_note(prev_span, &format!("previous {} attribute", category))
|
||||
.emit();
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -330,26 +330,28 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
let one = self.constant_int(size_bytes.ty, 1);
|
||||
let zero_align = Align::from_bytes(0).unwrap();
|
||||
|
||||
let mut header = self.build_sibling_block("memset_header");
|
||||
let mut body = self.build_sibling_block("memset_body");
|
||||
let exit = self.build_sibling_block("memset_exit");
|
||||
let header_bb = self.append_sibling_block("memset_header");
|
||||
let body_bb = self.append_sibling_block("memset_body");
|
||||
let exit_bb = self.append_sibling_block("memset_exit");
|
||||
|
||||
let count = self.udiv(size_bytes, size_elem_const);
|
||||
let index = self.alloca(count.ty, zero_align);
|
||||
self.store(zero, index, zero_align);
|
||||
self.br(header.llbb());
|
||||
self.br(header_bb);
|
||||
|
||||
let current_index = header.load(count.ty, index, zero_align);
|
||||
let cond = header.icmp(IntPredicate::IntULT, current_index, count);
|
||||
header.cond_br(cond, body.llbb(), exit.llbb());
|
||||
self.switch_to_block(header_bb);
|
||||
let current_index = self.load(count.ty, index, zero_align);
|
||||
let cond = self.icmp(IntPredicate::IntULT, current_index, count);
|
||||
self.cond_br(cond, body_bb, exit_bb);
|
||||
|
||||
let gep_ptr = body.gep(pat.ty, ptr, &[current_index]);
|
||||
body.store(pat, gep_ptr, zero_align);
|
||||
let current_index_plus_1 = body.add(current_index, one);
|
||||
body.store(current_index_plus_1, index, zero_align);
|
||||
body.br(header.llbb());
|
||||
self.switch_to_block(body_bb);
|
||||
let gep_ptr = self.gep(pat.ty, ptr, &[current_index]);
|
||||
self.store(pat, gep_ptr, zero_align);
|
||||
let current_index_plus_1 = self.add(current_index, one);
|
||||
self.store(current_index_plus_1, index, zero_align);
|
||||
self.br(header_bb);
|
||||
|
||||
*self = exit;
|
||||
self.switch_to_block(exit_bb);
|
||||
}
|
||||
|
||||
fn zombie_convert_ptr_to_u(&self, def: Word) {
|
||||
@ -503,23 +505,10 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn build_sibling_block(&mut self, _name: &str) -> Self {
|
||||
let mut builder = self.emit_with_cursor(BuilderCursor {
|
||||
function: self.cursor.function,
|
||||
block: None,
|
||||
});
|
||||
let new_bb = builder.begin_block(None).unwrap();
|
||||
let new_cursor = BuilderCursor {
|
||||
function: self.cursor.function,
|
||||
block: builder.selected_block(),
|
||||
};
|
||||
Self {
|
||||
cx: self.cx,
|
||||
cursor: new_cursor,
|
||||
current_fn: self.current_fn,
|
||||
basic_block: new_bb,
|
||||
current_span: Default::default(),
|
||||
}
|
||||
fn switch_to_block(&mut self, llbb: Self::BasicBlock) {
|
||||
// FIXME(eddyb) this could be more efficient by having an index in
|
||||
// `Self::BasicBlock`, not just a SPIR-V ID.
|
||||
*self = Self::build(self.cx, llbb);
|
||||
}
|
||||
|
||||
fn ret_void(&mut self) {
|
||||
|
@ -335,10 +335,14 @@ impl<'a, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'tcx> {
|
||||
// HACK(eddyb) there is no `abort` or `trap` instruction in SPIR-V,
|
||||
// so the best thing we can do is inject an infinite loop.
|
||||
// (While there is `OpKill`, it doesn't really have the right semantics)
|
||||
let mut abort_loop_bx = self.build_sibling_block("abort_loop");
|
||||
abort_loop_bx.br(abort_loop_bx.llbb());
|
||||
self.br(abort_loop_bx.llbb());
|
||||
*self = self.build_sibling_block("abort_continue");
|
||||
let abort_loop_bb = self.append_sibling_block("abort_loop");
|
||||
let abort_continue_bb = self.append_sibling_block("abort_continue");
|
||||
self.br(abort_loop_bb);
|
||||
|
||||
self.switch_to_block(abort_loop_bb);
|
||||
self.br(abort_loop_bb);
|
||||
|
||||
self.switch_to_block(abort_continue_bb);
|
||||
}
|
||||
|
||||
fn assume(&mut self, _val: Self::Value) {
|
||||
|
@ -20,7 +20,7 @@ use rustc_codegen_ssa::traits::{
|
||||
AbiBuilderMethods, ArgAbiMethods, BackendTypes, BuilderMethods, CoverageInfoBuilderMethods,
|
||||
DebugInfoBuilderMethods, HasCodegen, StaticBuilderMethods,
|
||||
};
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
use rustc_errors::{DiagnosticBuilder, ErrorReported};
|
||||
use rustc_middle::mir::coverage::{
|
||||
CodeRegion, CounterValueReference, ExpressionOperandId, InjectedExpressionId, Op,
|
||||
};
|
||||
@ -70,7 +70,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder<'_, ErrorReported> {
|
||||
if let Some(current_span) = self.current_span {
|
||||
self.tcx.sess.struct_span_err(current_span, msg)
|
||||
} else {
|
||||
|
@ -239,26 +239,27 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
storage_class_attr.span,
|
||||
"redundant storage class specifier, storage class is inferred from type",
|
||||
),
|
||||
Some(inferred) => self
|
||||
.tcx
|
||||
.sess
|
||||
.struct_span_err(hir_param.span, "storage class mismatch")
|
||||
.span_label(
|
||||
storage_class_attr.span,
|
||||
format!("{:?} specified in attribute", storage_class),
|
||||
)
|
||||
.span_label(
|
||||
hir_param.ty_span,
|
||||
format!("{:?} inferred from type", inferred),
|
||||
)
|
||||
.span_help(
|
||||
storage_class_attr.span,
|
||||
&format!(
|
||||
"remove storage class attribute to use {:?} as storage class",
|
||||
inferred
|
||||
),
|
||||
)
|
||||
.emit(),
|
||||
Some(inferred) => {
|
||||
self.tcx
|
||||
.sess
|
||||
.struct_span_err(hir_param.span, "storage class mismatch")
|
||||
.span_label(
|
||||
storage_class_attr.span,
|
||||
format!("{:?} specified in attribute", storage_class),
|
||||
)
|
||||
.span_label(
|
||||
hir_param.ty_span,
|
||||
format!("{:?} inferred from type", inferred),
|
||||
)
|
||||
.span_help(
|
||||
storage_class_attr.span,
|
||||
&format!(
|
||||
"remove storage class attribute to use {:?} as storage class",
|
||||
inferred
|
||||
),
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
None => (),
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_middle::mir::mono::CodegenUnit;
|
||||
use rustc_middle::mir::Body;
|
||||
use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt};
|
||||
use rustc_middle::ty::{Instance, ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt, TyS};
|
||||
use rustc_middle::ty::{Instance, ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
@ -614,7 +614,7 @@ impl<'tcx> DebugInfoMethods<'tcx> for CodegenCx<'tcx> {
|
||||
fn dbg_scope_fn(
|
||||
&self,
|
||||
_: rustc_middle::ty::Instance<'tcx>,
|
||||
_: &FnAbi<'tcx, &'tcx TyS<'tcx>>,
|
||||
_: &FnAbi<'tcx, Ty<'tcx>>,
|
||||
_: Option<Self::Function>,
|
||||
) -> Self::DIScope {
|
||||
todo!()
|
||||
|
@ -509,10 +509,10 @@ impl ExtraBackendMethods for SpirvCodegenBackend {
|
||||
};
|
||||
if let Ok(ref path) = env::var("DUMP_MODULE_ON_PANIC") {
|
||||
let module_dumper = DumpModuleOnPanic { cx: &cx, path };
|
||||
with_no_trimmed_paths(do_codegen);
|
||||
with_no_trimmed_paths!(do_codegen());
|
||||
drop(module_dumper);
|
||||
} else {
|
||||
with_no_trimmed_paths(do_codegen);
|
||||
with_no_trimmed_paths!(do_codegen());
|
||||
}
|
||||
let spirv_module = cx.finalize_module().assemble();
|
||||
|
||||
|
@ -297,8 +297,10 @@ fn do_spirv_opt(
|
||||
// TODO: Adds spans here? Not sure how useful with binary, but maybe?
|
||||
|
||||
let mut err = match msg.level {
|
||||
Level::Fatal | Level::InternalError => sess.struct_fatal(&msg.message),
|
||||
Level::Error => sess.struct_err(&msg.message),
|
||||
Level::Fatal | Level::InternalError => {
|
||||
sess.struct_fatal(&msg.message).forget_guarantee()
|
||||
}
|
||||
Level::Error => sess.struct_err(&msg.message).forget_guarantee(),
|
||||
Level::Warning => sess.struct_warn(&msg.message),
|
||||
Level::Info | Level::Debug => sess.struct_note_without_error(&msg.message),
|
||||
};
|
||||
|
@ -71,13 +71,13 @@ fn assemble_and_link(binaries: &[&[u8]]) -> Result<Module, String> {
|
||||
let config = rustc_interface::Config {
|
||||
opts: sopts,
|
||||
crate_cfg: Default::default(),
|
||||
crate_check_cfg: Default::default(),
|
||||
input: Input::File(PathBuf::new()),
|
||||
input_path: None,
|
||||
output_file: None,
|
||||
output_dir: None,
|
||||
file_loader: None,
|
||||
diagnostic_output: DiagnosticOutput::Raw(Box::new(write_diags)),
|
||||
stderr: None,
|
||||
lint_caps: Default::default(),
|
||||
parse_sess_created: None,
|
||||
register_lints: None,
|
||||
|
@ -5,5 +5,5 @@
|
||||
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
|
||||
|
||||
[toolchain]
|
||||
channel = "nightly-2022-02-01"
|
||||
channel = "nightly-2022-03-01"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||
|
@ -89,12 +89,6 @@ error[E0277]: the trait bound `{float}: Vector<f32, 2_usize>` is not satisfied
|
||||
| | the trait `Vector<f32, 2_usize>` is not implemented for `{float}`
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<BVec2 as Vector<bool, 2_usize>>
|
||||
<BVec3 as Vector<bool, 3_usize>>
|
||||
<BVec4 as Vector<bool, 4_usize>>
|
||||
<DVec2 as Vector<f64, 2_usize>>
|
||||
and 13 others
|
||||
note: required by a bound in `debug_printf_assert_is_vector`
|
||||
--> $SPIRV_STD_SRC/lib.rs:144:8
|
||||
|
|
||||
|
@ -1,7 +1,7 @@
|
||||
error: Cannot memcpy dynamically sized data
|
||||
--> $CORE_SRC/intrinsics.rs:2194:14
|
||||
--> $CORE_SRC/intrinsics.rs:2193:14
|
||||
|
|
||||
2194 | unsafe { copy(src, dst, count) }
|
||||
2193 | unsafe { copy(src, dst, count) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -2,7 +2,7 @@
|
||||
%4 = OpFunctionParameter %5
|
||||
%6 = OpFunctionParameter %5
|
||||
%7 = OpLabel
|
||||
OpLine %8 701 8
|
||||
OpLine %8 660 8
|
||||
%9 = OpLoad %10 %4
|
||||
OpLine %11 7 13
|
||||
OpStore %6 %9
|
||||
|
@ -2,7 +2,7 @@
|
||||
%4 = OpFunctionParameter %5
|
||||
%6 = OpFunctionParameter %5
|
||||
%7 = OpLabel
|
||||
OpLine %8 701 8
|
||||
OpLine %8 660 8
|
||||
%9 = OpLoad %10 %4
|
||||
OpLine %11 7 13
|
||||
OpStore %6 %9
|
||||
|
@ -4,7 +4,7 @@
|
||||
%7 = OpLabel
|
||||
OpLine %8 7 35
|
||||
%9 = OpLoad %10 %4
|
||||
OpLine %11 892 8
|
||||
OpLine %11 851 8
|
||||
OpStore %6 %9
|
||||
OpLine %8 8 1
|
||||
OpReturn
|
||||
|
@ -4,7 +4,7 @@
|
||||
%7 = OpLabel
|
||||
OpLine %8 7 37
|
||||
%9 = OpLoad %10 %4
|
||||
OpLine %11 892 8
|
||||
OpLine %11 851 8
|
||||
OpStore %6 %9
|
||||
OpLine %8 8 1
|
||||
OpReturn
|
||||
|
Loading…
Reference in New Issue
Block a user