| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# For making sure that no conflicts occur |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package PDLA::PP::SymTab; |
|
4
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
760
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
|
7
|
2
|
|
|
2
|
0
|
8
|
my($type,%ids) = @_; |
|
8
|
2
|
|
|
|
|
14
|
my($this) = bless { |
|
9
|
|
|
|
|
|
|
Id2Sym => {}, |
|
10
|
|
|
|
|
|
|
Sym2Id => {}, |
|
11
|
|
|
|
|
|
|
IsPar => {}, |
|
12
|
|
|
|
|
|
|
}, $type; |
|
13
|
2
|
|
|
|
|
11
|
$this->add_ids(%ids); |
|
14
|
2
|
|
|
|
|
9
|
$this; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub add_ids { |
|
18
|
4
|
|
|
4
|
0
|
9
|
my($this,%hash) = @_; |
|
19
|
4
|
|
|
|
|
13
|
for(keys %hash) { |
|
20
|
4
|
|
|
|
|
21
|
$this->{Id2Sym}{$_} = $hash{$_}; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# This usually sets the 'undef' key to whatever is in $_, because the |
|
23
|
|
|
|
|
|
|
# object in $hash{$_} is usually a scalar, not an array. I know this |
|
24
|
|
|
|
|
|
|
# becuase this function is called by AddArgsyms in PDLA::PP, which |
|
25
|
|
|
|
|
|
|
# conructs the %hash to be |
|
26
|
|
|
|
|
|
|
# |
|
27
|
|
|
|
|
|
|
# sym_name => sym_name |
|
28
|
|
|
|
|
|
|
# |
|
29
|
|
|
|
|
|
|
# The only other place that invokes this code is the constructor, |
|
30
|
|
|
|
|
|
|
# which itself is called by MkDefSyms in PDLA::PP. That invocation is |
|
31
|
|
|
|
|
|
|
# called with %hash set as |
|
32
|
|
|
|
|
|
|
# |
|
33
|
|
|
|
|
|
|
# _PDLA_ThisTrans => ["__privtrans",C::Type->new(undef,"$_[0] *foo")] |
|
34
|
|
|
|
|
|
|
# |
|
35
|
|
|
|
|
|
|
# AFAIK, Sym2Id is never used anywhere in the code generation, and |
|
36
|
|
|
|
|
|
|
# the setting of undef throws warning messages, so I am going to |
|
37
|
|
|
|
|
|
|
# comment-out this line for now. --David Mertens, 12-12-2011 |
|
38
|
|
|
|
|
|
|
#$this->{Sym2Id}{$hash{$_}->[0]} = $_; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub add_params { |
|
43
|
2
|
|
|
2
|
0
|
23
|
my($this,%hash) = @_; |
|
44
|
2
|
|
|
|
|
10
|
$this->add_ids(%hash); |
|
45
|
2
|
|
|
|
|
6
|
for(keys %hash) { |
|
46
|
2
|
|
|
|
|
10
|
$this->{IsPar}{$_} = 1; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub decl_locals { |
|
51
|
2
|
|
|
2
|
0
|
5
|
my($this) = @_; |
|
52
|
2
|
|
|
|
|
3
|
my $str; |
|
53
|
2
|
|
|
|
|
3
|
for(keys %{$this->{Id2Sym}}) { |
|
|
2
|
|
|
|
|
11
|
|
|
54
|
4
|
100
|
|
|
|
15
|
if(!$this->{IsPar}{$_}) { |
|
55
|
|
|
|
|
|
|
$str .= $this->{Id2Sym}{$_}[1] |
|
56
|
2
|
|
|
|
|
10
|
->get_decl($this->{Id2Sym}{$_}[0]).";"; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} |
|
59
|
2
|
|
|
|
|
8
|
$str; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
0
|
0
|
|
sub get_params { |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub get_symname { |
|
66
|
107
|
|
|
107
|
0
|
136
|
my($this,$id) = @_; |
|
67
|
107
|
50
|
|
|
|
232
|
confess "Symbol not found: $id\n" if(!defined($this->{Id2Sym}{$id})); |
|
68
|
107
|
|
|
|
|
1016
|
return $this->{Id2Sym}{$id}[0]; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |