[spv-out] Move ExpressionPointer to back::spv::block, remove pub.

This commit is contained in:
Jim Blandy
2021-10-01 10:01:02 -07:00
committed by Dzmitry Malyshau
parent 9cc2b730b7
commit 6912cb3594
2 changed files with 21 additions and 24 deletions

View File

@@ -1,11 +1,8 @@
//! Implementations for `BlockContext` methods.
use super::{
index::{BoundsCheckResult, ExpressionPointer},
make_local,
selection::Selection,
Block, BlockContext, Dimension, Error, Instruction, LocalType, LookupType, LoopContext,
ResultMember, Writer, WriterFlags,
index::BoundsCheckResult, make_local, selection::Selection, Block, BlockContext, Dimension,
Error, Instruction, LocalType, LookupType, LoopContext, ResultMember, Writer, WriterFlags,
};
use crate::{arena::Handle, proc::TypeResolution};
use spirv::Word;
@@ -19,6 +16,25 @@ fn get_dimension(type_inner: &crate::TypeInner) -> Dimension {
}
}
/// The results of emitting code for a left-hand-side expression.
///
/// On success, `write_expression_pointer` returns one of these.
enum ExpressionPointer {
/// The pointer to the expression's value is available, as the value of the
/// expression with the given id.
Ready { pointer_id: Word },
/// The access expression must be conditional on the value of `condition`, a boolean
/// expression that is true if all indices are in bounds. If `condition` is true, then
/// `access` is an `OpAccessChain` instruction that will compute a pointer to the
/// expression's value. If `condition` is false, then executing `access` would be
/// undefined behavior.
Conditional {
condition: Word,
access: Instruction,
},
}
impl Writer {
// Flip Y coordinate to adjust for coordinate space difference
// between SPIR-V and our IR.

View File

@@ -3,25 +3,6 @@
use super::{selection::Selection, Block, BlockContext, Error, IdGenerator, Instruction, Word};
use crate::{arena::Handle, proc::BoundsCheckPolicy};
/// The results of emitting code for a left-hand-side expression.
///
/// On success, `write_expression_pointer` returns one of these.
pub(super) enum ExpressionPointer {
/// The pointer to the expression's value is available, as the value of the
/// expression with the given id.
Ready { pointer_id: Word },
/// The access expression must be conditional on the value of `condition`, a boolean
/// expression that is true if all indices are in bounds. If `condition` is true, then
/// `access` is an `OpAccessChain` instruction that will compute a pointer to the
/// expression's value. If `condition` is false, then executing `access` would be
/// undefined behavior.
Conditional {
condition: Word,
access: Instruction,
},
}
/// The results of performing a bounds check.
///
/// On success, `write_bounds_check` returns a value of this type.