1 #include "gen_TEMPLATE_new_nodes.h" 4 #include "TEMPLATE_bearch_t.h" 5 #include "gen_TEMPLATE_regalloc_if.h" 6 #include "TEMPLATE_new_nodes_t.h" 11 ir_op *op_TEMPLATE_Add = NULL;
12 ir_op *op_TEMPLATE_And = NULL;
13 ir_op *op_TEMPLATE_Const = NULL;
14 ir_op *op_TEMPLATE_Jmp = NULL;
15 ir_op *op_TEMPLATE_Load = NULL;
16 ir_op *op_TEMPLATE_Minus = NULL;
17 ir_op *op_TEMPLATE_Mul = NULL;
18 ir_op *op_TEMPLATE_Not = NULL;
19 ir_op *op_TEMPLATE_Or = NULL;
20 ir_op *op_TEMPLATE_Return = NULL;
21 ir_op *op_TEMPLATE_Shl = NULL;
22 ir_op *op_TEMPLATE_Shr = NULL;
23 ir_op *op_TEMPLATE_Store = NULL;
24 ir_op *op_TEMPLATE_Sub = NULL;
25 ir_op *op_TEMPLATE_Xor = NULL;
26 ir_op *op_TEMPLATE_fAdd = NULL;
27 ir_op *op_TEMPLATE_fConst = NULL;
28 ir_op *op_TEMPLATE_fDiv = NULL;
29 ir_op *op_TEMPLATE_fLoad = NULL;
30 ir_op *op_TEMPLATE_fMinus = NULL;
31 ir_op *op_TEMPLATE_fMul = NULL;
32 ir_op *op_TEMPLATE_fStore = NULL;
33 ir_op *op_TEMPLATE_fSub = NULL;
36 static int TEMPLATE_opcode_start = -1;
39 #define TEMPLATE_op_tag FOURCC('T', 'E', 'M', 'P') 42 int is_TEMPLATE_op(
const ir_op *op)
44 return get_op_tag(op) == TEMPLATE_op_tag;
48 int is_TEMPLATE_irn(
const ir_node *node)
53 int get_TEMPLATE_irn_opcode(
const ir_node *node)
55 assert(is_TEMPLATE_irn(node));
60 #define BIT(x) (1 << (x)) 67 static arch_register_req_t
const *in_reqs[] = {
68 &TEMPLATE_class_reg_req_gp,
69 &TEMPLATE_class_reg_req_gp,
82 arch_irn_flags_t irn_flags = arch_irn_flags_none;
83 irn_flags |= arch_irn_flag_rematerializable;
89 be_info_init_irn(res, irn_flags, in_reqs, n_res);
90 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
91 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
99 static arch_register_req_t
const *in_reqs[] = {
100 &TEMPLATE_class_reg_req_gp,
101 &TEMPLATE_class_reg_req_gp,
114 arch_irn_flags_t irn_flags = arch_irn_flags_none;
115 irn_flags |= arch_irn_flag_rematerializable;
121 be_info_init_irn(res, irn_flags, in_reqs, n_res);
122 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
123 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
131 arch_register_req_t
const **
const in_reqs = NULL;
138 arch_irn_flags_t irn_flags = arch_irn_flags_none;
139 irn_flags |= arch_irn_flag_rematerializable;
145 be_info_init_irn(res, irn_flags, in_reqs, n_res);
146 set_TEMPLATE_value(res, entity, value);
147 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
148 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
156 arch_register_req_t
const **
const in_reqs = NULL;
163 arch_irn_flags_t irn_flags = arch_irn_flags_none;
164 irn_flags |= arch_irn_flag_simple_jump;
170 be_info_init_irn(res, irn_flags, in_reqs, n_res);
171 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
172 out_infos[0].req = &arch_exec_requirement;
180 static arch_register_req_t
const *in_reqs[] = {
181 &arch_memory_requirement,
182 &TEMPLATE_class_reg_req_gp,
195 arch_irn_flags_t irn_flags = arch_irn_flags_none;
196 irn_flags |= arch_irn_flag_rematerializable;
202 be_info_init_irn(res, irn_flags, in_reqs, n_res);
203 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
204 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
205 out_infos[1].req = &arch_memory_requirement;
213 static arch_register_req_t
const *in_reqs[] = {
214 &TEMPLATE_class_reg_req_gp,
226 arch_irn_flags_t irn_flags = arch_irn_flags_none;
227 irn_flags |= arch_irn_flag_rematerializable;
233 be_info_init_irn(res, irn_flags, in_reqs, n_res);
234 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
235 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
243 static arch_register_req_t
const *in_reqs[] = {
244 &TEMPLATE_class_reg_req_gp,
245 &TEMPLATE_class_reg_req_gp,
258 arch_irn_flags_t irn_flags = arch_irn_flags_none;
259 irn_flags |= arch_irn_flag_rematerializable;
265 be_info_init_irn(res, irn_flags, in_reqs, n_res);
266 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
267 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
275 static arch_register_req_t
const *in_reqs[] = {
276 &TEMPLATE_class_reg_req_gp,
288 arch_irn_flags_t irn_flags = arch_irn_flags_none;
289 irn_flags |= arch_irn_flag_rematerializable;
295 be_info_init_irn(res, irn_flags, in_reqs, n_res);
296 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
297 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
305 static arch_register_req_t
const *in_reqs[] = {
306 &TEMPLATE_class_reg_req_gp,
307 &TEMPLATE_class_reg_req_gp,
320 arch_irn_flags_t irn_flags = arch_irn_flags_none;
321 irn_flags |= arch_irn_flag_rematerializable;
327 be_info_init_irn(res, irn_flags, in_reqs, n_res);
328 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
329 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
335 ir_node *new_bd_TEMPLATE_Return(
dbg_info *dbgi,
ir_node *block,
int const arity,
ir_node *
const *
const in, arch_register_req_t
const **
const in_reqs)
343 arch_irn_flags_t irn_flags = arch_irn_flags_none;
349 be_info_init_irn(res, irn_flags, in_reqs, n_res);
350 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
351 out_infos[0].req = &arch_exec_requirement;
359 static arch_register_req_t
const *in_reqs[] = {
360 &TEMPLATE_class_reg_req_gp,
361 &TEMPLATE_class_reg_req_gp,
374 arch_irn_flags_t irn_flags = arch_irn_flags_none;
375 irn_flags |= arch_irn_flag_rematerializable;
381 be_info_init_irn(res, irn_flags, in_reqs, n_res);
382 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
383 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
391 static arch_register_req_t
const *in_reqs[] = {
392 &TEMPLATE_class_reg_req_gp,
393 &TEMPLATE_class_reg_req_gp,
406 arch_irn_flags_t irn_flags = arch_irn_flags_none;
407 irn_flags |= arch_irn_flag_rematerializable;
413 be_info_init_irn(res, irn_flags, in_reqs, n_res);
414 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
415 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
423 static arch_register_req_t
const *in_reqs[] = {
424 &arch_memory_requirement,
425 &TEMPLATE_class_reg_req_gp,
426 &TEMPLATE_class_reg_req_gp,
440 arch_irn_flags_t irn_flags = arch_irn_flags_none;
441 irn_flags |= arch_irn_flag_rematerializable;
447 be_info_init_irn(res, irn_flags, in_reqs, n_res);
448 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
449 out_infos[0].req = &arch_memory_requirement;
457 static arch_register_req_t
const *in_reqs[] = {
458 &TEMPLATE_class_reg_req_gp,
459 &TEMPLATE_class_reg_req_gp,
472 arch_irn_flags_t irn_flags = arch_irn_flags_none;
473 irn_flags |= arch_irn_flag_rematerializable;
479 be_info_init_irn(res, irn_flags, in_reqs, n_res);
480 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
481 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
489 static arch_register_req_t
const *in_reqs[] = {
490 &TEMPLATE_class_reg_req_gp,
491 &TEMPLATE_class_reg_req_gp,
504 arch_irn_flags_t irn_flags = arch_irn_flags_none;
505 irn_flags |= arch_irn_flag_rematerializable;
511 be_info_init_irn(res, irn_flags, in_reqs, n_res);
512 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
513 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
521 static arch_register_req_t
const *in_reqs[] = {
522 &TEMPLATE_class_reg_req_fp,
523 &TEMPLATE_class_reg_req_fp,
536 arch_irn_flags_t irn_flags = arch_irn_flags_none;
537 irn_flags |= arch_irn_flag_rematerializable;
543 be_info_init_irn(res, irn_flags, in_reqs, n_res);
544 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
545 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
553 arch_register_req_t
const **
const in_reqs = NULL;
560 arch_irn_flags_t irn_flags = arch_irn_flags_none;
561 irn_flags |= arch_irn_flag_rematerializable;
567 be_info_init_irn(res, irn_flags, in_reqs, n_res);
568 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
569 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
577 static arch_register_req_t
const *in_reqs[] = {
578 &TEMPLATE_class_reg_req_fp,
579 &TEMPLATE_class_reg_req_fp,
592 arch_irn_flags_t irn_flags = arch_irn_flags_none;
598 be_info_init_irn(res, irn_flags, in_reqs, n_res);
599 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
600 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
608 static arch_register_req_t
const *in_reqs[] = {
609 &arch_memory_requirement,
610 &TEMPLATE_class_reg_req_gp,
623 arch_irn_flags_t irn_flags = arch_irn_flags_none;
624 irn_flags |= arch_irn_flag_rematerializable;
630 be_info_init_irn(res, irn_flags, in_reqs, n_res);
631 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
632 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
633 out_infos[1].req = &arch_memory_requirement;
641 static arch_register_req_t
const *in_reqs[] = {
642 &TEMPLATE_class_reg_req_fp,
654 arch_irn_flags_t irn_flags = arch_irn_flags_none;
655 irn_flags |= arch_irn_flag_rematerializable;
661 be_info_init_irn(res, irn_flags, in_reqs, n_res);
662 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
663 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
671 static arch_register_req_t
const *in_reqs[] = {
672 &TEMPLATE_class_reg_req_fp,
673 &TEMPLATE_class_reg_req_fp,
686 arch_irn_flags_t irn_flags = arch_irn_flags_none;
692 be_info_init_irn(res, irn_flags, in_reqs, n_res);
693 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
694 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
702 static arch_register_req_t
const *in_reqs[] = {
703 &arch_memory_requirement,
704 &TEMPLATE_class_reg_req_gp,
705 &TEMPLATE_class_reg_req_fp,
719 arch_irn_flags_t irn_flags = arch_irn_flags_none;
720 irn_flags |= arch_irn_flag_rematerializable;
726 be_info_init_irn(res, irn_flags, in_reqs, n_res);
727 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
728 out_infos[0].req = &arch_memory_requirement;
736 static arch_register_req_t
const *in_reqs[] = {
737 &TEMPLATE_class_reg_req_fp,
738 &TEMPLATE_class_reg_req_fp,
751 arch_irn_flags_t irn_flags = arch_irn_flags_none;
752 irn_flags |= arch_irn_flag_rematerializable;
758 be_info_init_irn(res, irn_flags, in_reqs, n_res);
759 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
760 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
771 void TEMPLATE_create_opcodes(
void)
776 TEMPLATE_opcode_start = cur_opcode;
781 set_op_tag(op, TEMPLATE_op_tag);
782 op_TEMPLATE_Add = op;
787 set_op_tag(op, TEMPLATE_op_tag);
788 op_TEMPLATE_And = op;
793 set_op_tag(op, TEMPLATE_op_tag);
794 op_TEMPLATE_Const = op;
799 set_op_tag(op, TEMPLATE_op_tag);
800 op_TEMPLATE_Jmp = op;
805 set_op_tag(op, TEMPLATE_op_tag);
806 op_TEMPLATE_Load = op;
811 set_op_tag(op, TEMPLATE_op_tag);
812 op_TEMPLATE_Minus = op;
817 set_op_tag(op, TEMPLATE_op_tag);
818 op_TEMPLATE_Mul = op;
823 set_op_tag(op, TEMPLATE_op_tag);
824 op_TEMPLATE_Not = op;
829 set_op_tag(op, TEMPLATE_op_tag);
835 set_op_tag(op, TEMPLATE_op_tag);
836 op_TEMPLATE_Return = op;
841 set_op_tag(op, TEMPLATE_op_tag);
842 op_TEMPLATE_Shl = op;
847 set_op_tag(op, TEMPLATE_op_tag);
848 op_TEMPLATE_Shr = op;
853 set_op_tag(op, TEMPLATE_op_tag);
854 op_TEMPLATE_Store = op;
859 set_op_tag(op, TEMPLATE_op_tag);
860 op_TEMPLATE_Sub = op;
865 set_op_tag(op, TEMPLATE_op_tag);
866 op_TEMPLATE_Xor = op;
871 set_op_tag(op, TEMPLATE_op_tag);
872 op_TEMPLATE_fAdd = op;
877 set_op_tag(op, TEMPLATE_op_tag);
878 op_TEMPLATE_fConst = op;
883 set_op_tag(op, TEMPLATE_op_tag);
884 op_TEMPLATE_fDiv = op;
889 set_op_tag(op, TEMPLATE_op_tag);
890 op_TEMPLATE_fLoad = op;
895 set_op_tag(op, TEMPLATE_op_tag);
896 op_TEMPLATE_fMinus = op;
901 set_op_tag(op, TEMPLATE_op_tag);
902 op_TEMPLATE_fMul = op;
907 set_op_tag(op, TEMPLATE_op_tag);
908 op_TEMPLATE_fStore = op;
913 set_op_tag(op, TEMPLATE_op_tag);
914 op_TEMPLATE_fSub = op;
918 void TEMPLATE_free_opcodes(
void)
920 free_ir_op(op_TEMPLATE_Add); op_TEMPLATE_Add = NULL;
921 free_ir_op(op_TEMPLATE_And); op_TEMPLATE_And = NULL;
922 free_ir_op(op_TEMPLATE_Const); op_TEMPLATE_Const = NULL;
923 free_ir_op(op_TEMPLATE_Jmp); op_TEMPLATE_Jmp = NULL;
924 free_ir_op(op_TEMPLATE_Load); op_TEMPLATE_Load = NULL;
925 free_ir_op(op_TEMPLATE_Minus); op_TEMPLATE_Minus = NULL;
926 free_ir_op(op_TEMPLATE_Mul); op_TEMPLATE_Mul = NULL;
927 free_ir_op(op_TEMPLATE_Not); op_TEMPLATE_Not = NULL;
928 free_ir_op(op_TEMPLATE_Or); op_TEMPLATE_Or = NULL;
929 free_ir_op(op_TEMPLATE_Return); op_TEMPLATE_Return = NULL;
930 free_ir_op(op_TEMPLATE_Shl); op_TEMPLATE_Shl = NULL;
931 free_ir_op(op_TEMPLATE_Shr); op_TEMPLATE_Shr = NULL;
932 free_ir_op(op_TEMPLATE_Store); op_TEMPLATE_Store = NULL;
933 free_ir_op(op_TEMPLATE_Sub); op_TEMPLATE_Sub = NULL;
934 free_ir_op(op_TEMPLATE_Xor); op_TEMPLATE_Xor = NULL;
935 free_ir_op(op_TEMPLATE_fAdd); op_TEMPLATE_fAdd = NULL;
936 free_ir_op(op_TEMPLATE_fConst); op_TEMPLATE_fConst = NULL;
937 free_ir_op(op_TEMPLATE_fDiv); op_TEMPLATE_fDiv = NULL;
938 free_ir_op(op_TEMPLATE_fLoad); op_TEMPLATE_fLoad = NULL;
939 free_ir_op(op_TEMPLATE_fMinus); op_TEMPLATE_fMinus = NULL;
940 free_ir_op(op_TEMPLATE_fMul); op_TEMPLATE_fMul = NULL;
941 free_ir_op(op_TEMPLATE_fStore); op_TEMPLATE_fStore = NULL;
942 free_ir_op(op_TEMPLATE_fSub); op_TEMPLATE_fSub = NULL;
unsigned get_irn_opcode(const ir_node *node)
Returns the opcode-enum of the node.
ir_graph * get_irn_irg(const ir_node *node)
Returns the ir_graph this node belongs to.
struct ir_op ir_op
Node Opcode.
void set_op_attrs_equal(ir_op *op, node_attrs_equal_func func)
Sets attrs_equal callback func for operation op.
void verify_new_node(ir_node *node)
If firm is built in debug mode, verify that a newly created node is fine.
struct dbg_info dbg_info
Source Reference.
void * get_irn_generic_attr(ir_node *node)
Returns a pointer to the node attributes.
struct ir_tarval ir_tarval
Target Machine Value.
ir_op * get_irn_op(const ir_node *node)
Returns the opcode struct of the node.
ir_node * optimize_node(ir_node *n)
Applies local optimizations to a single node.
ir_node * new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode, int arity, ir_node *const *in)
IR node constructor.
This operation is a control flow operation.
ir_mode * mode_T
tuple (none)
Nodes must remain in this basic block.
This operation has a memory input and may change the memory state.
Node must remain in this basic block if it can throw an exception, else can float.
void set_op_copy_attr(ir_op *op, copy_attr_func func)
Sets attribute copy callback func for operation op.
The arity is not fixed by opcode, but statically known.
ir_op * new_ir_op(unsigned code, const char *name, op_pin_state p, irop_flags flags, op_arity opar, int op_index, size_t attr_size)
Creates a new IR operation.
This operation has no arguments and is some kind of a constant.
unsigned get_next_ir_opcodes(unsigned num)
Returns the next free n IR opcode number, allows to register a bunch of user ops. ...
void set_op_dump(ir_op *op, dump_node_func func)
Sets dump callback func for operation op.
struct ir_entity ir_entity
Entity.
struct ir_node ir_node
Procedure Graph Node.
ir_mode * mode_F
ieee754 binary32 float (single precision)
void free_ir_op(ir_op *code)
Frees an ir operation.
struct ir_graph ir_graph
Procedure Graph.
ir_mode * mode_X
execution
Nodes of this opcode can be placed in any basic block.