-# helper array
-my @rt = ("arch_register_type_none", # 0
- "arch_register_type_caller_save", # 1
- "arch_register_type_callee_save", # 2
- "",
- "arch_register_type_ignore", # 4
- "",
- "",
- "",
- "arch_register_type_sp", # 8
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "arch_register_type_bp" # 16
- );
+# helper function
+sub translate_reg_type {
+ my $t = shift;
+
+ if ($t == 0) {
+ return "arch_register_type_none";
+ }
+ else {
+ my @types;
+
+ if ($t & 1) {
+ push(@types, "arch_register_type_caller_save");
+ }
+
+ if ($t & 2) {
+ push(@types, "arch_register_type_callee_save");
+ }
+
+ if ($t & 4) {
+ push(@types, "arch_register_type_ignore");
+ }
+
+ return join(" | ", @types);
+ }
+}