void
-filter_add (filter **set, filter *add)
+filter_add (filter **set, const filter *add)
{
while (add != NULL)
{
int
-filter_is_subset (filter *superset, filter *subset)
+filter_is_subset (const filter *superset, const filter *subset)
{
while (1)
{
int
-filter_is_common (filter *l, filter *r)
+filter_is_common (const filter *l, const filter *r)
{
while (1)
{
int
-filter_is_member (filter *filt, const char *flag)
+filter_is_member (const filter *filt, const char *flag)
{
int index = 1;
while (filt != NULL)
int
-is_filtered_out (filter *filters, const char *flags)
+is_filtered_out (const filter *filters, const char *flags)
{
while (strlen (flags) > 0)
{
int present;
- filter *filt = filters;
+ const filter *filt = filters;
/* break the string up */
- char *end = strchr (flags, ',');
- char *next;
+ const char *end = strchr (flags, ',');
+ const char *next;
unsigned /*size_t */ len;
if (end == NULL)
{
}
-char *
-filter_next (filter *set, char *member)
+const char *
+filter_next (const filter *set, const char *member)
{
while (set != NULL)
{
void
-dump_filter (lf *file, char *prefix, filter *set, char *suffix)
+dump_filter (lf *file,
+ const char *prefix,
+ const filter *set,
+ const char *suffix)
{
- char *member;
+ const char *member;
lf_printf (file, "%s", prefix);
member = filter_next (set, "");
if (member != NULL)
/* add the second filter to the first */
-extern void filter_add (filter **filters, filter *add);
+extern void filter_add (filter **filters, const filter *add);
/* returns true if SUB is a strict subset of SUPER. For an empty set
is a member of any set */
-extern int filter_is_subset (filter *superset, filter *subset);
+extern int filter_is_subset (const filter *superset, const filter *subset);
/* return true if there is at least one member common to the two
filters */
-extern int filter_is_common (filter *l, filter *r);
+extern int filter_is_common (const filter *l, const filter *r);
/* returns the index (pos + 1) if the name is in the filter. */
-extern int filter_is_member (filter *set, const char *flag);
+extern int filter_is_member (const filter *set, const char *flag);
/* returns true if one of the flags is not present in the filter.
=== !filter_is_subset (filter_parse (NULL, flags), filters) */
-int is_filtered_out (filter *filters, const char *flags);
+int is_filtered_out (const filter *filters, const char *flags);
/* returns the next member of the filter set that follows MEMBER.
Member does not need to be an elememt of the filter set. Next of
"" is the first non-empty member */
-char *filter_next (filter *set, char *member);
+const char *filter_next (const filter *set, const char *member);
/* for debugging */
-extern void dump_filter (lf *file, char *prefix, filter *filt, char *suffix);
+extern void dump_filter
+ (lf *file, const char *prefix, const filter *filt, const char *suffix);
static void
-print_run_body (lf *file, gen_entry *table)
+print_run_body (lf *file, const gen_entry *table)
{
/* Output the function to execute real code:
void
print_engine_run_function_header (lf *file,
- char *processor,
+ const char *processor,
function_decl_type decl_type)
{
int indent;
void
gen_engine_h (lf *file,
- gen_table *gen, insn_table *isa, cache_entry *cache_rules)
+ const gen_table *gen,
+ const insn_table *isa,
+ cache_entry *cache_rules)
{
gen_list *entry;
for (entry = gen->tables; entry != NULL; entry = entry->next)
void
gen_engine_c (lf *file,
- gen_table *gen, insn_table *isa, cache_entry *cache_rules)
+ const gen_table *gen,
+ const insn_table *isa,
+ cache_entry *cache_rules)
{
- gen_list *entry;
+ const gen_list *entry;
/* the intro */
print_includes (file);
print_include_inline (file, options.module.semantics);
along with this program. If not, see <http://www.gnu.org/licenses/>. */
extern void gen_engine_h
- (lf *file, gen_table *gen, insn_table *isa, cache_entry *cache_rules);
+ (lf *file, const gen_table *gen, const insn_table *isa,
+ cache_entry *cache_rules);
extern void gen_engine_c
- (lf *file, gen_table *gen, insn_table *isa, cache_entry *cache_rules);
+ (lf *file, const gen_table *gen, const insn_table *isa,
+ cache_entry *cache_rules);
extern void print_engine_run_function_header
- (lf *file, char *processor, function_decl_type decl_type);
+ (lf *file, const char *processor, function_decl_type decl_type);
print_icache_function_header (lf *file,
const char *basename,
const char *format_name,
- opcode_bits *expanded_bits,
+ const opcode_bits *expanded_bits,
int is_function_definition,
int nr_prefetched_words)
{
void
print_icache_declaration (lf *file,
- insn_entry * insn,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes, int nr_prefetched_words)
+ const insn_entry *insn,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
+ int nr_prefetched_words)
{
print_icache_function_header (file,
insn->name,
const char *entry_name,
const char *entry_type,
const char *entry_expression,
- char *single_insn_field,
+ const char *single_insn_field,
line_ref *line,
insn_field_entry *cur_field,
- opcode_bits *expanded_bits,
+ const opcode_bits *expanded_bits,
icache_decl_type what_to_declare,
icache_body_type what_to_do)
{
const char *expression;
- opcode_bits *bits;
- char *reason;
+ const opcode_bits *bits;
+ const char *reason;
ASSERT (format_name != NULL);
ASSERT (entry_name != NULL);
void
print_icache_body (lf *file,
- insn_entry * instruction,
- opcode_bits *expanded_bits,
+ const insn_entry *instruction,
+ const opcode_bits *expanded_bits,
cache_entry *cache_rules,
icache_decl_type what_to_declare,
icache_body_type what_to_do, int nr_prefetched_words)
cache_rule->original_fields)
&& !filter_is_member (instruction->field_names, cache_rule->name))
{
- char *single_field =
+ const char *single_field =
filter_next (cache_rule->original_fields, "");
if (filter_next (cache_rule->original_fields, single_field) !=
NULL)
};
static form_fields *
-insn_table_cache_fields (insn_table *isa)
+insn_table_cache_fields (const insn_table *isa)
{
form_fields *forms = NULL;
insn_entry *insn;
extern void
-print_icache_struct (lf *file, insn_table *isa, cache_entry *cache_rules)
+print_icache_struct (lf *file, const insn_table *isa, cache_entry *cache_rules)
{
/* Create a list of all the different instruction formats with their
corresponding field names. */
lf_indent (file, +2);
{
cache_entry *cache_rule;
- char *field;
+ const char *field;
/* space for any instruction words */
if (options.gen.insn_in_icache)
lf_printf (file, "instruction_word insn[%d];\n",
if (filter_is_subset
(format->fields, cache_rule->original_fields))
{
- char *memb;
+ const char *memb;
lf_printf (file, "%s %s;",
(cache_rule->type == NULL
? "unsigned"
static void
print_icache_function (lf *file,
- insn_entry * instruction,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes,
+ const insn_entry *instruction,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
cache_entry *cache_rules, int nr_prefetched_words)
{
int indent;
void
print_icache_definition (lf *file,
- insn_entry * insn,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes,
+ const insn_entry *insn,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
cache_entry *cache_rules, int nr_prefetched_words)
{
print_icache_function (file,
void
print_icache_internal_function_declaration (lf *file,
- function_entry * function,
+ const function_entry *function,
void *data)
{
ASSERT (options.gen.icache);
void
print_icache_internal_function_definition (lf *file,
- function_entry * function,
+ const function_entry *function,
void *data)
{
ASSERT (options.gen.icache);
extern void print_icache_body
(lf *file,
- insn_entry * instruction,
- opcode_bits *expanded_bits,
+ const insn_entry *instruction,
+ const opcode_bits *expanded_bits,
cache_entry *cache_rules,
icache_decl_type what_to_declare,
icache_body_type what_to_do, int nr_prefetched_words);
extern void print_icache_declaration
(lf *file,
- insn_entry * insn,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes, int nr_prefetched_words);
+ const insn_entry *insn,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
+ int nr_prefetched_words);
extern void print_icache_definition
(lf *file,
- insn_entry * insn,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes, cache_entry *cache_rules, int nr_prefetched_words);
+ const insn_entry *insn,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
+ cache_entry *cache_rules, int nr_prefetched_words);
/* Output an instruction cache support function */
/* Output the instruction cache table data structure */
extern void print_icache_struct
- (lf *file, insn_table *instructions, cache_entry *cache_rules);
+ (lf *file, const insn_table *instructions, cache_entry *cache_rules);
/* Output a single instructions decoder */
static void
-lf_print_opcodes (lf *file, gen_entry *table)
+lf_print_opcodes (lf *file, const gen_entry *table)
{
if (table !=NULL)
{
static void
-lf_print_table_name (lf *file, gen_entry *table)
+lf_print_table_name (lf *file, const gen_entry *table)
{
lf_printf (file, "idecode_table");
lf_print_opcodes (file, table);
static void
-print_idecode_table (lf *file, gen_entry *entry, const char *result)
+print_idecode_table (lf *file, const gen_entry *entry, const char *result)
{
lf_printf (file, "/* prime the search */\n");
lf_printf (file, "idecode_table_entry *table = ");
static void
-print_idecode_table_start (lf *file, gen_entry *table, int depth, void *data)
+print_idecode_table_start (lf *file,
+ const gen_entry *table, int depth, void *data)
{
ASSERT (depth == 0);
/* start of the table */
}
static void
-print_idecode_table_leaf (lf *file, gen_entry *entry, int depth, void *data)
+print_idecode_table_leaf (lf *file,
+ const gen_entry *entry, int depth, void *data)
{
- gen_entry *master_entry;
+ const gen_entry *master_entry;
ASSERT (entry->parent != NULL);
ASSERT (depth == 0);
if (entry->combined_parent == NULL)
}
static void
-print_idecode_table_end (lf *file, gen_entry *table, int depth, void *data)
+print_idecode_table_end (lf *file,
+ const gen_entry *table, int depth, void *data)
{
ASSERT (depth == 0);
if (table->opcode_rule->gen == array_gen)
static void
-print_goto_switch_name (lf *file, gen_entry *entry)
+print_goto_switch_name (lf *file, const gen_entry *entry)
{
lf_printf (file, "case_");
if (entry->opcode == NULL)
static void
print_goto_switch_table_leaf (lf *file,
- gen_entry *entry, int depth, void *data)
+ const gen_entry *entry, int depth, void *data)
{
ASSERT (entry->parent != NULL);
ASSERT (depth == 0);
}
static void
-print_goto_switch_break (lf *file, gen_entry *entry)
+print_goto_switch_break (lf *file, const gen_entry *entry)
{
lf_printf (file, "goto break_");
lf_print_table_name (file, entry->parent);
static void
-print_goto_switch_table (lf *file, gen_entry *table)
+print_goto_switch_table (lf *file, const gen_entry *table)
{
lf_printf (file, "const static void *");
lf_print_table_name (file, table);
}
-void print_idecode_switch (lf *file, gen_entry *table, const char *result);
+void print_idecode_switch
+ (lf *file, const gen_entry *table, const char *result);
static void
-print_idecode_switch_start (lf *file, gen_entry *table, int depth, void *data)
+print_idecode_switch_start (lf *file,
+ const gen_entry *table, int depth, void *data)
{
/* const char *result = data; */
ASSERT (depth == 0);
static void
-print_idecode_switch_leaf (lf *file, gen_entry *entry, int depth, void *data)
+print_idecode_switch_leaf (lf *file,
+ const gen_entry *entry, int depth, void *data)
{
const char *result = data;
ASSERT (entry->parent != NULL);
|| entry->parent->opcode_rule->gen == padded_switch_gen)
{
/* case: <opcode-nr> - switch */
- gen_entry *cob;
+ const gen_entry *cob;
for (cob = entry; cob != NULL; cob = cob->combined_next)
lf_printf (file, "case %d:\n", cob->opcode_nr);
}
}
static void
-print_idecode_switch_end (lf *file, gen_entry *table, int depth, void *data)
+print_idecode_switch_end (lf *file,
+ const gen_entry *table, int depth, void *data)
{
const char *result = data;
ASSERT (depth == 0);
void
-print_idecode_switch (lf *file, gen_entry *table, const char *result)
+print_idecode_switch (lf *file, const gen_entry *table, const char *result)
{
gen_entry_traverse_tree (file, table,
0,
static void
print_idecode_switch_function_header (lf *file,
- gen_entry *table,
+ const gen_entry *table,
int is_function_definition,
int nr_prefetched_words)
{
static void
-idecode_declare_if_switch (lf *file, gen_entry *table, int depth, void *data)
+idecode_declare_if_switch (lf *file,
+ const gen_entry *table, int depth, void *data)
{
if ((table->opcode_rule->gen == switch_gen || table->opcode_rule->gen == goto_switch_gen || table->opcode_rule->gen == padded_switch_gen) &&table->parent != NULL /* don't declare the top one yet */
&& table->parent->opcode_rule->gen == array_gen)
static void
-idecode_expand_if_switch (lf *file, gen_entry *table, int depth, void *data)
+idecode_expand_if_switch (lf *file,
+ const gen_entry *table, int depth, void *data)
{
if ((table->opcode_rule->gen == switch_gen || table->opcode_rule->gen == goto_switch_gen || table->opcode_rule->gen == padded_switch_gen) &&table->parent != NULL /* don't expand the top one yet */
&& table->parent->opcode_rule->gen == array_gen)
void
-print_idecode_lookups (lf *file, gen_entry *table, cache_entry *cache_rules)
+print_idecode_lookups (lf *file,
+ const gen_entry *table,
+ cache_entry *cache_rules)
{
int depth;
void
-print_idecode_body (lf *file, gen_entry *table, const char *result)
+print_idecode_body (lf *file, const gen_entry *table, const char *result)
{
if (table->opcode_rule->gen == switch_gen
|| table->opcode_rule->gen == goto_switch_gen
void
print_idecode_validate (lf *file,
- insn_entry * instruction, insn_opcodes *opcode_paths)
+ const insn_entry *instruction,
+ const insn_opcodes *opcode_paths)
{
/* Validate: unchecked instruction fields
relevant bit */
if (opcode_paths != NULL)
{
- insn_opcodes *entry;
+ const insn_opcodes *entry;
for (entry = opcode_paths; entry != NULL; entry = entry->next)
{
opcode_field *opcode;
void print_idecode_globals (lf *file);
void print_idecode_lookups
- (lf *file, gen_entry *table, cache_entry *cache_rules);
+ (lf *file,
+ const gen_entry *table,
+ cache_entry *cache_rules);
-void print_idecode_body (lf *file, gen_entry *table, const char *result);
+void print_idecode_body (lf *file, const gen_entry *table, const char *result);
hardware isn't disabled */
extern void print_idecode_validate
- (lf *file, insn_entry * instruction, insn_opcodes *opcode_paths);
+ (lf *file,
+ const insn_entry *instruction,
+ const insn_opcodes *opcode_paths);
static void
itable_h_insn (lf *file,
- insn_table *entry, insn_entry * instruction, void *data)
+ const insn_table *entry,
+ const insn_entry *instruction,
+ void *data)
{
int len;
itable_info *info = data;
/* print the list of all the different options */
static void
-itable_print_enum (lf *file, filter *set, char *name)
+itable_print_enum (lf *file, const filter *set, const char *name)
{
- char *elem;
+ const char *elem;
lf_printf (file, "typedef enum {\n");
lf_indent (file, +2);
for (elem = filter_next (set, "");
/* print an array of the option names as strings */
static void
-itable_print_names (lf *file, filter *set, char *name)
+itable_print_names (lf *file, const filter *set, const char *name)
{
- char *elem;
+ const char *elem;
lf_printf (file, "const char *%sitable_%s_names[nr_%sitable_%ss + 1] = {\n",
options.module.itable.prefix.l, name,
options.module.itable.prefix.l, name);
}
extern void
-gen_itable_h (lf *file, insn_table *isa)
+gen_itable_h (lf *file, const insn_table *isa)
{
itable_info *info = ZALLOC (itable_info);
/****************************************************************/
static void
-itable_print_set (lf *file, filter *set, filter *members)
+itable_print_set (lf *file, const filter *set, const filter *members)
{
- char *elem;
+ const char *elem;
lf_printf (file, "\"");
elem = filter_next (members, "");
if (elem != NULL)
static void
itable_c_insn (lf *file,
- insn_table *isa, insn_entry * instruction, void *data)
+ const insn_table *isa,
+ const insn_entry *instruction,
+ void *data)
{
lf_printf (file, "{ ");
lf_indent (file, +2);
extern void
-gen_itable_c (lf *file, insn_table *isa)
+gen_itable_c (lf *file, const insn_table *isa)
{
/* leader */
lf_printf (file, "#include \"%sitable.h\"\n",
/* Output a table of all the instructions */
-extern void gen_itable_h (lf *file, insn_table *table);
+extern void gen_itable_h (lf *file, const insn_table *table);
-extern void gen_itable_c (lf *file, insn_table *table);
+extern void gen_itable_c (lf *file, const insn_table *table);
void
-gen_model_h (lf *file, insn_table *table)
+gen_model_h (lf *file, const insn_table *table)
{
lf_print__this_file_is_empty (file, "suffering bit rot");
}
void
-gen_model_c (lf *file, insn_table *table)
+gen_model_c (lf *file, const insn_table *table)
{
lf_print__this_file_is_empty (file, "suffering bit rot");
}
-extern void gen_model_h (lf *file, insn_table *isa);
+extern void gen_model_h (lf *file, const insn_table *isa);
-extern void gen_model_c (lf *file, insn_table *isa);
+extern void gen_model_c (lf *file, const insn_table *isa);
print_semantic_function_header (lf *file,
const char *basename,
const char *format_name,
- opcode_bits *expanded_bits,
+ const opcode_bits *expanded_bits,
int is_function_definition,
int nr_prefetched_words)
{
void
print_semantic_declaration (lf *file,
- insn_entry * insn,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes, int nr_prefetched_words)
+ const insn_entry *insn,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
+ int nr_prefetched_words)
{
print_semantic_function_header (file,
insn->name,
void
print_semantic_body (lf *file,
- insn_entry * instruction,
- opcode_bits *expanded_bits, insn_opcodes *opcodes)
+ const insn_entry *instruction,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes)
{
/* validate the instruction, if a cache this has already been done */
if (!options.gen.icache)
static void
print_c_semantic (lf *file,
- insn_entry * instruction,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes,
- cache_entry *cache_rules, int nr_prefetched_words)
+ const insn_entry *instruction,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
+ cache_entry *cache_rules,
+ int nr_prefetched_words)
{
lf_printf (file, "{\n");
static void
print_c_semantic_function (lf *file,
- insn_entry * instruction,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes,
- cache_entry *cache_rules, int nr_prefetched_words)
+ const insn_entry *instruction,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
+ cache_entry *cache_rules,
+ int nr_prefetched_words)
{
/* build the semantic routine to execute the instruction */
print_semantic_function_header (file,
void
print_semantic_definition (lf *file,
- insn_entry * insn,
- opcode_bits *expanded_bits,
- insn_opcodes *opcodes,
- cache_entry *cache_rules, int nr_prefetched_words)
+ const insn_entry *insn,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes,
+ cache_entry *cache_rules,
+ int nr_prefetched_words)
{
print_c_semantic_function (file,
insn,
extern void print_semantic_declaration
(lf *file,
- insn_entry * insn,
- opcode_bits *bits, insn_opcodes *opcodes, int nr_prefetched_words);
+ const insn_entry *insn,
+ const opcode_bits *bits,
+ const insn_opcodes *opcodes,
+ int nr_prefetched_words);
extern void print_semantic_definition
(lf *file,
- insn_entry * insn,
- opcode_bits *bits,
- insn_opcodes *opcodes, cache_entry *cache_rules, int nr_prefetched_words);
+ const insn_entry *insn,
+ const opcode_bits *bits,
+ const insn_opcodes *opcodes,
+ cache_entry *cache_rules,
+ int nr_prefetched_words);
typedef enum
extern void print_semantic_body
(lf *file,
- insn_entry * instruction,
- opcode_bits *expanded_bits, insn_opcodes *opcodes);
+ const insn_entry *instruction,
+ const opcode_bits *expanded_bits,
+ const insn_opcodes *opcodes);
static void
print_support_function_name (lf *file,
- function_entry * function,
+ const function_entry *function,
int is_function_definition)
{
if (function->is_internal)
static void
-support_h_function (lf *file, function_entry * function, void *data)
+support_h_function (lf *file, const function_entry *function, void *data)
{
ASSERT (function->type != NULL);
print_support_function_name (file, function, 0 /*!is_definition */ );
extern void
-gen_support_h (lf *file, insn_table *table)
+gen_support_h (lf *file, const insn_table *table)
{
/* output the definition of `SD_' */
if (options.gen.smp)
}
static void
-support_c_function (lf *file, function_entry * function, void *data)
+support_c_function (lf *file, const function_entry *function, void *data)
{
ASSERT (function->type != NULL);
print_support_function_name (file, function, 1 /*!is_definition */ );
void
-gen_support_c (lf *file, insn_table *table)
+gen_support_c (lf *file, const insn_table *table)
{
lf_printf (file, "#include \"sim-main.h\"\n");
lf_printf (file, "#include \"%sidecode.h\"\n",
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-extern void gen_support_h (lf *file, insn_table *table);
+extern void gen_support_h (lf *file, const insn_table *table);
-extern void gen_support_c (lf *file, insn_table *table);
+extern void gen_support_c (lf *file, const insn_table *table);
}
static void
-update_depth (lf *file, gen_entry *entry, int depth, void *data)
+update_depth (lf *file, const gen_entry *entry, int depth, void *data)
{
int *max_depth = (int *) data;
if (*max_depth < depth)
int
-gen_entry_depth (gen_entry *table)
+gen_entry_depth (const gen_entry *table)
{
int depth = 0;
gen_entry_traverse_tree (NULL, table, 1, NULL, /*start */
static void
-print_gen_entry_path (line_ref *line, gen_entry *table, error_func *print)
+print_gen_entry_path (const line_ref *line,
+ const gen_entry *table,
+ error_func *print)
{
if (table->parent == NULL)
{
}
static void
-print_gen_entry_insns (gen_entry *table,
+print_gen_entry_insns (const gen_entry *table,
error_func *print,
- char *first_message, char *next_message)
+ const char *first_message,
+ const char *next_message)
{
insn_list *i;
- char *message;
+ const char *message;
message = first_message;
for (i = table->insns; i != NULL; i = i->next)
{
/* same as strcmp */
static int
-insn_field_cmp (insn_word_entry *l, insn_word_entry *r)
+insn_field_cmp (const insn_word_entry *l, const insn_word_entry *r)
{
while (1)
{
/* same as strcmp */
static int
-insn_word_cmp (insn_word_entry *l, insn_word_entry *r)
+insn_word_cmp (const insn_word_entry *l, const insn_word_entry *r)
{
while (1)
{
/* same as strcmp */
static int
-opcode_bit_cmp (opcode_bits *l, opcode_bits *r)
+opcode_bit_cmp (const opcode_bits *l, const opcode_bits *r)
{
if (l == NULL && r == NULL)
return 0; /* all previous bits the same */
/* same as strcmp */
static int
-opcode_bits_cmp (opcode_bits *l, opcode_bits *r)
+opcode_bits_cmp (const opcode_bits *l, const opcode_bits *r)
{
while (1)
{
extern void
gen_entry_traverse_tree (lf *file,
- gen_entry *table,
+ const gen_entry *table,
int depth,
gen_entry_handler * start,
gen_entry_handler * leaf,
/* create a list element containing a single gen_table entry */
static gen_list *
-make_table (insn_table *isa, decode_table *rules, model_entry *model)
+make_table (const insn_table *isa,
+ const decode_table *rules,
+ const model_entry *model)
{
insn_entry *insn;
gen_list *entry = ZALLOC (gen_list);
gen_table *
-make_gen_tables (insn_table *isa, decode_table *rules)
+make_gen_tables (const insn_table *isa, const decode_table *rules)
{
gen_table *gen = ZALLOC (gen_table);
gen->isa = isa;
/* Is the bit, according to the decode rule, identical across all the
instructions? */
static int
-insns_bit_useless (insn_list *insns, decode_table *rule, int bit_nr)
+insns_bit_useless (const insn_list *insns, const decode_table *rule, int bit_nr)
{
- insn_list *entry;
+ const insn_list *entry;
int value = -1;
int is_useless = 1; /* cleared if something actually found */
static opcode_field *
gen_entry_find_opcode_field (insn_list *insns,
- decode_table *rule, int string_only)
+ const decode_table *rule, int string_only)
{
opcode_field curr_opcode;
ASSERT (rule != NULL);
}
static int
-insns_match_nr_words (insn_list *insns, int nr_words)
+insns_match_nr_words (const insn_list *insns, int nr_words)
{
- insn_list *i;
+ const insn_list *i;
for (i = insns; i != NULL; i = i->next)
{
if (i->insn->nr_words < nr_words)
}
static int
-insn_list_cmp (insn_list *l, insn_list *r)
+insn_list_cmp (const insn_list *l, const insn_list *r)
{
while (1)
{
- insn_entry *insn;
+ const insn_entry *insn;
if (l == NULL && r == NULL)
return 0;
if (l == NULL)
static void
gen_entry_expand_insns (gen_entry *table)
{
- decode_table *opcode_rule;
+ const decode_table *opcode_rule;
ASSERT (table->nr_insns >= 1);
worked. */
static void
-make_gen_semantics_list (lf *file, gen_entry *entry, int depth, void *data)
+make_gen_semantics_list (lf *file, const gen_entry *entry, int depth, void *data)
{
gen_table *gen = (gen_table *) data;
insn_list *insn;
gen_entry *parent; /* parent has the opcode* data */
/* as a table containing entries */
- decode_table *opcode_rule;
+ const decode_table *opcode_rule;
opcode_field *opcode;
int nr_prefetched_words;
int nr_entries;
struct _gen_list
{
- model_entry *model;
- insn_table *isa;
+ const model_entry *model;
+ const insn_table *isa;
gen_entry *table;
gen_list *next;
};
struct _gen_table
{
/* list of all the instructions */
- insn_table *isa;
+ const insn_table *isa;
/* list of all the semantic functions */
- decode_table *rules;
+ const decode_table *rules;
/* list of all the generated instruction tables */
gen_list *tables;
/* list of all the semantic functions */
};
-extern gen_table *make_gen_tables (insn_table *isa, decode_table *rules);
+extern gen_table *make_gen_tables
+ (const insn_table *isa, const decode_table *rules);
extern void gen_tables_expand_insns (gen_table *gen);
extern void gen_tables_expand_semantics (gen_table *gen);
-extern int gen_entry_depth (gen_entry *table);
+extern int gen_entry_depth (const gen_entry *table);
/* Traverse the created data structure */
typedef void gen_entry_handler
- (lf *file, gen_entry *entry, int depth, void *data);
+ (lf *file, const gen_entry *entry, int depth, void *data);
extern void gen_entry_traverse_tree
(lf *file,
- gen_entry *table,
+ const gen_entry *table,
int depth,
gen_entry_handler * start,
gen_entry_handler * leaf, gen_entry_handler * end, void *data);
const char *basename,
const char *format_name,
const char *model_name,
- opcode_bits *expanded_bits, lf_function_name_prefixes prefix);
+ const opcode_bits *expanded_bits,
+ lf_function_name_prefixes prefix);
extern void print_my_defines
(lf *file,
- const char *basename, const char *format_name, opcode_bits *expanded_bits);
+ const char *basename,
+ const char *format_name,
+ const opcode_bits *expanded_bits);
-extern void print_itrace (lf *file, insn_entry * insn, int idecode);
+extern void print_itrace (lf *file, const insn_entry *insn, int idecode);
extern void print_sim_engine_abort (lf *file, const char *message);
/* Function names */
static int
-print_opcode_bits (lf *file, opcode_bits *bits)
+print_opcode_bits (lf *file, const opcode_bits *bits)
{
int nr = 0;
if (bits == NULL)
const char *basename,
const char *format_name,
const char *model_name,
- opcode_bits *expanded_bits,
+ const opcode_bits *expanded_bits,
lf_function_name_prefixes prefix)
{
int nr = 0;
void
print_my_defines (lf *file,
const char *basename,
- const char *format_name, opcode_bits *expanded_bits)
+ const char *format_name,
+ const opcode_bits *expanded_bits)
{
/* #define MY_INDEX xxxxx */
lf_indent_suppress (file);
static void
-print_itrace_format (lf *file, insn_mnemonic_entry *assembler)
+print_itrace_format (lf *file, const insn_mnemonic_entry *assembler)
{
/* pass=1 is fmt string; pass=2 is arguments */
int pass;
void
-print_itrace (lf *file, insn_entry * insn, int idecode)
+print_itrace (lf *file, const insn_entry *insn, int idecode)
{
/* NB: Here we escape each EOLN. This is so that the the compiler
treats a trace function call as a single line. Consequently any
static void
-gen_semantics_h (lf *file, insn_list *semantics, int max_nr_words)
+gen_semantics_h (lf *file, const insn_list *semantics, int max_nr_words)
{
int word_nr;
- insn_list *semantic;
+ const insn_list *semantic;
for (word_nr = -1; word_nr <= max_nr_words; word_nr++)
{
lf_printf (file, "typedef ");
static void
-gen_semantics_c (lf *file, insn_list *semantics, cache_entry *cache_rules)
+gen_semantics_c (lf *file, const insn_list *semantics, cache_entry *cache_rules)
{
if (options.gen.code == generate_calls)
{
- insn_list *semantic;
+ const insn_list *semantic;
print_includes (file);
print_include (file, options.module.semantics);
lf_printf (file, "\n");
static void
gen_icache_h (lf *file,
- insn_list *semantic,
- function_entry * functions, int max_nr_words)
+ const insn_list *semantic,
+ const function_entry *functions, int max_nr_words)
{
int word_nr;
for (word_nr = 0; word_nr <= max_nr_words; word_nr++)
static void
gen_icache_c (lf *file,
- insn_list *semantic,
- function_entry * functions, cache_entry *cache_rules)
+ const insn_list *semantic,
+ const function_entry *functions, cache_entry *cache_rules)
{
/* output `internal' invalid/floating-point unavailable functions
where needed */
static void
gen_idecode_h (lf *file,
- gen_table *gen, insn_table *insns, cache_entry *cache_rules)
+ const gen_table *gen,
+ const insn_table *insns,
+ cache_entry *cache_rules)
{
lf_printf (file, "typedef uint%d_t %sinstruction_word;\n",
options.insn_bit_size, options.module.global.prefix.l);
static void
gen_idecode_c (lf *file,
- gen_table *gen, insn_table *isa, cache_entry *cache_rules)
+ const gen_table *gen,
+ const insn_table *isa,
+ cache_entry *cache_rules)
{
/* the intro */
print_includes (file);
static void
-gen_run_c (lf *file, gen_table *gen)
+gen_run_c (lf *file, const gen_table *gen)
{
gen_list *entry;
lf_printf (file, "#include \"sim-main.h\"\n");
/****************************************************************/
static gen_table *
-do_gen (insn_table *isa, decode_table *decode_rules)
+do_gen (const insn_table *isa, const decode_table *decode_rules)
{
gen_table *gen;
if (decode_rules == NULL)
case 'D':
if (strcmp (optarg, "processor-names"))
{
- char *processor;
+ const char *processor;
for (processor = filter_next (options.model_filter, "");
processor != NULL;
processor = filter_next (options.model_filter, processor))
cache_entry *
-load_cache_table (char *file_name)
+load_cache_table (const char *file_name)
{
cache_entry *cache = NULL;
cache_entry **last = &cache;
new name had better be the same. */
-extern cache_entry *load_cache_table (char *file_name);
+extern cache_entry *load_cache_table (const char *file_name);
}
decode_table *
-load_decode_table (char *file_name)
+load_decode_table (const char *file_name)
{
table *file = table_open (file_name);
table_entry *entry;
int
-decode_table_max_word_nr (decode_table *entry)
+decode_table_max_word_nr (const decode_table *entry)
{
int max_word_nr = 0;
while (entry != NULL)
}
-
static void
-dump_decode_cond (lf *file, char *prefix, decode_cond *cond, char *suffix)
+dump_decode_cond (lf *file, const char *prefix, const decode_cond *cond,
+ const char *suffix)
{
lf_printf (file, "%s(decode_cond *) 0x%lx", prefix, (long) cond);
if (cond != NULL)
static void
-dump_decode_conds (lf *file, char *prefix, decode_cond *cond, char *suffix)
+dump_decode_conds (lf *file, const char *prefix, const decode_cond *cond,
+ const char *suffix)
{
lf_printf (file, "%s(decode_cond *) 0x%lx", prefix, (long) cond);
while (cond != NULL)
void
-dump_decode_rule (lf *file, char *prefix, decode_table *rule, char *suffix)
+dump_decode_rule (lf *file, const char *prefix, const decode_table *rule,
+ const char *suffix)
{
lf_printf (file, "%s(decode_table *) 0x%lx", prefix, (long) rule);
if (rule != NULL)
#ifdef MAIN
static void
-dump_decode_rules (lf *file, char *prefix, decode_table *rule, char *suffix)
+dump_decode_rules (lf *file,
+ const char *prefix,
+ const decode_table *rule,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
while (rule != NULL)
};
-extern decode_table *load_decode_table (char *file_name);
+extern decode_table *load_decode_table (const char *file_name);
-extern int decode_table_max_word_nr (decode_table *rule);
+extern int decode_table_max_word_nr (const decode_table *rule);
extern void dump_decode_rule
- (lf *file, char *prefix, decode_table *rule, char *suffix);
+ (lf *file, const char *prefix, const decode_table *rule, const char *suffix);
#include "ld-insn.h"
static insn_word_entry *
-parse_insn_word (line_ref *line, char *string, int word_nr)
+parse_insn_word (const line_ref *line, char *string, int word_nr)
{
char *chp;
insn_word_entry *word = ZALLOC (insn_word_entry);
/* Find the corresponding master model record for each name so
that they can be linked in. */
int index;
- char *name = "";
+ const char *name = "";
while (1)
{
name = filter_next (new_insn_model->names, name);
insn_table *
-load_insn_table (char *file_name, cache_entry *cache)
+load_insn_table (const char *file_name, cache_entry *cache)
{
table *file = table_open (file_name);
table_entry *record = table_read (file);
void
-print_insn_words (lf *file, insn_entry * insn)
+print_insn_words (lf *file, const insn_entry *insn)
{
insn_word_entry *word = insn->words;
if (word != NULL)
void
function_entry_traverse (lf *file,
- function_entry * functions,
+ const function_entry *functions,
function_entry_handler * handler, void *data)
{
- function_entry *function;
+ const function_entry *function;
for (function = functions; function != NULL; function = function->next)
{
handler (file, function, data);
void
insn_table_traverse_insn (lf *file,
- insn_table *isa,
+ const insn_table *isa,
insn_entry_handler * handler, void *data)
{
- insn_entry *insn;
+ const insn_entry *insn;
for (insn = isa->insns; insn != NULL; insn = insn->next)
{
handler (file, isa, insn, data);
static void
dump_function_entry (lf *file,
- char *prefix, function_entry * entry, char *suffix)
+ const char *prefix,
+ const function_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s(function_entry *) 0x%lx", prefix, (long) entry);
if (entry != NULL)
static void
dump_function_entries (lf *file,
- char *prefix, function_entry * entry, char *suffix)
+ const char *prefix,
+ const function_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
lf_indent (file, +1);
}
static void
-dump_cache_entry (lf *file, char *prefix, cache_entry *entry, char *suffix)
+dump_cache_entry (lf *file,
+ const char *prefix,
+ const cache_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s(cache_entry *) 0x%lx", prefix, (long) entry);
if (entry != NULL)
}
void
-dump_cache_entries (lf *file, char *prefix, cache_entry *entry, char *suffix)
+dump_cache_entries (lf *file,
+ const char *prefix,
+ const cache_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
lf_indent (file, +1);
}
static void
-dump_model_data (lf *file, char *prefix, model_data *entry, char *suffix)
+dump_model_data (lf *file,
+ const char *prefix,
+ const model_data *entry,
+ const char *suffix)
{
lf_printf (file, "%s(model_data *) 0x%lx", prefix, (long) entry);
if (entry != NULL)
}
static void
-dump_model_datas (lf *file, char *prefix, model_data *entry, char *suffix)
+dump_model_datas (lf *file,
+ const char *prefix,
+ const model_data *entry,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
lf_indent (file, +1);
}
static void
-dump_model_entry (lf *file, char *prefix, model_entry *entry, char *suffix)
+dump_model_entry (lf *file,
+ const char *prefix,
+ const model_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s(model_entry *) 0x%lx", prefix, (long) entry);
if (entry != NULL)
}
static void
-dump_model_entries (lf *file, char *prefix, model_entry *entry, char *suffix)
+dump_model_entries (lf *file,
+ const char *prefix,
+ const model_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
lf_indent (file, +1);
static void
-dump_model_table (lf *file, char *prefix, model_table *entry, char *suffix)
+dump_model_table (lf *file,
+ const char *prefix,
+ const model_table *entry,
+ const char *suffix)
{
lf_printf (file, "%s(model_table *) 0x%lx", prefix, (long) entry);
if (entry != NULL)
void
dump_insn_field (lf *file,
- char *prefix, insn_field_entry *field, char *suffix)
+ const char *prefix,
+ const insn_field_entry *field,
+ const char *suffix)
{
char *sep = " ";
lf_printf (file, "%s(insn_field_entry *) 0x%lx", prefix, (long) field);
void
dump_insn_word_entry (lf *file,
- char *prefix, insn_word_entry *word, char *suffix)
+ const char *prefix,
+ const insn_word_entry *word,
+ const char *suffix)
{
lf_printf (file, "%s(insn_word_entry *) 0x%lx", prefix, (long) word);
if (word != NULL)
static void
dump_insn_word_entries (lf *file,
- char *prefix, insn_word_entry *word, char *suffix)
+ const char *prefix,
+ const insn_word_entry *word,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
while (word != NULL)
static void
dump_insn_model_entry (lf *file,
- char *prefix, insn_model_entry *model, char *suffix)
+ const char *prefix,
+ const insn_model_entry *model,
+ const char *suffix)
{
lf_printf (file, "%s(insn_model_entry *) 0x%lx", prefix, (long) model);
if (model != NULL)
static void
dump_insn_model_entries (lf *file,
- char *prefix, insn_model_entry *model, char *suffix)
+ const char *prefix,
+ const insn_model_entry *model,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
while (model != NULL)
static void
dump_insn_mnemonic_entry (lf *file,
- char *prefix,
- insn_mnemonic_entry *mnemonic, char *suffix)
+ const char *prefix,
+ const insn_mnemonic_entry *mnemonic,
+ const char *suffix)
{
lf_printf (file, "%s(insn_mnemonic_entry *) 0x%lx", prefix,
(long) mnemonic);
static void
dump_insn_mnemonic_entries (lf *file,
- char *prefix,
- insn_mnemonic_entry *mnemonic, char *suffix)
+ const char *prefix,
+ const insn_mnemonic_entry *mnemonic,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
while (mnemonic != NULL)
}
void
-dump_insn_entry (lf *file, char *prefix, insn_entry * entry, char *suffix)
+dump_insn_entry (lf *file,
+ const char *prefix,
+ const insn_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s(insn_entry *) 0x%lx", prefix, (long) entry);
if (entry != NULL)
}
static void
-dump_insn_entries (lf *file, char *prefix, insn_entry * entry, char *suffix)
+dump_insn_entries (lf *file,
+ const char *prefix,
+ const insn_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s", prefix);
lf_indent (file, +1);
}
-
void
-dump_insn_table (lf *file, char *prefix, insn_table *isa, char *suffix)
+dump_insn_table (lf *file,
+ const char *prefix,
+ const insn_table *isa,
+ const char *suffix)
{
lf_printf (file, "%s(insn_table *) 0x%lx", prefix, (long) isa);
if (isa != NULL)
typedef void function_entry_handler
- (lf *file, function_entry * function, void *data);
+ (lf *file, const function_entry *function, void *data);
extern void function_entry_traverse
(lf *file,
- function_entry * functions, function_entry_handler * handler, void *data);
+ const function_entry *functions,
+ function_entry_handler * handler, void *data);
/* cache-macro:
filter *flags;
};
-extern insn_table *load_insn_table (char *file_name, cache_entry *cache);
+extern insn_table *load_insn_table (const char *file_name, cache_entry *cache);
typedef void insn_entry_handler
- (lf *file, insn_table *isa, insn_entry * insn, void *data);
+ (lf *file, const insn_table *isa, const insn_entry *insn, void *data);
extern void insn_table_traverse_insn
- (lf *file, insn_table *isa, insn_entry_handler * handler, void *data);
+ (lf *file, const insn_table *isa, insn_entry_handler *handler, void *data);
/* Printing */
-extern void print_insn_words (lf *file, insn_entry * insn);
+extern void print_insn_words (lf *file, const insn_entry *insn);
/* Debugging */
-void
- dump_insn_field
- (lf *file, char *prefix, insn_field_entry *field, char *suffix);
+void dump_insn_field
+ (lf *file, const char *prefix, const insn_field_entry *field,
+ const char *suffix);
-void
- dump_insn_word_entry
- (lf *file, char *prefix, insn_word_entry *word, char *suffix);
+void dump_insn_word_entry
+ (lf *file, const char *prefix, const insn_word_entry *word,
+ const char *suffix);
-void
- dump_insn_entry (lf *file, char *prefix, insn_entry * insn, char *suffix);
+void dump_insn_entry
+ (lf *file, const char *prefix, const insn_entry *insn, const char *suffix);
-void
- dump_cache_entries
- (lf *file, char *prefix, cache_entry *entry, char *suffix);
+void dump_cache_entries
+ (lf *file, const char *prefix, const cache_entry *entry, const char *suffix);
-void dump_insn_table (lf *file, char *prefix, insn_table *isa, char *suffix);
+void dump_insn_table
+ (lf *file, const char *prefix, const insn_table *isa, const char *suffix);
lf *
-lf_open (char *name,
- char *real_name,
+lf_open (const char *name,
+ const char *real_name,
lf_file_references references,
lf_file_type type, const char *program)
{
int
-lf_print__line_ref (lf *file, line_ref *line)
+lf_print__line_ref (lf *file, const line_ref *line)
{
return lf_print__external_ref (file, line->line_nr, line->file_name);
}
the print messages below. */
extern lf *lf_open
- (char *name,
- char *real_name,
+ (const char *name,
+ const char *real_name,
lf_file_references file_references,
lf_file_type type, const char *program);
extern int lf_print__external_ref
(lf *file, int line_nr, const char *file_name);
-extern int lf_print__line_ref (lf *file, line_ref *line);
+extern int lf_print__line_ref (lf *file, const line_ref *line);
extern int lf_print__ucase_filename (lf *file);
trailing '\n' */
void
-error (const line_ref *line, char *msg, ...)
+error (const line_ref *line, const char *msg, ...)
{
va_list ap;
if (line != NULL)
}
void
-warning (const line_ref *line, char *msg, ...)
+warning (const line_ref *line, const char *msg, ...)
{
va_list ap;
if (line != NULL)
}
void
-notify (const line_ref *line, char *msg, ...)
+notify (const line_ref *line, const char *msg, ...)
{
va_list ap;
if (line != NULL)
};
/* Error appends a new line, warning and notify do not */
-typedef void error_func (const line_ref *line, char *msg, ...);
+typedef void error_func (const line_ref *line, const char *msg, ...);
extern error_func error;
extern error_func warning;
void
table_push (table *root,
- line_ref *line, table_include *includes, const char *file_name)
+ const line_ref *line,
+ table_include *includes,
+ const char *file_name)
{
FILE *ff;
open_table *file;
}
extern void
-table_print_code (lf *file, table_entry *entry)
+table_print_code (lf *file, const table_entry *entry)
{
int field_nr;
int nr = 0;
}
-
void
-dump_line_ref (lf *file, char *prefix, const line_ref *line, char *suffix)
+dump_line_ref (lf *file,
+ const char *prefix,
+ const line_ref *line,
+ const char *suffix)
{
lf_printf (file, "%s(line_ref*) 0x%lx", prefix, (long) line);
if (line != NULL)
void
dump_table_entry (lf *file,
- char *prefix, const table_entry *entry, char *suffix)
+ const char *prefix,
+ const table_entry *entry,
+ const char *suffix)
{
lf_printf (file, "%s(table_entry*) 0x%lx", prefix, (long) entry);
if (entry != NULL)
the end of FILE_NAME is reached, return to the pushed file */
extern void table_push
- (table *file, line_ref *line, table_include *search, const char *file_name);
+ (table *file, const line_ref *line, table_include *search,
+ const char *file_name);
/* Expand the specified field_nr using the internal expansion table.
leading/trailing braces were striped as part of the read, they are
not written. */
-extern void table_print_code (lf *file, table_entry *entry);
+extern void table_print_code (lf *file, const table_entry *entry);
/* Debugging */
extern void dump_line_ref
- (lf *file, char *prefix, const line_ref *line, char *suffix);
+ (lf *file, const char *prefix, const line_ref *line, const char *suffix);
extern void dump_table_entry
- (lf *file, char *prefix, const table_entry *entry, char *suffix);
+ (lf *file, const char *prefix, const table_entry *entry, const char *suffix);