-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");
- }
-
- if ($t & 8) {
- push(@types, "arch_register_type_joker");
- }
-
- if ($t & 16) {
- push(@types, "arch_register_type_virtual");
- }
-
- if ($t & 32) {
- push(@types, "arch_register_type_state");
- }
-
- return join(" | ", @types);
- }
+sub map_flags {
+ my $prefix = shift;
+ my $flags = shift || "none";
+ return join(" | ", map { "$prefix$_" } split(/\s*\|\s*/, $flags));