diff options
Diffstat (limited to 'Source/GPUVerify/VariableDualiser.cs')
-rw-r--r-- | Source/GPUVerify/VariableDualiser.cs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/GPUVerify/VariableDualiser.cs b/Source/GPUVerify/VariableDualiser.cs index db2320bd..5cbfed99 100644 --- a/Source/GPUVerify/VariableDualiser.cs +++ b/Source/GPUVerify/VariableDualiser.cs @@ -21,18 +21,27 @@ namespace GPUVerify {
if (!(node.Decl is Constant))
{
- return new IdentifierExpr(node.tok, new LocalVariable(node.tok, new TypedIdent(node.tok, node.Decl.Name + "$" + id, node.Decl.TypedIdent.Type)));
+ return new IdentifierExpr(node.tok, new LocalVariable(node.tok, DualiseTypedIdent(node.Decl)));
+ }
+
+ if (GPUVerifier.IsThreadLocalIdConstant(node.Decl))
+ {
+ return new IdentifierExpr(node.tok, new Constant(node.tok, DualiseTypedIdent(node.Decl)));
}
return node;
}
+ private TypedIdent DualiseTypedIdent(Variable v)
+ {
+ return new TypedIdent(v.tok, v.Name + "$" + id, v.TypedIdent.Type);
+ }
public override Variable VisitVariable(Variable node)
{
- if (!(node is Constant))
+ if (!(node is Constant) || GPUVerifier.IsThreadLocalIdConstant(node))
{
- node.TypedIdent = new TypedIdent(node.tok, node.Name + "$" + id, node.TypedIdent.Type);
+ node.TypedIdent = DualiseTypedIdent(node);
node.Name = node.Name + "$" + id;
return node;
}
@@ -40,7 +49,6 @@ namespace GPUVerify return base.VisitVariable(node);
}
-
}
}
|