Commit a71b8e95 by Chris Forbes

Add analysis pass support for OpLoad and OpAccessChain

These are our first instructions which yield ssavalues. For OpAccessChain, also track the base pointer (which we always know at compile time, until we do full variable pointers support). The value representation for OpAccessChain's result has two parts: - per-lane Int offset into whatever the thing is - shared (and statically known) base reference. Bug: b/124388146 Change-Id: I364375719b6e396b802de06093454c8f0e76adb6 Reviewed-on: https://swiftshader-review.googlesource.com/c/24598Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com>
parent 7edf5344
...@@ -215,6 +215,27 @@ namespace sw ...@@ -215,6 +215,27 @@ namespace sw
UNIMPLEMENTED("These instructions should have already been lowered."); UNIMPLEMENTED("These instructions should have already been lowered.");
break; break;
case spv::OpLoad:
case spv::OpAccessChain:
// Instructions that yield an ssavalue.
{
auto typeId = insn.word(1);
auto resultId = insn.word(2);
auto &object = defs[resultId];
object.kind = Object::Kind::Value;
object.definition = insn;
object.sizeInComponents = getType(typeId).sizeInComponents;
if (insn.opcode() == spv::OpAccessChain)
{
// interior ptr has two parts:
// - logical base ptr, common across all lanes and known at compile time
// - per-lane offset
object.pointerBase = insn.word(3);
}
break;
}
case spv::OpStore: case spv::OpStore:
case spv::OpReturn: case spv::OpReturn:
// Don't need to do anything during analysis pass // Don't need to do anything during analysis pass
......
...@@ -116,6 +116,7 @@ namespace sw ...@@ -116,6 +116,7 @@ namespace sw
spv::StorageClass storageClass; spv::StorageClass storageClass;
uint32_t sizeInComponents = 0; uint32_t sizeInComponents = 0;
bool isBuiltInBlock = false; bool isBuiltInBlock = false;
uint32_t pointerBase = 0;
enum class Kind enum class Kind
{ {
......
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