Skip to content

Commit

Permalink
Disable copy prop on memory loads
Browse files Browse the repository at this point in the history
  • Loading branch information
ncough committed Dec 10, 2024
1 parent b05a4bf commit e3f1dba
Show file tree
Hide file tree
Showing 5 changed files with 11,555 additions and 5,778 deletions.
2 changes: 1 addition & 1 deletion libASL/transforms.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ module CopyProp = struct
| Expr_Var v -> true
| Expr_Field (e,_) -> candidateExpr e
| Expr_Array (e,_) -> candidateExpr e
| Expr_TApply (f,_,_) -> (name_of_FIdent f = "Mem.read")
(*| Expr_TApply (f,_,_) -> (name_of_FIdent f = "Mem.read")*)
| _ -> false

let candidateIdent (i: ident) =
Expand Down
6 changes: 4 additions & 2 deletions tests/aslt/test_antlr.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ tests building and running of the antlr grammar. requires java
(stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Field ( (lexpr LExpr_Var ( (ident " PSTATE ") )) , (ident " N ") )) , (expr Expr_Slices ( (expr Expr_Var ( (ident " Cse0__5 ") )) , [ (slice Slice_LoWd ( (expr (integer 63)) , (expr (integer 1)) )) ] )) )))
(stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Array ( (lexpr LExpr_Var ( (ident " _R ") )) , (expr (integer 1)) )) , (expr Expr_Var ( (ident " Cse0__5 ") )) )))
(stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " SP_EL0 ") )) , (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 64))) ] , [ (expr Expr_Var ( (ident " SP_EL0 ") )) ; (expr (bits '1111111111111111111111111111111111111111111111111111111111100000')) ] )) )))
(stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Array ( (lexpr LExpr_Var ( (ident " _R ") )) , (expr (integer 1)) )) , (expr Expr_TApply ( (ident " Mem.read.0 ") , [ (targs (expr (integer 8))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 3)) )) ; (expr (integer 8)) ; (expr (integer 0)) ] )) )))
(stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Array ( (lexpr LExpr_Var ( (ident " _R ") )) , (expr (integer 2)) )) , (expr Expr_TApply ( (ident " Mem.read.0 ") , [ (targs (expr (integer 8))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 64))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 3)) )) ; (expr (bits '0000000000000000000000000000000000000000000000000000000000001000')) ] )) ; (expr (integer 8)) ; (expr (integer 0)) ] )) )))
(stmt (assignment_stmt Stmt_ConstDecl ( (type Type_Bits ( (expr (integer 64)) )) , (ident " Exp16__5 ") , (expr Expr_TApply ( (ident " Mem.read.0 ") , [ (targs (expr (integer 8))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 3)) )) ; (expr (integer 8)) ; (expr (integer 0)) ] )) )))
(stmt (assignment_stmt Stmt_ConstDecl ( (type Type_Bits ( (expr (integer 64)) )) , (ident " Exp18__5 ") , (expr Expr_TApply ( (ident " Mem.read.0 ") , [ (targs (expr (integer 8))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 64))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 3)) )) ; (expr (bits '0000000000000000000000000000000000000000000000000000000000001000')) ] )) ; (expr (integer 8)) ; (expr (integer 0)) ] )) )))
(stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Array ( (lexpr LExpr_Var ( (ident " _R ") )) , (expr (integer 1)) )) , (expr Expr_Var ( (ident " Exp16__5 ") )) )))
(stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Array ( (lexpr LExpr_Var ( (ident " _R ") )) , (expr (integer 2)) )) , (expr Expr_Var ( (ident " Exp18__5 ") )) )))
(stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Array ( (lexpr LExpr_Var ( (ident " _R ") )) , (expr (integer 3)) )) , (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 64))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 3)) )) ; (expr (bits '0000000000000000000000000000000000000000000000000000000010000000')) ] )) )))
(stmt (call_stmt Stmt_TCall ( (ident " Mem.set.0 ") , [ (targs (expr (integer 8))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 3)) )) ; (expr (integer 8)) ; (expr (integer 0)) ; (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 1)) )) ] )))
(stmt (call_stmt Stmt_TCall ( (ident " Mem.set.0 ") , [ (targs (expr (integer 8))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 64))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 3)) )) ; (expr (bits '0000000000000000000000000000000000000000000000000000000000001000')) ] )) ; (expr (integer 8)) ; (expr (integer 0)) ; (expr Expr_Array ( (expr Expr_Var ( (ident " _R ") )) , (expr (integer 2)) )) ] )))
Expand Down
Loading

0 comments on commit e3f1dba

Please sign in to comment.