SpirvShader: Rename EmitState::currentBlock to block
No other fields in this class are prefixed with 'current' and it's in a class named State, so rename to make consistent.
Bug: b/126126820
Change-Id: I8eb26546141d1c11beb9acf57883d3d0835847b2
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33354
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index e7845c3..ce621ee 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -2058,7 +2058,7 @@
pending.pop_front();
- state->currentBlock = id;
+ state->block = id;
switch (block.kind)
{
@@ -2103,7 +2103,7 @@
void SpirvShader::EmitNonLoop(EmitState *state) const
{
auto &function = getFunction(state->function);
- auto blockId = state->currentBlock;
+ auto blockId = state->block;
auto block = function.getBlock(blockId);
if (!state->visited.emplace(blockId).second)
@@ -2137,7 +2137,7 @@
void SpirvShader::EmitLoop(EmitState *state) const
{
auto &function = getFunction(state->function);
- auto blockId = state->currentBlock;
+ auto blockId = state->block;
auto &block = function.getBlock(blockId);
auto mergeBlockId = block.mergeBlock;
auto &mergeBlock = function.getBlock(mergeBlockId);
@@ -2219,7 +2219,7 @@
}
// Restore current block id after emitting loop blocks.
- state->currentBlock = blockId;
+ state->block = blockId;
// Rebuild the loopActiveLaneMask from the loop back edges.
loopActiveLaneMask = SIMD::Int(0);
@@ -4583,14 +4583,14 @@
SpirvShader::EmitResult SpirvShader::EmitBranch(InsnIterator insn, EmitState *state) const
{
auto target = Block::ID(insn.word(1));
- state->addActiveLaneMaskEdge(state->currentBlock, target, state->activeLaneMask());
+ state->addActiveLaneMaskEdge(state->block, target, state->activeLaneMask());
return EmitResult::Terminator;
}
SpirvShader::EmitResult SpirvShader::EmitBranchConditional(InsnIterator insn, EmitState *state) const
{
auto &function = getFunction(state->function);
- auto block = function.getBlock(state->currentBlock);
+ auto block = function.getBlock(state->block);
ASSERT(block.branchInstruction == insn);
auto condId = Object::ID(block.branchInstruction.word(1));
@@ -4611,7 +4611,7 @@
SpirvShader::EmitResult SpirvShader::EmitSwitch(InsnIterator insn, EmitState *state) const
{
auto &function = getFunction(state->function);
- auto block = function.getBlock(state->currentBlock);
+ auto block = function.getBlock(state->block);
ASSERT(block.branchInstruction == insn);
auto selId = Object::ID(block.branchInstruction.word(1));
@@ -4666,13 +4666,13 @@
SpirvShader::EmitResult SpirvShader::EmitPhi(InsnIterator insn, EmitState *state) const
{
auto &function = getFunction(state->function);
- auto currentBlock = function.getBlock(state->currentBlock);
+ auto currentBlock = function.getBlock(state->block);
if (!currentBlock.isLoopMerge)
{
// If this is a loop merge block, then don't attempt to update the
// phi values from the ins. EmitLoop() has had to take special care
// of this phi in order to correctly deal with divergent lanes.
- StorePhi(state->currentBlock, insn, state, currentBlock.ins);
+ StorePhi(state->block, insn, state, currentBlock.ins);
}
LoadPhi(insn, state);
return EmitResult::Continue;
@@ -6391,7 +6391,7 @@
void SpirvShader::EmitState::addOutputActiveLaneMaskEdge(Block::ID to, RValue<SIMD::Int> mask)
{
- addActiveLaneMaskEdge(currentBlock, to, mask & activeLaneMask());
+ addActiveLaneMaskEdge(block, to, mask & activeLaneMask());
}
void SpirvShader::EmitState::addActiveLaneMaskEdge(Block::ID from, Block::ID to, RValue<SIMD::Int> mask)
diff --git a/src/Pipeline/SpirvShader.hpp b/src/Pipeline/SpirvShader.hpp
index 141f272..a0c07be 100644
--- a/src/Pipeline/SpirvShader.hpp
+++ b/src/Pipeline/SpirvShader.hpp
@@ -967,8 +967,8 @@
SpirvRoutine *routine = nullptr; // The current routine being built.
Function::ID function; // The current function being built.
+ Block::ID block; // The current block being built.
rr::Value *activeLaneMaskValue = nullptr; // The current active lane mask.
- Block::ID currentBlock; // The current block being built.
Block::Set visited; // Blocks already built.
std::unordered_map<Block::Edge, RValue<SIMD::Int>, Block::Edge::Hash> edgeActiveLaneMasks;
std::deque<Block::ID> *pending;