Skip to content

Commit

Permalink
Merge pull request #114 from UQ-PAC/mem_load
Browse files Browse the repository at this point in the history
Disable CopyProp on Memory Loads
  • Loading branch information
ncough authored Dec 10, 2024
2 parents b05a4bf + e3f1dba commit 797aeb5
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 797aeb5

Please sign in to comment.