8 * Define the types of the arch facility.
9 * All arch object names are stored in bearch_obj.def
11 #define ARCH_OBJ(x,list) typedef struct _arch_ ## x ## _t arch_ ## x ## _t;
12 #include "bearch_obj.def"
16 * A callback to determine the set of valid registers.
18 * @param irn The node which represents an instance of the instruction.
19 * @param pos The number of the insn's operand to consider.
20 * @param valid_regs A bitset where all valid registers are put.
22 typedef void (arch_register_callback_t)(ir_node *irn, int pos, bitset_t *valid_regs);
26 * Add a new instruction set architecture.
27 * @param name The name of the isa.
28 * @return The isa object.
30 arch_isa_t *arch_add_isa(const char *name);
33 * Add a register class to the isa.
34 * @param isa The isa to add the reg class to.
35 * @param name The name of the register class.
36 * @param n_regs The number of registers in that class.
37 * @param mode The mode of the registers in that class.
39 arch_register_class_t *arch_add_register_class(arch_isa_t *isa, const char *name, int n_regs);
42 * Add a register to a register class.
43 * @param cls The register class.
44 * @param index The index of the register (its number within the
46 * @param name The name of the register.
47 * @return The register.
49 arch_register_t *arch_add_register(arch_register_class_t *cls, int index, const char *name);
52 * Add an immediate to the instruction set architecture.
54 * @param name The name of the immediate.
55 * @param mode The mode of the immediate.
56 * @return The immediate.
58 arch_immediate_t *arch_add_immediate(arch_isa_t *isa, const char *name, ir_mode *mode);
61 * Add an instruction format to an isa.
63 * @param name The name of the instruction format.
64 * @param n_in The number of in operands.
65 * @param n_out The number of out operands.
68 arch_insn_format_t *arch_add_insn_format(arch_isa_t *isa, const char *name, int n_in, int n_out);
71 * Add a register set as an operand type.
72 * @param fmt The instruction format whose operand is to be set.
73 * @param pos The position of the operand. Note that input operands are
74 * numbered from 0 to n and output operands from -1 to -m.
75 * @param set The register set.
76 * @return The corresponding operand type.
78 arch_operand_t *arch_add_operand_register_set(arch_insn_format_t *fmt,
79 int pos, const arch_register_set_t *set);
81 arch_operand_t *arch_add_operand_callback(arch_insn_format_t *fmt,
82 int pos, arch_register_callback_t *cb);
84 arch_operand_t *arch_add_operand_immediate(arch_insn_format_t *fmt,
85 int pos, const arch_immediate_t *imm);
88 * Add an instruction to the isa.
89 * @param fmt The instructon format.
90 * @param name The name of the instruction.
92 arch_insn_t *arch_add_insn(arch_insn_format_t *fmt, const char *name);
96 * Find an instruction format.
98 * @param name The name of the instruction format.
99 * @return The instruction format, if it was added before, or NULL if it
102 arch_insn_format_t *arch_find_insn_format(arch_isa_t *isa, const char *name);
106 * @param name The name of the isa.
107 * @return The isa if it has been added, or NULl if it is unknwon.
109 arch_isa_t *arch_find_isa(const char *name);
112 * Find a register class of an isa.
113 * @param isa The isa.
114 * @param name The name of the register class.
115 * @return The register class, if it has been added, NULL if it is
118 arch_register_class_t *arch_find_register_class(arch_isa_t *isa, const char *name);
121 * Get the register set for a register class.
122 * Each register class possesses a set containing all registers known in
124 * @param cls The class.
125 * @return The register set for the register class.
127 arch_register_set_t *arch_get_register_set_for_class(arch_register_class_t *cls);