Skip to content

Commit 946437f

Browse files
committed
CHB:ARM: exclude stack pointer from def-use-high
1 parent 277e79e commit 946437f

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

CodeHawk/CHB/bchlib/bCHFunctionInfo.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,8 @@ object (self)
15451545

15461546
method is_register_variable = varmgr#is_register_variable
15471547

1548+
method is_stackpointer_variable = varmgr#is_stackpointer_variable
1549+
15481550
method is_initial_register_value = varmgr#is_initial_register_value
15491551

15501552
method is_initial_mips_argument_value = varmgr#is_initial_mips_argument_value

CodeHawk/CHB/bchlib/bCHLibTypes.mli

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3564,6 +3564,7 @@ object ('a)
35643564

35653565
method is_auxiliary_variable: bool
35663566
method is_register_variable: bool
3567+
method is_stackpointer_variable: bool
35673568
method is_mips_argument_variable: bool
35683569
method is_arm_argument_variable: bool
35693570
method is_arm_extension_register_variable: bool
@@ -3949,6 +3950,10 @@ object
39493950
(** Returns [true] if [var] is a register variable (of any architecture). *)
39503951
method is_register_variable: variable_t -> bool
39513952

3953+
(** Returns [true] if [var] is a register used as a stackpointer (in the
3954+
current architecture). *)
3955+
method is_stackpointer_variable: variable_t -> bool
3956+
39523957
(** Returns the register associated with [var].
39533958
39543959
Returns [Error] if [var] is not a register variable or [var] cannot be
@@ -4452,6 +4457,10 @@ class type function_environment_int =
44524457
(** Returns [true] if [var] is a register variable (of any architecture). *)
44534458
method is_register_variable: variable_t -> bool
44544459

4460+
(** Returns [true] if [var] is a register variable that used by the current
4461+
architecture as a stackpointer. *)
4462+
method is_stackpointer_variable: variable_t -> bool
4463+
44554464
(** Returns the register associated with [var].
44564465
44574466
Returns [Error] if [var] is not a register variable or [var] cannot be

CodeHawk/CHB/bchlib/bCHVariable.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,11 @@ object (self:'a)
420420
method is_register_variable =
421421
match denotation with RegisterVariable _ -> true | _ -> false
422422

423+
method is_stackpointer_variable =
424+
match denotation with
425+
| RegisterVariable r -> BCHCPURegisters.is_stackpointer_register r
426+
| _ -> false
427+
423428
method is_mips_argument_variable =
424429
match denotation with
425430
| RegisterVariable reg ->
@@ -927,6 +932,10 @@ object (self)
927932
tfold_default
928933
(fun av -> av#is_register_variable) false (self#get_variable v)
929934

935+
method is_stackpointer_variable (v: variable_t) =
936+
tfold_default
937+
(fun av -> av#is_stackpointer_variable) false (self#get_variable v)
938+
930939
method is_mips_argument_variable (v:variable_t) =
931940
tfold_default
932941
(fun av -> av#is_mips_argument_variable) false (self#get_variable v)

CodeHawk/CHB/bchlibarm32/bCHTranslateARMToCHIF.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@ let translate_arm_instruction
597597
let xw = inv#rewrite_expr x in
598598
let xs = simplify_xpr xw in
599599
let disvars = inv#get_init_disequalities in
600+
let disvars =
601+
List.filter
602+
(fun v -> not (floc#f#env#is_initial_stackpointer_value v)) disvars in
600603
let is_disvar v = List.exists (fun vv -> v#equal vv) disvars in
601604
let xprvars = floc#env#variables_in_expr xs in
602605
let vars =

0 commit comments

Comments
 (0)