Skip to content

Commit 6378174

Browse files
Remove DummyInstr instructiontype
1 parent b86dea8 commit 6378174

File tree

9 files changed

+10
-34
lines changed

9 files changed

+10
-34
lines changed

src/check.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,7 @@ and checkInstr (i: instr) =
835835
if !ignoreInstr i then ()
836836
else
837837
match i with
838-
DummyInstr _ -> ()
839-
| Set (dest, e, l, el) ->
838+
Set (dest, e, l, el) ->
840839
currentLoc := l;
841840
currentExpLoc := el;
842841
let t = checkLval false false dest in

src/cil.ml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,7 @@ and stmtkind =
848848
(** Instructions. They may cause effects directly but may not have control
849849
flow.*)
850850
and instr =
851-
DummyInstr of location
852-
| Set of lval * exp * location * location (** An assignment. A cast is present
851+
Set of lval * exp * location * location (** An assignment. A cast is present
853852
if the exp has different type
854853
from lval.
855854
Second location is just for expression when inside condition. *)
@@ -1136,8 +1135,7 @@ let stripUnderscores (s: string) : string =
11361135

11371136
let get_instrLoc (inst : instr) =
11381137
match inst with
1139-
DummyInstr(loc) -> loc
1140-
| Set(_, _, loc, _) -> loc
1138+
Set(_, _, loc, _) -> loc
11411139
| Call(_, _, _, loc, _) -> loc
11421140
| VarDecl(_,loc) -> loc
11431141
let get_globalLoc (g : global) =
@@ -3587,8 +3585,7 @@ class defaultCilPrinterClass : cilPrinter = object (self)
35873585
(*** INSTRUCTIONS ****)
35883586
method pInstr () (i:instr) = (* imperative instruction *)
35893587
match i with
3590-
DummyInstr(l) -> text ""
3591-
| Set(lv,e,l,el) -> begin
3588+
Set(lv,e,l,el) -> begin
35923589
(* Be nice to some special cases *)
35933590
match e with
35943591
BinOp((PlusA|PlusPI|IndexPI),Lval(lv'),Const(CInt(one,_,_)),_)
@@ -5382,7 +5379,6 @@ and childrenInstr (vis: cilVisitor) (i: instr) : instr =
53825379
let fExp e = visitCilExpr vis e in
53835380
let fLval lv = visitCilLval vis lv in
53845381
match i with
5385-
| DummyInstr(l) -> i
53865382
| VarDecl(v,l) -> i
53875383
| Set(lv,e,l,el) ->
53885384
let lv' = fLval lv in let e' = fExp e in

src/cil.mli

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,8 +1092,7 @@ function call, or an inline assembly instruction. *)
10921092

10931093
(** Instructions. *)
10941094
and instr =
1095-
DummyInstr of location
1096-
| Set of lval * exp * location * location
1095+
Set of lval * exp * location * location
10971096
(** An assignment. The type of the expression is guaranteed to be the same
10981097
with that of the lvalue.
10991098
Second location is just for expression when inside condition. *)

src/ext/pta/ptranal.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,7 @@ let rec analyze_init (i : init ) : A.tau =
269269

270270
let analyze_instr (i : instr ) : unit =
271271
match i with
272-
DummyInstr _ -> ()
273-
| Set (lval, rhs, l, el) ->
272+
Set (lval, rhs, l, el) ->
274273
A.assign (analyze_lval lval) (analyze_expr rhs)
275274
| Call (res, fexpr, actuals, l, el) ->
276275
if not (isFunctionType (typeOf fexpr)) then

src/ext/syntacticsearch/funcVar.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ let rec search_instr_list_for_var list name varid includeCallTmp =
159159
search_expression exp name loc varid includeCallTmp
160160
@ search_expression_list exp_list name loc varid includeCallTmp
161161
@ search_instr_list_for_var xs name varid includeCallTmp
162-
(* Should I consider Asm too? *)
163-
| _ :: xs -> search_instr_list_for_var xs name varid includeCallTmp
164162
| [] -> []
165163

166164
(* Finds a variable in a list of statements *)

src/ext/zrapp/availexps.ml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,6 @@ let eh_handle_inst i eh =
243243
(eh_kill_mem eh;
244244
eh_kill_addrof_or_global eh;
245245
eh)
246-
| DummyInstr(_) ->
247-
let _,d = UD.computeUseDefInstr i in
248-
(UD.VS.iter (fun vi ->
249-
eh_kill_vi eh vi) d;
250-
eh)
251246
| VarDecl _ -> raise (Unimplemented "VarDecl") (* VarDecl instruction is not supported for availexps, to make availexps work for programs without VLA *)
252247
(* make sure to set alwaysGenerateVarDecl in cabs2cil.ml to false. To support VLA, implement this. *)
253248

src/ext/zrapp/availexpslv.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,6 @@ let lvh_handle_inst i lvh =
305305
end;
306306
lvh
307307
end
308-
| DummyInstr(_) -> begin
309-
let _,d = UD.computeUseDefInstr i in
310-
UD.VS.iter (fun vi ->
311-
lvh_kill_vi lvh vi) d;
312-
lvh
313-
end
314308
| VarDecl _ -> raise (Unimplemented "VarDecl") (* VarDecl instruction is not supported for availexpslv, to make availexpslv work for programs without VLA *)
315309
(* make sure to set alwaysGenerateVarDecl in cabs2cil.ml to false. To support VLA, implement this. *)
316310

src/ext/zrapp/reachingdefs.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,7 @@ let getDefRhs didstmh stmdat defId =
273273
| _ -> false)
274274
| None -> false) iihl in
275275
(match i with
276-
DummyInstr _ -> None
277-
| Set((lh,_),e,_,_) ->
276+
Set((lh,_),e,_,_) ->
278277
(match lh with
279278
Var(vi') ->
280279
(IH.add rhsHtbl defId (Some(RDExp(e),stm.sid,iosh_in));

src/frontc/cabs2cil.ml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -842,8 +842,7 @@ module BlockChunk =
842842
{l with synthetic = true}
843843

844844
let doInstr: instr -> instr = function
845-
DummyInstr(eloc) -> DummyInstr(doLoc eloc)
846-
| Set (l, e, loc, eloc) -> Set (l, e, doLoc loc, doLoc eloc)
845+
Set (l, e, loc, eloc) -> Set (l, e, doLoc loc, doLoc eloc)
847846
| VarDecl (v, loc) -> VarDecl (v, doLoc loc)
848847
| Call (l, f, a, loc, eloc) -> Call (l, f, a, doLoc loc, doLoc eloc)
849848

@@ -938,8 +937,7 @@ module BlockChunk =
938937
c
939938

940939
let eDoInstr: instr -> instr = function
941-
DummyInstr(eloc) -> DummyInstr(doLoc eloc)
942-
| Set (l, e, loc, eloc) -> Set (l, e, loc, doLoc eloc)
940+
Set (l, e, loc, eloc) -> Set (l, e, loc, doLoc eloc)
943941
| VarDecl (v, loc) -> VarDecl (v, loc)
944942
| Call (l, f, a, loc, eloc) -> Call (l, f, a, loc, doLoc eloc)
945943

@@ -6479,8 +6477,7 @@ and doDecl (isglobal: bool) (isstmt: bool) : A.definition -> chunk = function
64796477
unnecessary warning than to break CIL's invariant that
64806478
return statements are inserted properly. *)
64816479
let instrFallsThrough (i : instr) = match i with
6482-
DummyInstr _ -> true
6483-
| Set _ -> true
6480+
Set _ -> true
64846481
| Call (None, Lval (Var e, NoOffset), _, _, _) ->
64856482
(* See if this is exit, or if it has the noreturn attribute *)
64866483
if e.vname = "exit" then false

0 commit comments

Comments
 (0)