Reduce lifetime of address temporary.
After traversing the lvalue node tree we're fully done computing the
relative address and emitting any pointer arithmetic that might have
been needed. So the temporary that would have been used for that is no
longer needed.
Change-Id: I0a10bff979128f03544d0f8aa860c29f8867973a
Reviewed-on: https://swiftshader-review.googlesource.com/13948
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
index d3a0184..0d45f81 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -2327,8 +2327,7 @@
{
Instruction *insert = new Instruction(sw::Shader::OPCODE_INSERT);
- Temporary address(this);
- lvalue(insert->dst, address, dst);
+ lvalue(insert->dst, dst);
insert->src[0].type = insert->dst.type;
insert->src[0].index = insert->dst.index;
@@ -2342,8 +2341,7 @@
{
Instruction *mov1 = new Instruction(sw::Shader::OPCODE_MOV);
- Temporary address(this);
- int swizzle = lvalue(mov1->dst, address, dst);
+ int swizzle = lvalue(mov1->dst, dst);
source(mov1->src[0], src);
mov1->src[0].swizzle = swizzleSwizzle(mov1->src[0].swizzle, swizzle);
@@ -2365,8 +2363,9 @@
}
}
- int OutputASM::lvalue(sw::Shader::DestinationParameter &dst, Temporary &address, TIntermTyped *node)
+ int OutputASM::lvalue(sw::Shader::DestinationParameter &dst, TIntermTyped *node)
{
+ Temporary address(this);
TIntermTyped *root = nullptr;
unsigned int offset = 0;
unsigned char mask = 0xF;