1 /* This file is part of the program psim.
3 Copyright (C) 1994,1995,1996, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
45 static const name_map cache_type_map
[] = {
46 { "cache", cache_value
},
47 { "compute", compute_value
},
48 { "scratch", scratch_value
},
54 load_cache_table (char *file_name
)
56 cache_entry
*cache
= NULL
;
57 cache_entry
**last
= &cache
;
58 table
*file
= table_open (file_name
);
60 while ((entry
= table_read (file
)) != NULL
)
62 cache_entry
*new_rule
= ZALLOC (cache_entry
);
63 new_rule
->line
= entry
->line
;
64 new_rule
->entry_type
= name2i (entry
->field
[ca_type
], cache_type_map
);
65 new_rule
->name
= entry
->field
[ca_derived_name
];
66 filter_parse (&new_rule
->original_fields
,
67 entry
->field
[ca_field_name
]);
68 new_rule
->type
= entry
->field
[ca_type_def
];
69 /* expression is the concatenation of the remaining fields */
70 if (entry
->nr_fields
> ca_expression
)
74 for (chi
= ca_expression
; chi
< entry
->nr_fields
; chi
++)
76 len
+= strlen (" : ") + strlen (entry
->field
[chi
]);
78 new_rule
->expression
= NZALLOC (char, len
);
79 strcpy (new_rule
->expression
, entry
->field
[ca_expression
]);
80 for (chi
= ca_expression
+ 1; chi
< entry
->nr_fields
; chi
++)
82 strcat (new_rule
->expression
, " : ");
83 strcat (new_rule
->expression
, entry
->field
[chi
]);
88 last
= &new_rule
->next
;
100 main(int argc
, char **argv
)
102 cache_entry
*rules
= NULL
;
106 error (NULL
, "Usage: cache <cache-file>\n");
108 rules
= load_cache_table (argv
[1]);
109 l
= lf_open ("-", "stdout", lf_omit_references
, lf_is_text
, "tmp-ld-insn");
110 dump_cache_entries (l
, "(", rules
, ")\n");
This page took 0.03119 seconds and 4 git commands to generate.