mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-21 22:34:34 +00:00
rustup: update to nightly-2021-05-24. (#631)
* rustup: update to nightly-2021-05-24. * tests: update expected OpLine numbers in disassembly tests.
This commit is contained in:
parent
4afd2f39ae
commit
e5a07a9e2b
@ -464,45 +464,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
fn new_block<'b>(cx: &'a Self::CodegenCx, llfn: Self::Function, _name: &'b str) -> Self {
|
||||
let cursor_fn = cx.builder.select_function_by_id(llfn.def_cx(cx));
|
||||
let label = cx.emit_with_cursor(cursor_fn).begin_block(None).unwrap();
|
||||
let cursor = cx.builder.select_block_by_id(label);
|
||||
fn build(cx: &'a Self::CodegenCx, llbb: Self::BasicBlock) -> Self {
|
||||
let cursor = cx.builder.select_block_by_id(llbb);
|
||||
// FIXME(eddyb) change `Self::Function` to be more like a function index.
|
||||
let current_fn = {
|
||||
let emit = cx.emit_with_cursor(cursor);
|
||||
let selected_function = emit.selected_function().unwrap();
|
||||
let selected_function = &emit.module_ref().functions[selected_function];
|
||||
let def_inst = selected_function.def.as_ref().unwrap();
|
||||
let def = def_inst.result_id.unwrap();
|
||||
let ty = def_inst.operands[1].unwrap_id_ref();
|
||||
def.with_type(ty)
|
||||
};
|
||||
Self {
|
||||
cx,
|
||||
cursor,
|
||||
current_fn: llfn,
|
||||
basic_block: label,
|
||||
current_span: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
fn with_cx(cx: &'a Self::CodegenCx) -> Self {
|
||||
// Note: all defaults here *must* be filled out by position_at_end
|
||||
Self {
|
||||
cx,
|
||||
cursor: Default::default(),
|
||||
current_fn: 0.with_type(0),
|
||||
basic_block: Default::default(),
|
||||
current_span: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
fn build_sibling_block(&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_fn,
|
||||
basic_block: llbb,
|
||||
current_span: Default::default(),
|
||||
}
|
||||
}
|
||||
@ -525,20 +503,42 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
.line(file, loc.line as u32, loc.col_display as u32);
|
||||
}
|
||||
|
||||
fn position_at_end(&mut self, llbb: Self::BasicBlock) {
|
||||
let cursor = self.cx.builder.select_block_by_id(llbb);
|
||||
let current_fn = {
|
||||
let emit = self.emit_with_cursor(cursor);
|
||||
let selected_function = emit.selected_function().unwrap();
|
||||
let selected_function = &emit.module_ref().functions[selected_function];
|
||||
let def_inst = selected_function.def.as_ref().unwrap();
|
||||
let def = def_inst.result_id.unwrap();
|
||||
let ty = def_inst.operands[1].unwrap_id_ref();
|
||||
def.with_type(ty)
|
||||
// FIXME(eddyb) change `Self::Function` to be more like a function index.
|
||||
fn append_block(
|
||||
cx: &'a Self::CodegenCx,
|
||||
llfn: Self::Function,
|
||||
_name: &str,
|
||||
) -> Self::BasicBlock {
|
||||
let cursor_fn = cx.builder.select_function_by_id(llfn.def_cx(cx));
|
||||
cx.emit_with_cursor(cursor_fn).begin_block(None).unwrap()
|
||||
}
|
||||
|
||||
fn append_sibling_block(&mut self, _name: &str) -> Self::BasicBlock {
|
||||
self.emit_with_cursor(BuilderCursor {
|
||||
function: self.cursor.function,
|
||||
block: None,
|
||||
})
|
||||
.begin_block(None)
|
||||
.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.cursor = cursor;
|
||||
self.current_fn = current_fn;
|
||||
self.basic_block = llbb;
|
||||
Self {
|
||||
cx: self.cx,
|
||||
cursor: new_cursor,
|
||||
current_fn: self.current_fn,
|
||||
basic_block: new_bb,
|
||||
current_span: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
fn ret_void(&mut self) {
|
||||
@ -2207,11 +2207,6 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
self.intcast(val, dest_ty, false)
|
||||
}
|
||||
|
||||
unsafe fn delete_basic_block(&mut self, _bb: Self::BasicBlock) {
|
||||
// Ignore: If we were to delete the block, then other builder's selected_block index would become invalid, due
|
||||
// to shifting blocks.
|
||||
}
|
||||
|
||||
fn do_not_inline(&mut self, _llret: Self::Value) {
|
||||
// Ignore
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use rspirv::spirv::Word;
|
||||
use rustc_codegen_ssa::mir::place::PlaceRef;
|
||||
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::interpret::{AllocId, Allocation, GlobalAlloc, Pointer, ScalarMaybeUninit};
|
||||
use rustc_middle::mir::interpret::{alloc_range, Allocation, GlobalAlloc, ScalarMaybeUninit};
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_mir::interpret::Scalar;
|
||||
use rustc_span::symbol::Symbol;
|
||||
@ -415,10 +415,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
// only uses the input alloc_id in the case that the scalar is uninitilized
|
||||
// as part of the error output
|
||||
// tldr, the pointer here is only needed for the offset
|
||||
let value = match alloc
|
||||
.read_scalar(self, Pointer::new(AllocId(0), *offset), size)
|
||||
.unwrap()
|
||||
{
|
||||
let value = match alloc.read_scalar(self, alloc_range(*offset, size)).unwrap() {
|
||||
ScalarMaybeUninit::Scalar(scalar) => {
|
||||
self.scalar_to_backend(scalar, &self.primitive_to_scalar(primitive), ty)
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
|
||||
let mut op_entry_point_interface_operands = vec![];
|
||||
|
||||
let mut bx = Builder::new_block(self, stub_fn, "");
|
||||
let mut bx = Builder::build(self, Builder::append_block(self, stub_fn, ""));
|
||||
let mut call_args = vec![];
|
||||
let mut decoration_locations = FxHashMap::default();
|
||||
for (entry_arg_abi, hir_param) in arg_abis.iter().zip(hir_params) {
|
||||
|
@ -5,5 +5,5 @@
|
||||
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
|
||||
|
||||
[toolchain]
|
||||
channel = "nightly-2021-05-17"
|
||||
channel = "nightly-2021-05-24"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||
|
@ -5,9 +5,9 @@
|
||||
%8 = OpVariable %5 Function
|
||||
OpLine %9 319 5
|
||||
OpStore %8 %10
|
||||
OpLine %11 694 8
|
||||
OpLine %11 696 8
|
||||
OpCopyMemory %8 %4
|
||||
OpLine %11 695 8
|
||||
OpLine %11 697 8
|
||||
%12 = OpLoad %13 %8
|
||||
OpLine %14 7 13
|
||||
OpStore %6 %12
|
||||
|
@ -5,9 +5,9 @@
|
||||
%8 = OpVariable %5 Function
|
||||
OpLine %9 319 5
|
||||
OpStore %8 %10
|
||||
OpLine %11 694 8
|
||||
OpLine %11 696 8
|
||||
OpCopyMemory %8 %4
|
||||
OpLine %11 695 8
|
||||
OpLine %11 697 8
|
||||
%12 = OpLoad %13 %8
|
||||
OpLine %14 7 13
|
||||
OpStore %6 %12
|
||||
|
@ -7,7 +7,7 @@ OpLine %9 7 35
|
||||
%10 = OpLoad %11 %4
|
||||
OpLine %9 7 13
|
||||
OpStore %8 %10
|
||||
OpLine %12 878 8
|
||||
OpLine %12 880 8
|
||||
OpCopyMemory %6 %8
|
||||
OpLine %9 8 1
|
||||
OpReturn
|
||||
|
@ -7,7 +7,7 @@ OpLine %9 7 37
|
||||
%10 = OpLoad %11 %4
|
||||
OpLine %12 1012 17
|
||||
OpStore %8 %10
|
||||
OpLine %13 878 8
|
||||
OpLine %13 880 8
|
||||
OpCopyMemory %6 %8
|
||||
OpLine %9 8 1
|
||||
OpReturn
|
||||
|
Loading…
Reference in New Issue
Block a user