Skip to content

Commit

Permalink
CHB: remove register prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sipma committed Jan 13, 2024
1 parent 1580b94 commit 89a3f1f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
27 changes: 1 addition & 26 deletions CodeHawk/CHB/bchlib/bCHCPURegisters.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Copyright (c) 2005-2020 Kestrel Technology LLC
Copyright (c) 2020 Henny Sipma
Copyright (c) 2021-2023 Aarno Labs LLC
Copyright (c) 2021-2024 Aarno Labs LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -700,31 +700,6 @@ let register_to_string register =
| PowerCRField f -> pwr_crf_to_string f


let register_to_ssa_prefix (register: register_t): string =
match register with
| CPURegister _ -> "r"
| SegmentRegister _ -> "sr"
| ControlRegister _ -> "cr"
| DebugRegister _ -> "dr"
| DoubleRegister _ -> "dd"
| FloatingPointRegister _ -> "f"
| MmxRegister _ -> "mmx"
| XmmRegister _ -> "xmm"
| MIPSRegister _ -> "r"
| MIPSSpecialRegister _ -> "sr"
| MIPSFloatingPointRegister _ -> "f"
| ARMRegister _ -> "r"
| ARMDoubleRegister _ -> "rr"
| ARMSpecialRegister _ -> "sr"
| ARMExtensionRegister _ -> "q"
| ARMDoubleExtensionRegister _ -> "qq"
| ARMExtensionRegisterElement _ -> "re"
| ARMExtensionRegisterReplicatedElement _ -> "ee"
| PowerGPRegister _ -> "r"
| PowerSPRegister _ -> "sr"
| PowerCRField f -> "cr"


let extract_cpu_reg s =
let len = String.length s in
let rsub = String.sub s 4 (len - 5) in
Expand Down
4 changes: 1 addition & 3 deletions CodeHawk/CHB/bchlib/bCHCPURegisters.mli
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Copyright (c) 2005-2019 Kestrel Technology LLC
Copyright (c) 2020 Henny Sipma
Copyright (c) 2021-2023 Aarno Labs LLC
Copyright (c) 2021-2024 Aarno Labs LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -220,8 +220,6 @@ val register_to_string: register_t -> string

val register_from_string: string -> register_t (* incomplete *)

val register_to_ssa_prefix: register_t -> string


(** {2 x86}*)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ let thumb_2_basic () =
("MOV-R-T1", "1346", "MOV R3, R2");
("MOV-I-T1", "0a27", "MOVS R7, #0xa");
("MOVS-I-T1", "2022", "MOVS R2, #0x20");
("NOP", "00bf", "NOP ");
("ORRS-R-T1", "1e43", "ORRS R6, R6, R3");
("POP-3-T1", "90bd", "POP {R4,R7,PC}");
("POP-5-T1", "f0bd", "POP {R4,R5,R6,R7,PC}");
Expand Down Expand Up @@ -248,6 +249,8 @@ let thumb_4_basic () =
(* 4-byte thumb opcodes, pc-relative *)
let thumb_4_pc_relative () =
let tests = [
("B.W-T3?", "0x7200", "f9f73ebe", "B.W 0xe80");
("B.W-T3??", "0xe7c", "06f0bcb9", "B.W 0x71f8");
("B.W-T4", "0x11a7a", "24f1e3be", "B.W 0x136844");
("BEQ.W-T3", "0x1119e", "00f0ed81", "BEQ.W 0x1157c");
("BHI.W-T3", "0x11e6a", "3ff626af", "BHI.W 0x11cba");
Expand Down

0 comments on commit 89a3f1f

Please sign in to comment.