Skip to content

Commit a6cbd15

Browse files
committed
CHB: remove maybe-non-returning annotation
1 parent 6ce6f1f commit a6cbd15

File tree

6 files changed

+1
-79
lines changed

6 files changed

+1
-79
lines changed

CodeHawk/CHB/bchlib/bCHFunctionData.ml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ object (self)
6161

6262
val mutable names = []
6363
val mutable non_returning = false
64-
val mutable maybe_non_returning = false
6564
val mutable incomplete = false
6665
val mutable ida_provided = false
6766
val mutable user_provided = false
@@ -79,8 +78,6 @@ object (self)
7978

8079
method set_non_returning = non_returning <- true
8180

82-
method set_maybe_non_returning = maybe_non_returning <- true
83-
8481
method set_inlined = inlined <- true
8582

8683
method set_by_preamble = by_preamble <- true
@@ -171,8 +168,6 @@ object (self)
171168

172169
method is_non_returning = non_returning
173170

174-
method is_maybe_non_returning = maybe_non_returning
175-
176171
method is_incomplete = incomplete
177172

178173
method is_virtual = virtual_function

CodeHawk/CHB/bchlib/bCHLibTypes.mli

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,6 @@ class type function_data_int =
15041504
(* setters *)
15051505
method set_function_type: btype_t -> unit
15061506
method set_non_returning: unit
1507-
method set_maybe_non_returning: unit
15081507
method add_name: string -> unit
15091508
method set_ida_provided: unit
15101509
method set_user_provided: unit
@@ -1542,7 +1541,6 @@ class type function_data_int =
15421541
method has_callsites: bool
15431542
method has_path_contexts: bool
15441543
method is_non_returning: bool
1545-
method is_maybe_non_returning: bool
15461544
method is_incomplete: bool
15471545
method is_ida_provided: bool
15481546
method is_user_provided: bool

CodeHawk/CHB/bchlib/bCHSystemInfo.ml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ object (self)
192192
val mutable user_call_targets = 0
193193
val mutable user_structs = 0
194194
val mutable user_nonreturning = 0
195-
val mutable user_maybe_nonreturning = 0
196195
val mutable user_classes = 0
197196
val mutable encodings = []
198197
val mutable inlined_functions = []
@@ -701,13 +700,6 @@ object (self)
701700
user_nonreturning <- List.length nrnode#getChildren
702701
end);
703702

704-
(if hasc "maybe-non-returning-functions" then
705-
let mnrnode = getc "maybe-non-returning-functions" in
706-
begin
707-
self#read_xml_user_maybe_nonreturning_functions mnrnode;
708-
user_maybe_nonreturning <- List.length mnrnode#getChildren
709-
end);
710-
711703
(if hasc "non-returning-calls" then
712704
let nrnode = getc "non-returning-calls" in
713705
begin
@@ -1465,22 +1457,6 @@ object (self)
14651457
chlog#add "user-declared non-returning function" (geta n)#toPretty in
14661458
fd#set_non_returning) (getcc "nr")
14671459

1468-
method private read_xml_user_maybe_nonreturning_functions
1469-
(node:xml_element_int) =
1470-
let geta n =
1471-
fail_tvalue
1472-
(trerror_record
1473-
(LBLOCK [
1474-
STR "read_xml_user_maybe_nonreturning_functions: ";
1475-
STR (n#getAttribute "a")]))
1476-
(string_to_doubleword (n#getAttribute "a")) in
1477-
let getcc = node#getTaggedChildren in
1478-
List.iter (fun n ->
1479-
let fd = functions_data#add_function (geta n) in
1480-
let _ =
1481-
chlog#add "user-declared non-returning function" (geta n)#toPretty in
1482-
fd#set_maybe_non_returning) (getcc "mnr")
1483-
14841460
method private read_xml_nonreturning_calls (node:xml_element_int) =
14851461
let geta n tag = geta_fail "read_xml_nonreturning_functions" n tag in
14861462
let getcc = node#getTaggedChildren in

CodeHawk/CHB/bchlibarm32/bCHConstructARMFunction.ml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,6 @@ let get_successors
8181
[]
8282
(get_next_valid_instruction_address iaddr) in
8383

84-
let is_maybe_non_returning_call_instr =
85-
match instr#get_opcode with
86-
| BranchLink (ACCAlways, tgt)
87-
| BranchLinkExchange (ACCAlways, tgt) when tgt#is_absolute_address ->
88-
let tgtaddr = tgt#get_absolute_address in
89-
((functions_data#is_function_entry_point tgtaddr)
90-
&& (functions_data#get_function tgtaddr)#is_maybe_non_returning)
91-
| _ -> false in
92-
9384
let next_from (va: doubleword_int) =
9485
log_tfold_default
9586
(mk_tracelog_spec
@@ -135,12 +126,6 @@ let get_successors
135126
| Pop (_, _, rl, _) when rl#includes_pc ->
136127
(next ()) @ [wordmax]
137128

138-
(* maybe non-returning call instruction *)
139-
| BranchLink _ | BranchLinkExchange _
140-
when is_maybe_non_returning_call_instr ->
141-
let _ = chlog#add "maybe non returning" (iaddr#toPretty) in
142-
(next ()) @ [wordmax]
143-
144129
(* return via LDM/LDMDB/LDMDA/LDMIB *)
145130
| LoadMultipleDecrementBefore (_, ACCAlways, _, rl, _)
146131
| LoadMultipleDecrementAfter (_, ACCAlways, _, rl, _)

CodeHawk/CHB/bchlibarm32/bCHDisassembleARM.ml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -466,17 +466,6 @@ let is_nr_call_instruction (instr:arm_assembly_instruction_int) =
466466
| _ -> false
467467

468468

469-
let is_maybe_nr_call_instruction (instr: arm_assembly_instruction_int) =
470-
match instr#get_opcode with
471-
| BranchLink (ACCAlways, tgt)
472-
| BranchLinkExchange (ACCAlways, tgt) when tgt#is_absolute_address ->
473-
let tgtaddr = tgt#get_absolute_address in
474-
((functions_data#is_function_entry_point tgtaddr)
475-
&& (functions_data#get_function tgtaddr)#is_maybe_non_returning)
476-
| _ -> false
477-
478-
479-
480469
let collect_function_entry_points () =
481470
let addresses = new DoublewordCollections.set_t in
482471
begin
@@ -693,8 +682,7 @@ let set_block_boundaries () =
693682
*)
694683

695684
| BranchLink _ | BranchLinkExchange _
696-
when is_nr_call_instruction instr
697-
|| is_maybe_nr_call_instruction instr ->
685+
when is_nr_call_instruction instr ->
698686
set_block_entry (va#add_int 4)
699687

700688
| _ -> ())

CodeHawk/CHB/bchlibarm32/bCHTranslateARMToCHIF.ml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -634,15 +634,6 @@ let translate_arm_instruction
634634
(floc#env#variables_in_expr xs) in
635635
vars @ acc) [] xprs in
636636

637-
let is_maybe_non_returning_call_instr =
638-
match instr#get_opcode with
639-
| BranchLink (ACCAlways, tgt)
640-
| BranchLinkExchange (ACCAlways, tgt) when tgt#is_absolute_address ->
641-
let tgtaddr = tgt#get_absolute_address in
642-
((functions_data#is_function_entry_point tgtaddr)
643-
&& (functions_data#get_function tgtaddr)#is_maybe_non_returning)
644-
| _ -> false in
645-
646637
let flagdefs =
647638
let flags_set = get_arm_flags_set instr#get_opcode in
648639
List.map (fun f -> finfo#env#mk_flag_variable (ARMCCFlag f)) flags_set in
@@ -1136,17 +1127,6 @@ let translate_arm_instruction
11361127
* SelectInstrSet(targetInstrSet);
11371128
* BranchWritePC(targetAddress);
11381129
* ------------------------------------------------------------------------ *)
1139-
| BranchLink (_c, tgt) when is_maybe_non_returning_call_instr ->
1140-
(* TODO: incorporate condition *)
1141-
let elseaddr = codepc#get_false_branch_successor in
1142-
let callcmds = calltgt_cmds tgt in
1143-
let cmds = cmds @ (invop :: callcmds) @ [bwdinvop] @ pcassign in
1144-
let transaction = package_transaction finfo blocklabel cmds in
1145-
let elselabel = make_code_label elseaddr in
1146-
let nodes = [(blocklabel, [transaction])] in
1147-
let edges = [(blocklabel, exitlabel); (blocklabel, elselabel)] in
1148-
(nodes, edges, [])
1149-
11501130
| BranchLink (c, tgt)
11511131
| BranchLinkExchange (c, tgt) when tgt#is_absolute_address ->
11521132
if instr#is_inlined_call then

0 commit comments

Comments
 (0)