Commit 49f70376 by Ben Clayton

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/+/33354Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent bacd7e78
...@@ -2058,7 +2058,7 @@ namespace sw ...@@ -2058,7 +2058,7 @@ namespace sw
pending.pop_front(); pending.pop_front();
state->currentBlock = id; state->block = id;
switch (block.kind) switch (block.kind)
{ {
...@@ -2103,7 +2103,7 @@ namespace sw ...@@ -2103,7 +2103,7 @@ namespace sw
void SpirvShader::EmitNonLoop(EmitState *state) const void SpirvShader::EmitNonLoop(EmitState *state) const
{ {
auto &function = getFunction(state->function); auto &function = getFunction(state->function);
auto blockId = state->currentBlock; auto blockId = state->block;
auto block = function.getBlock(blockId); auto block = function.getBlock(blockId);
if (!state->visited.emplace(blockId).second) if (!state->visited.emplace(blockId).second)
...@@ -2137,7 +2137,7 @@ namespace sw ...@@ -2137,7 +2137,7 @@ namespace sw
void SpirvShader::EmitLoop(EmitState *state) const void SpirvShader::EmitLoop(EmitState *state) const
{ {
auto &function = getFunction(state->function); auto &function = getFunction(state->function);
auto blockId = state->currentBlock; auto blockId = state->block;
auto &block = function.getBlock(blockId); auto &block = function.getBlock(blockId);
auto mergeBlockId = block.mergeBlock; auto mergeBlockId = block.mergeBlock;
auto &mergeBlock = function.getBlock(mergeBlockId); auto &mergeBlock = function.getBlock(mergeBlockId);
...@@ -2219,7 +2219,7 @@ namespace sw ...@@ -2219,7 +2219,7 @@ namespace sw
} }
// Restore current block id after emitting loop blocks. // Restore current block id after emitting loop blocks.
state->currentBlock = blockId; state->block = blockId;
// Rebuild the loopActiveLaneMask from the loop back edges. // Rebuild the loopActiveLaneMask from the loop back edges.
loopActiveLaneMask = SIMD::Int(0); loopActiveLaneMask = SIMD::Int(0);
...@@ -4583,14 +4583,14 @@ namespace sw ...@@ -4583,14 +4583,14 @@ namespace sw
SpirvShader::EmitResult SpirvShader::EmitBranch(InsnIterator insn, EmitState *state) const SpirvShader::EmitResult SpirvShader::EmitBranch(InsnIterator insn, EmitState *state) const
{ {
auto target = Block::ID(insn.word(1)); auto target = Block::ID(insn.word(1));
state->addActiveLaneMaskEdge(state->currentBlock, target, state->activeLaneMask()); state->addActiveLaneMaskEdge(state->block, target, state->activeLaneMask());
return EmitResult::Terminator; return EmitResult::Terminator;
} }
SpirvShader::EmitResult SpirvShader::EmitBranchConditional(InsnIterator insn, EmitState *state) const SpirvShader::EmitResult SpirvShader::EmitBranchConditional(InsnIterator insn, EmitState *state) const
{ {
auto &function = getFunction(state->function); auto &function = getFunction(state->function);
auto block = function.getBlock(state->currentBlock); auto block = function.getBlock(state->block);
ASSERT(block.branchInstruction == insn); ASSERT(block.branchInstruction == insn);
auto condId = Object::ID(block.branchInstruction.word(1)); auto condId = Object::ID(block.branchInstruction.word(1));
...@@ -4611,7 +4611,7 @@ namespace sw ...@@ -4611,7 +4611,7 @@ namespace sw
SpirvShader::EmitResult SpirvShader::EmitSwitch(InsnIterator insn, EmitState *state) const SpirvShader::EmitResult SpirvShader::EmitSwitch(InsnIterator insn, EmitState *state) const
{ {
auto &function = getFunction(state->function); auto &function = getFunction(state->function);
auto block = function.getBlock(state->currentBlock); auto block = function.getBlock(state->block);
ASSERT(block.branchInstruction == insn); ASSERT(block.branchInstruction == insn);
auto selId = Object::ID(block.branchInstruction.word(1)); auto selId = Object::ID(block.branchInstruction.word(1));
...@@ -4666,13 +4666,13 @@ namespace sw ...@@ -4666,13 +4666,13 @@ namespace sw
SpirvShader::EmitResult SpirvShader::EmitPhi(InsnIterator insn, EmitState *state) const SpirvShader::EmitResult SpirvShader::EmitPhi(InsnIterator insn, EmitState *state) const
{ {
auto &function = getFunction(state->function); auto &function = getFunction(state->function);
auto currentBlock = function.getBlock(state->currentBlock); auto currentBlock = function.getBlock(state->block);
if (!currentBlock.isLoopMerge) if (!currentBlock.isLoopMerge)
{ {
// If this is a loop merge block, then don't attempt to update the // 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 // phi values from the ins. EmitLoop() has had to take special care
// of this phi in order to correctly deal with divergent lanes. // 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); LoadPhi(insn, state);
return EmitResult::Continue; return EmitResult::Continue;
...@@ -6391,7 +6391,7 @@ namespace sw ...@@ -6391,7 +6391,7 @@ namespace sw
void SpirvShader::EmitState::addOutputActiveLaneMaskEdge(Block::ID to, RValue<SIMD::Int> mask) 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) void SpirvShader::EmitState::addActiveLaneMaskEdge(Block::ID from, Block::ID to, RValue<SIMD::Int> mask)
......
...@@ -967,8 +967,8 @@ namespace sw ...@@ -967,8 +967,8 @@ namespace sw
SpirvRoutine *routine = nullptr; // The current routine being built. SpirvRoutine *routine = nullptr; // The current routine being built.
Function::ID function; // The current function 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. rr::Value *activeLaneMaskValue = nullptr; // The current active lane mask.
Block::ID currentBlock; // The current block being built.
Block::Set visited; // Blocks already built. Block::Set visited; // Blocks already built.
std::unordered_map<Block::Edge, RValue<SIMD::Int>, Block::Edge::Hash> edgeActiveLaneMasks; std::unordered_map<Block::Edge, RValue<SIMD::Int>, Block::Edge::Hash> edgeActiveLaneMasks;
std::deque<Block::ID> *pending; std::deque<Block::ID> *pending;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment