1 /* The IGEN simulator generator for GDB, the GNU Debugger.
3 Copyright 2002, 2007 Free Software Foundation, Inc.
5 Contributed by Andrew Cagney.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
50 static const name_map cache_type_map
[] = {
51 {"cache", cache_value
},
52 {"compute", compute_value
},
53 {"scratch", scratch_value
},
59 load_cache_table (char *file_name
)
61 cache_entry
*cache
= NULL
;
62 cache_entry
**last
= &cache
;
63 table
*file
= table_open (file_name
);
65 while ((entry
= table_read (file
)) != NULL
)
67 cache_entry
*new_rule
= ZALLOC (cache_entry
);
68 new_rule
->line
= entry
->line
;
69 new_rule
->entry_type
= name2i (entry
->field
[ca_type
], cache_type_map
);
70 new_rule
->name
= entry
->field
[ca_derived_name
];
71 filter_parse (&new_rule
->original_fields
, entry
->field
[ca_field_name
]);
72 new_rule
->type
= entry
->field
[ca_type_def
];
73 /* expression is the concatenation of the remaining fields */
74 if (entry
->nr_fields
> ca_expression
)
78 for (chi
= ca_expression
; chi
< entry
->nr_fields
; chi
++)
80 len
+= strlen (" : ") + strlen (entry
->field
[chi
]);
82 new_rule
->expression
= NZALLOC (char, len
);
83 strcpy (new_rule
->expression
, entry
->field
[ca_expression
]);
84 for (chi
= ca_expression
+ 1; chi
< entry
->nr_fields
; chi
++)
86 strcat (new_rule
->expression
, " : ");
87 strcat (new_rule
->expression
, entry
->field
[chi
]);
92 last
= &new_rule
->next
;
101 igen_options options
;
104 main (int argc
, char **argv
)
106 cache_entry
*rules
= NULL
;
110 error (NULL
, "Usage: cache <cache-file>\n");
112 rules
= load_cache_table (argv
[1]);
113 l
= lf_open ("-", "stdout", lf_omit_references
, lf_is_text
, "tmp-ld-insn");
114 dump_cache_entries (l
, "(", rules
, ")\n");
This page took 0.030887 seconds and 4 git commands to generate.