Skip to content

Commit 17e576d

Browse files
catamorphismgraydon
authored andcommitted
---
yaml --- r: 2638 b: refs/heads/master c: e16b097 h: refs/heads/master v: v3
1 parent cdfddaa commit 17e576d

File tree

10 files changed

+622
-885
lines changed

10 files changed

+622
-885
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: dc83c846623c2d9c0ad31ebe769def34d8f1579f
2+
refs/heads/master: e16b097599ee73a909df7ffbbaaf30f25a7057e3

trunk/src/comp/middle/tstate/ann.rs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ type poststate = bitv::t; /* 1 means "this variable is definitely initialized"
2020
initialized" */
2121

2222
/* named thus so as not to confuse with prestate and poststate */
23-
type pre_and_post = rec(precond precondition, postcond postcondition);
23+
type pre_and_post = @rec(precond precondition, postcond postcondition);
2424
/* FIXME: once it's implemented: */
2525
// : ((*.precondition).nbits == (*.postcondition).nbits);
2626

2727
type pre_and_post_state = rec(prestate prestate, poststate poststate);
2828

29-
type ts_ann = rec(pre_and_post conditions, pre_and_post_state states);
29+
type ts_ann = @rec(pre_and_post conditions, pre_and_post_state states);
3030

3131
fn true_precond(uint num_vars) -> precond {
3232
be bitv::create(num_vars, false);
@@ -49,18 +49,18 @@ fn false_postcond(uint num_vars) -> postcond {
4949
}
5050

5151
fn empty_pre_post(uint num_vars) -> pre_and_post {
52-
ret(rec(precondition=empty_prestate(num_vars),
53-
postcondition=empty_poststate(num_vars)));
52+
ret(@rec(precondition=empty_prestate(num_vars),
53+
postcondition=empty_poststate(num_vars)));
5454
}
5555

5656
fn empty_states(uint num_vars) -> pre_and_post_state {
5757
ret(rec(prestate=true_precond(num_vars),
58-
poststate=true_postcond(num_vars)));
58+
poststate=true_postcond(num_vars)));
5959
}
6060

6161
fn empty_ann(uint num_vars) -> ts_ann {
62-
ret(rec(conditions=empty_pre_post(num_vars),
63-
states=empty_states(num_vars)));
62+
ret(@rec(conditions=empty_pre_post(num_vars),
63+
states=empty_states(num_vars)));
6464
}
6565

6666
fn get_pre(&pre_and_post p) -> precond {
@@ -111,25 +111,25 @@ fn set_in_poststate(uint i, &pre_and_post_state s) -> bool {
111111

112112
// Sets all the bits in a's precondition to equal the
113113
// corresponding bit in p's precondition.
114-
fn set_precondition(@ts_ann a, &precond p) -> () {
114+
fn set_precondition(ts_ann a, &precond p) -> () {
115115
bitv::copy(a.conditions.precondition, p);
116116
}
117117

118118
// Sets all the bits in a's postcondition to equal the
119119
// corresponding bit in p's postcondition.
120-
fn set_postcondition(@ts_ann a, &postcond p) -> () {
120+
fn set_postcondition(ts_ann a, &postcond p) -> () {
121121
bitv::copy(a.conditions.postcondition, p);
122122
}
123123

124124
// Sets all the bits in a's prestate to equal the
125125
// corresponding bit in p's prestate.
126-
fn set_prestate(@ts_ann a, &prestate p) -> bool {
126+
fn set_prestate(ts_ann a, &prestate p) -> bool {
127127
ret bitv::copy(a.states.prestate, p);
128128
}
129129

130130
// Sets all the bits in a's postcondition to equal the
131131
// corresponding bit in p's postcondition.
132-
fn set_poststate(@ts_ann a, &poststate p) -> bool {
132+
fn set_poststate(ts_ann a, &poststate p) -> bool {
133133
ret bitv::copy(a.states.poststate, p);
134134
}
135135

@@ -150,6 +150,16 @@ fn relax_prestate(uint i, &prestate p) -> bool {
150150
ret was_set;
151151
}
152152

153+
// Clears all the bits in p
154+
fn clear(&precond p) -> () {
155+
bitv::clear(p);
156+
}
157+
158+
// Sets all the bits in p
159+
fn set(&precond p) -> () {
160+
bitv::set_all(p);
161+
}
162+
153163
fn ann_precond(&ts_ann a) -> precond {
154164
ret a.conditions.precondition;
155165
}
@@ -163,8 +173,8 @@ fn ann_poststate(&ts_ann a) -> poststate {
163173
}
164174

165175
fn pp_clone(&pre_and_post p) -> pre_and_post {
166-
ret rec(precondition=clone(p.precondition),
167-
postcondition=clone(p.postcondition));
176+
ret @rec(precondition=clone(p.precondition),
177+
postcondition=clone(p.postcondition));
168178
}
169179

170180
fn clone(prestate p) -> prestate {

0 commit comments

Comments
 (0)