Skip to content

Commit 2b8bc80

Browse files
committed
CHB: remove ssa varintros
1 parent 4e64750 commit 2b8bc80

File tree

5 files changed

+1
-142
lines changed

5 files changed

+1
-142
lines changed

CodeHawk/CHB/bchlib/bCHLibTypes.mli

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5888,16 +5888,6 @@ object
58885888
method add_goto_return: doubleword_int -> doubleword_int -> unit
58895889
method set_virtual_function_table: doubleword_int -> unit
58905890

5891-
(** [add_computed_varintros faddr iaddrs name] adds the name to be used for
5892-
the instructions at locations [iaddrs] in function [faddr] for
5893-
ssa-assignments and ssa-abstractions.
5894-
5895-
These names will be added as an optional, introduced name in addition to
5896-
the regular ssa name.
5897-
*)
5898-
method add_computed_join_varintros:
5899-
doubleword_int -> ctxt_iaddress_t list -> register_t -> unit
5900-
59015891
(** [set_arm_thumb_switch addr arch] records a switch from arm to thumb at
59025892
address [addr] if [arch] is ['T'] and a switch from thumb to arm if [arch]
59035893
is ['A'].*)

CodeHawk/CHB/bchlib/bCHLocation.ml

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ open CHLanguage
3333

3434
(* bchlib *)
3535
open BCHBasicTypes
36-
open BCHCPURegisters
3736
open BCHDoubleword
3837
open BCHLibTypes
39-
open BCHSystemSettings
4038

4139
module H = Hashtbl
4240
module TR = CHTraceResult
@@ -327,93 +325,3 @@ let symbol_to_ctxt_string (s:symbol_t) =
327325

328326
let ctxt_string_to_symbol (name:string) ?(atts=[]) (s:ctxt_iaddress_t) =
329327
new symbol_t ~atts:(s::atts) name
330-
331-
332-
class ssa_register_store_t =
333-
object
334-
335-
(* names of regular ssa variables *)
336-
val store = H.create 3
337-
val nextindex = H.create 3
338-
339-
(* names of introduced ssa variables for joins *)
340-
val jstore = H.create 3
341-
val jnextindex = H.create 3
342-
343-
method get_name
344-
(name: string)
345-
(faddr: doubleword_int)
346-
(iaddr: ctxt_iaddress_t): string =
347-
let key = faddr#to_hex_string ^ "_" ^ iaddr ^ "_" ^ name in
348-
if H.mem store key then
349-
H.find store key
350-
else
351-
let idwr = string_to_doubleword iaddr in
352-
let alignment = system_settings#get_instruction_alignment in
353-
let vname =
354-
TR.tfold_default
355-
(fun idw ->
356-
let offsetr = idw#subtract_to_int faddr in
357-
TR.tfold_default
358-
(fun offset -> name ^ "_" ^ (string_of_int (offset / alignment)))
359-
(name ^ "_" ^ iaddr)
360-
offsetr)
361-
(name ^ "_" ^ iaddr)
362-
idwr in
363-
begin
364-
H.add store key vname;
365-
vname
366-
end
367-
368-
method get_join_name
369-
(name: string)
370-
(faddr: doubleword_int)
371-
(iaddrs: ctxt_iaddress_t list): string =
372-
let key = faddr#to_hex_string ^ "_" ^ name ^ (String.concat "_" iaddrs) in
373-
if H.mem jstore key then
374-
H.find jstore key
375-
else
376-
let alignment = system_settings#get_instruction_alignment in
377-
let idws_r = List.map string_to_doubleword iaddrs in
378-
let offsets_r =
379-
List.map
380-
(fun idw_r ->
381-
TR.tbind
382-
(fun idw ->
383-
let offset_r = idw#subtract_to_int faddr in
384-
TR.tbind
385-
(fun offset ->
386-
Ok (string_of_int (offset / alignment)))
387-
offset_r)
388-
idw_r) idws_r in
389-
let vname =
390-
TR.tfold_list_default
391-
~ok:(fun acc offset -> acc ^ "_" ^ offset)
392-
~err:(fun acc -> acc ^ "_XXX")
393-
name
394-
offsets_r in
395-
begin
396-
H.add jstore key vname;
397-
vname
398-
end
399-
400-
end
401-
402-
403-
let store = new ssa_register_store_t
404-
405-
406-
let ssa_register_value_name
407-
(reg: register_t)
408-
(faddr: doubleword_int)
409-
(iaddr: ctxt_iaddress_t): string =
410-
let name = "v" ^ (register_to_string reg) in
411-
store#get_name name faddr iaddr
412-
413-
414-
let ssa_register_value_join_name
415-
(reg: register_t)
416-
(faddr: doubleword_int)
417-
(iaddrs: ctxt_iaddress_t list): string =
418-
let name = "vv" ^ register_to_string reg in
419-
store#get_join_name name faddr iaddrs

CodeHawk/CHB/bchlib/bCHLocation.mli

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -196,20 +196,3 @@ val symbol_to_ctxt_string: symbol_t -> ctxt_iaddress_t
196196

197197
val ctxt_string_to_symbol:
198198
string -> ?atts:string list -> ctxt_iaddress_t -> symbol_t
199-
200-
201-
(** [ssa_register_value_reg name faddr iaddr] returns a name for the
202-
variable created as part of an ssa register assignment or abstraction
203-
to the register [reg] at address [iaddr] in function [faddr].
204-
205-
Note: the case where [iaddr] has a context may produce a name that
206-
is not a valid variable name in C.*)
207-
val ssa_register_value_name:
208-
register_t -> doubleword_int -> ctxt_iaddress_t -> string
209-
210-
211-
(** [ssa_register_value_join_name name faddr] returns a name that may be
212-
used for multiple ssa variables that can be colocated to the same variable
213-
location.*)
214-
val ssa_register_value_join_name:
215-
register_t -> doubleword_int -> ctxt_iaddress_t list -> string

CodeHawk/CHB/bchlib/bCHSystemInfo.ml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ open BCHByteUtilities
6060
open BCHCallbackTables
6161
open BCHConstantDefinitions
6262
open BCHCppClass
63-
open BCHCPURegisters
6463
open BCHCStruct
6564
open BCHCStructConstant
6665
open BCHDataBlock
@@ -69,7 +68,6 @@ open BCHFunctionData
6968
open BCHFunctionSummaryLibrary
7069
open BCHJumpTable
7170
open BCHLibTypes
72-
open BCHLocation
7371
open BCHPreFileIO
7472
open BCHSectionHeadersInfo
7573
open BCHSpecializations
@@ -1441,26 +1439,6 @@ object (self)
14411439
STR " variable introductions"])
14421440
end
14431441

1444-
method add_computed_join_varintros
1445-
(faddr: doubleword_int)
1446-
(iaddrs: ctxt_iaddress_t list)
1447-
(reg: register_t) =
1448-
let name = ssa_register_value_join_name reg faddr iaddrs in
1449-
List.iter (fun iaddr ->
1450-
if is_iaddress iaddr then
1451-
let loc = ctxt_string_to_location faddr iaddr in
1452-
let iaddr = loc#i in
1453-
let _ =
1454-
chlog#add
1455-
"add computed join variable"
1456-
(LBLOCK [
1457-
loc#toPretty;
1458-
STR " ";
1459-
STR (register_to_string reg);
1460-
STR ": ";
1461-
STR name]) in
1462-
H.replace variable_intros iaddr#index name) iaddrs
1463-
14641442
method private write_xml_variable_introductions (node: xml_element_int) =
14651443
let vintros = H.fold (fun k v a -> (k, v)::a) variable_intros [] in
14661444
List.iter (fun (dwindex, name) ->

CodeHawk/CHB/bchlibarm32/bCHARMJumptable.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ let is_addls_pc_jumptable
628628

629629

630630
let create_addls_pc_jumptable
631-
(ch: pushback_stream_int)
631+
(_ch: pushback_stream_int)
632632
(addpcinstr: arm_assembly_instruction_int):
633633
(arm_assembly_instruction_int list * arm_jumptable_int) option =
634634
match is_addls_pc_jumptable addpcinstr with

0 commit comments

Comments
 (0)