Skip to content

Commit 69fb9e3

Browse files
committed
Keep PassMode by reference instead of value.
1 parent 4d22af4 commit 69fb9e3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

crates/rustc_codegen_spirv/src/builder/byte_addressable_buffer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
170170
&mut self,
171171
result_type: Word,
172172
args: &[SpirvValue],
173-
pass_mode: PassMode,
173+
pass_mode: &PassMode,
174174
) -> SpirvValue {
175175
match pass_mode {
176176
PassMode::Ignore => {
@@ -181,7 +181,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
181181
}
182182
// PassMode::Pair is identical to PassMode::Direct - it's returned as a struct
183183
PassMode::Direct(_) | PassMode::Pair(_, _) => (),
184-
PassMode::Cast(_) => {
184+
PassMode::Cast(_, _) => {
185185
self.fatal("PassMode::Cast not supported in codegen_buffer_load_intrinsic")
186186
}
187187
PassMode::Indirect { .. } => {
@@ -342,14 +342,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
342342
}
343343

344344
/// Note: DOES NOT do bounds checking! Bounds checking is expected to be done in the caller.
345-
pub fn codegen_buffer_store_intrinsic(&mut self, args: &[SpirvValue], pass_mode: PassMode) {
345+
pub fn codegen_buffer_store_intrinsic(&mut self, args: &[SpirvValue], pass_mode: &PassMode) {
346346
// Signature: fn store<T>(array: &[u32], index: u32, value: T);
347347
let is_pair = match pass_mode {
348348
// haha shrug
349349
PassMode::Ignore => return,
350350
PassMode::Direct(_) => false,
351351
PassMode::Pair(_, _) => true,
352-
PassMode::Cast(_) => {
352+
PassMode::Cast(_, _) => {
353353
self.fatal("PassMode::Cast not supported in codegen_buffer_store_intrinsic")
354354
}
355355
PassMode::Indirect { .. } => {

crates/rustc_codegen_spirv/src/codegen_cx/declare.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ impl<'tcx> CodegenCx<'tcx> {
121121
self.unroll_loops_decorations.borrow_mut().insert(fn_id);
122122
}
123123
if attrs.buffer_load_intrinsic.is_some() {
124-
let mode = fn_abi.ret.mode;
124+
let mode = &fn_abi.ret.mode;
125125
self.buffer_load_intrinsic_fn_id
126126
.borrow_mut()
127127
.insert(fn_id, mode);
128128
}
129129
if attrs.buffer_store_intrinsic.is_some() {
130-
let mode = fn_abi.args.last().unwrap().mode;
130+
let mode = &fn_abi.args.last().unwrap().mode;
131131
self.buffer_store_intrinsic_fn_id
132132
.borrow_mut()
133133
.insert(fn_id, mode);

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ pub struct CodegenCx<'tcx> {
6767
/// Simple `panic!("...")` and builtin panics (from MIR `Assert`s) call `#[lang = "panic"]`.
6868
pub panic_fn_id: Cell<Option<Word>>,
6969
/// Intrinsic for loading a <T> from a &[u32]. The PassMode is the mode of the <T>.
70-
pub buffer_load_intrinsic_fn_id: RefCell<FxHashMap<Word, PassMode>>,
70+
pub buffer_load_intrinsic_fn_id: RefCell<FxHashMap<Word, &'tcx PassMode>>,
7171
/// Intrinsic for storing a <T> into a &[u32]. The PassMode is the mode of the <T>.
72-
pub buffer_store_intrinsic_fn_id: RefCell<FxHashMap<Word, PassMode>>,
72+
pub buffer_store_intrinsic_fn_id: RefCell<FxHashMap<Word, &'tcx PassMode>>,
7373
/// Builtin bounds-checking panics (from MIR `Assert`s) call `#[lang = "panic_bounds_check"]`.
7474
pub panic_bounds_check_fn_id: Cell<Option<Word>>,
7575

0 commit comments

Comments
 (0)