1 |
6 |
jlechner |
; General cpu info generator support.
|
2 |
|
|
; Copyright (C) 2000, 2003, 2009 Red Hat, Inc.
|
3 |
|
|
; This file is part of CGEN.
|
4 |
|
|
;
|
5 |
|
|
; This file generates C versions of the more salient parts of the description
|
6 |
|
|
; file. It's currently part of opcodes or simulator support,
|
7 |
|
|
; and doesn't exist as its own "application" (i.e. user of cgen),
|
8 |
|
|
; though that's not precluded.
|
9 |
|
|
|
10 |
|
|
; to record them in the syntax field as the mnemonic field also contains it.
|
11 |
|
|
; Furthermore, the insn table can be hashed on complete mnemonic.
|
12 |
|
|
; ??? Should live in <derived-arch-data> or some such.
|
13 |
|
|
; Attribute support code.
|
14 |
|
|
|
15 |
|
|
/* Attributes. */
|
16 |
|
|
|
17 |
|
|
static const CGEN_ATTR_ENTRY bool_attr[] =
|
18 |
|
|
|
19 |
|
|
{ \"#f\", 0 },
|
20 |
|
|
{ \"#t\", 1 },
|
21 |
|
|
{ 0, 0 }
|
22 |
|
|
};
|
23 |
|
|
|
24 |
|
|
"; Generate tables mapping names to values for all the non-boolean attrs.
|
25 |
|
|
; Generate tables for each domain (ifld, insn, etc.) mapping attribute type
|
26 |
|
|
; to index.
|
27 |
|
|
"ifield""hardware""operand""insn"; HW-ASM is the base class for supporting hardware elements in the opcode table
|
28 |
|
|
; (aka assembler/disassembler).
|
29 |
|
|
; Return the C declaration.
|
30 |
|
|
; It is up to a derived class to redefine this as necessary.
|
31 |
|
|
""; Return the C definition.
|
32 |
|
|
; It is up to a derived class to redefine this as necessary.
|
33 |
|
|
"""0""""CGEN_ASM_NONE, 0, "; Prefix of global variables describing operand values.
|
34 |
|
|
"@arch@_cgen_opval_"; Emit a C reference to a value operand.
|
35 |
|
|
; Usually the operand's details are stored in a struct so in the default
|
36 |
|
|
; case return that struct (?correct?). The caller must add the "&" if desired.
|
37 |
|
|
; Keyword support.
|
38 |
|
|
; Keyword operands.
|
39 |
|
|
; Return the C declaration of a keyword list.
|
40 |
|
|
"extern CGEN_KEYWORD "";\n"; Return the C definition of a keyword list.
|
41 |
|
|
|
42 |
|
|
" { \""; operand name
|
43 |
|
|
"\", "; value
|
44 |
|
|
", {0, {{{0, 0}}}}, 0, 0"" },\n""\n};\n\n""CGEN_KEYWORD "" =\n{\n"" & ""_entries[0],\n"" "",\n"" 0, 0, 0, 0, \"\"\n""};\n\n"; Return a reference to a keyword table.
|
45 |
|
|
"& ""CGEN_ASM_KEYWORD, (PTR) "", "; Return the C code to initialize a keyword.
|
46 |
|
|
; If the `hash' attr is present, the values are hashed. Currently this is
|
47 |
|
|
|
48 |
|
|
; FIXME: Currently unused. Should be done either in the open routine or
|
49 |
|
|
; lazily upon lookup.
|
50 |
|
|
" @arch@_cgen_asm_hash_keywords ("");\n"""; Operand support.
|
51 |
|
|
; Return a reference to the operand's attributes.
|
52 |
|
|
"& CGEN_OPERAND_ATTRS (CGEN_SYM (operand_table)) ""[""]"; Name of C variable that is a pointer to the fields struct.
|
53 |
|
|
"fields"; Given FIELD, an `ifield' object, return an lvalue for the operand in
|
54 |
|
|
|
55 |
|
|
"->"; Basic description init,finish,analyzer support.
|
56 |
|
|
; Return a boolean indicating if all insns have a constant mnemonic
|
57 |
|
|
; (ie: no $'s in insn's name in `syntax' field).
|
58 |
|
|
; If constant, one can build the assembler hash table using the entire
|
59 |
|
|
; mnemonic.
|
60 |
|
|
; FIXME
|
61 |
|
|
; Initialize any "desc" specific things before loading the .cpu file.
|
62 |
|
|
; N.B. Since "desc" is always a part of another application, that
|
63 |
|
|
; application's init! routine must call this one.
|
64 |
|
|
; Finish any "desc" specific things after loading the .cpu file.
|
65 |
|
|
; This is separate from analyze-data! as cpu-load performs some
|
66 |
|
|
|
67 |
|
|
; N.B. Since "desc" is always a part of another application, that
|
68 |
|
|
; application's finish! routine must call this one.
|
69 |
|
|
|
70 |
|
|
; the various objects. This is the standard routine that is called after
|
71 |
|
|
; a .cpu file is loaded.
|
72 |
|
|
|
73 |
|
|
; application's analyze! routine must call this one.
|
74 |
|
|
|