blob: 0da4ee71f376400bea5d23152dca6346f46477fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Microsoft.Boogie;
namespace GPUVerify
{
class LocalVariableAccessReplacer : StandardVisitor
{
GPUVerifierAsynchronous verifier;
public LocalVariableAccessReplacer(GPUVerifierAsynchronous verifier)
{
this.verifier = verifier;
}
public override AssignLhs VisitSimpleAssignLhs(SimpleAssignLhs node)
{
if (verifier.GetThreadLocalVariables().Contains(node.AssignedVariable.Decl))
{
List<Expr> indexes = new List<Expr>();
indexes.Add(verifier.MakeThreadIdExpr(node.tok));
return new MapAssignLhs(node.tok, node, indexes);
}
return node;
}
public override Expr VisitIdentifierExpr(IdentifierExpr node)
{
if (verifier.GetThreadLocalVariables().Contains(node.Decl))
{
ExprSeq MapNameAndThreadID = new ExprSeq();
MapNameAndThreadID.Add(new IdentifierExpr(node.tok, node.Decl));
MapNameAndThreadID.Add(verifier.MakeThreadIdExpr(node.tok));
return new NAryExpr(node.tok, new MapSelect(node.tok, 1), MapNameAndThreadID);
}
return node;
}
}
}
|