Skip to content

Commit 44bb556

Browse files
committed
ARM: some support for rotate operand
1 parent 9d3fea2 commit 44bb556

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

chb/ast/ASTCPrettyPrinter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def visit_memref(self, memref: AST.ASTMemRef) -> None:
501501
memexpb = cast(AST.ASTBinaryOp, memref.memexp)
502502
exp1 = memexpb.exp1
503503
exp2 = memexpb.exp2
504-
if exp1.is_ast_lval_expr:
504+
if exp1.is_ast_lval_expr and memexpb.op == "plus":
505505
exp1.accept(self)
506506
self.ccode.write("[")
507507
exp2.accept(self)

chb/invariants/XXpr.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,12 +1040,25 @@ def __str__(self) -> str:
10401040
else:
10411041
return "(" + self.operator + " " + str(args[0]) + ")"
10421042
elif len(args) == 2:
1043-
return (
1044-
'('
1045-
+ str(args[0])
1046-
+ xpr_operator_strings[self.operator]
1047-
+ str(args[1])
1048-
+ ')')
1043+
if self.operator in xpr_operator_strings:
1044+
return (
1045+
'('
1046+
+ str(args[0])
1047+
+ xpr_operator_strings[self.operator]
1048+
+ str(args[1])
1049+
+ ')')
1050+
elif self.operator == "xf_ror":
1051+
return "(" + str(args[0]) + " rotate-right " + str(args[1]) + ")"
1052+
else:
1053+
return (
1054+
"("
1055+
+ str(args[0])
1056+
+ " "
1057+
+ self.operator
1058+
+ " "
1059+
+ str(args[1])
1060+
+ ")")
1061+
10491062
else:
10501063
return (
10511064
'('

0 commit comments

Comments
 (0)