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,
84 arch_irn_flags_t irn_flags = arch_irn_flags_none;
85 irn_flags |= arch_irn_flag_rematerializable;
87 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,
116 arch_irn_flags_t irn_flags = arch_irn_flags_none;
117 irn_flags |= arch_irn_flag_rematerializable;
119 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;
140 arch_irn_flags_t irn_flags = arch_irn_flags_none;
141 irn_flags |= arch_irn_flag_rematerializable;
143 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;
165 arch_irn_flags_t irn_flags = arch_irn_flags_none;
166 irn_flags |= arch_irn_flag_simple_jump;
167 irn_flags |= arch_irn_flag_fallthrough;
169 be_info_init_irn(res, irn_flags, in_reqs, n_res);
172 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
173 out_infos[0].req = &arch_exec_requirement;
181 static arch_register_req_t
const *in_reqs[] = {
182 &arch_memory_requirement,
183 &TEMPLATE_class_reg_req_gp,
198 arch_irn_flags_t irn_flags = arch_irn_flags_none;
199 irn_flags |= arch_irn_flag_rematerializable;
201 be_info_init_irn(res, irn_flags, in_reqs, n_res);
204 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
205 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
206 out_infos[1].req = &arch_memory_requirement;
214 static arch_register_req_t
const *in_reqs[] = {
215 &TEMPLATE_class_reg_req_gp,
229 arch_irn_flags_t irn_flags = arch_irn_flags_none;
230 irn_flags |= arch_irn_flag_rematerializable;
232 be_info_init_irn(res, irn_flags, in_reqs, n_res);
235 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
236 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
244 static arch_register_req_t
const *in_reqs[] = {
245 &TEMPLATE_class_reg_req_gp,
246 &TEMPLATE_class_reg_req_gp,
261 arch_irn_flags_t irn_flags = arch_irn_flags_none;
262 irn_flags |= arch_irn_flag_rematerializable;
264 be_info_init_irn(res, irn_flags, in_reqs, n_res);
267 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
268 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
276 static arch_register_req_t
const *in_reqs[] = {
277 &TEMPLATE_class_reg_req_gp,
291 arch_irn_flags_t irn_flags = arch_irn_flags_none;
292 irn_flags |= arch_irn_flag_rematerializable;
294 be_info_init_irn(res, irn_flags, in_reqs, n_res);
297 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
298 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
306 static arch_register_req_t
const *in_reqs[] = {
307 &TEMPLATE_class_reg_req_gp,
308 &TEMPLATE_class_reg_req_gp,
323 arch_irn_flags_t irn_flags = arch_irn_flags_none;
324 irn_flags |= arch_irn_flag_rematerializable;
326 be_info_init_irn(res, irn_flags, in_reqs, n_res);
329 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
330 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
336 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)
346 arch_irn_flags_t irn_flags = arch_irn_flags_none;
348 be_info_init_irn(res, irn_flags, in_reqs, n_res);
351 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
352 out_infos[0].req = &arch_exec_requirement;
360 static arch_register_req_t
const *in_reqs[] = {
361 &TEMPLATE_class_reg_req_gp,
362 &TEMPLATE_class_reg_req_gp,
377 arch_irn_flags_t irn_flags = arch_irn_flags_none;
378 irn_flags |= arch_irn_flag_rematerializable;
380 be_info_init_irn(res, irn_flags, in_reqs, n_res);
383 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
384 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
392 static arch_register_req_t
const *in_reqs[] = {
393 &TEMPLATE_class_reg_req_gp,
394 &TEMPLATE_class_reg_req_gp,
409 arch_irn_flags_t irn_flags = arch_irn_flags_none;
410 irn_flags |= arch_irn_flag_rematerializable;
412 be_info_init_irn(res, irn_flags, in_reqs, n_res);
415 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
416 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
424 static arch_register_req_t
const *in_reqs[] = {
425 &arch_memory_requirement,
426 &TEMPLATE_class_reg_req_gp,
427 &TEMPLATE_class_reg_req_gp,
443 arch_irn_flags_t irn_flags = arch_irn_flags_none;
444 irn_flags |= arch_irn_flag_rematerializable;
446 be_info_init_irn(res, irn_flags, in_reqs, n_res);
449 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
450 out_infos[0].req = &arch_memory_requirement;
458 static arch_register_req_t
const *in_reqs[] = {
459 &TEMPLATE_class_reg_req_gp,
460 &TEMPLATE_class_reg_req_gp,
475 arch_irn_flags_t irn_flags = arch_irn_flags_none;
476 irn_flags |= arch_irn_flag_rematerializable;
478 be_info_init_irn(res, irn_flags, in_reqs, n_res);
481 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
482 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
490 static arch_register_req_t
const *in_reqs[] = {
491 &TEMPLATE_class_reg_req_gp,
492 &TEMPLATE_class_reg_req_gp,
507 arch_irn_flags_t irn_flags = arch_irn_flags_none;
508 irn_flags |= arch_irn_flag_rematerializable;
510 be_info_init_irn(res, irn_flags, in_reqs, n_res);
513 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
514 out_infos[0].req = &TEMPLATE_class_reg_req_gp;
522 static arch_register_req_t
const *in_reqs[] = {
523 &TEMPLATE_class_reg_req_fp,
524 &TEMPLATE_class_reg_req_fp,
539 arch_irn_flags_t irn_flags = arch_irn_flags_none;
540 irn_flags |= arch_irn_flag_rematerializable;
542 be_info_init_irn(res, irn_flags, in_reqs, n_res);
545 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
546 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
554 arch_register_req_t
const **
const in_reqs = NULL;
563 arch_irn_flags_t irn_flags = arch_irn_flags_none;
564 irn_flags |= arch_irn_flag_rematerializable;
566 be_info_init_irn(res, irn_flags, in_reqs, n_res);
569 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
570 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
578 static arch_register_req_t
const *in_reqs[] = {
579 &TEMPLATE_class_reg_req_fp,
580 &TEMPLATE_class_reg_req_fp,
595 arch_irn_flags_t irn_flags = arch_irn_flags_none;
597 be_info_init_irn(res, irn_flags, in_reqs, n_res);
600 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
601 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
609 static arch_register_req_t
const *in_reqs[] = {
610 &arch_memory_requirement,
611 &TEMPLATE_class_reg_req_gp,
626 arch_irn_flags_t irn_flags = arch_irn_flags_none;
627 irn_flags |= arch_irn_flag_rematerializable;
629 be_info_init_irn(res, irn_flags, in_reqs, n_res);
632 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
633 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
634 out_infos[1].req = &arch_memory_requirement;
642 static arch_register_req_t
const *in_reqs[] = {
643 &TEMPLATE_class_reg_req_fp,
657 arch_irn_flags_t irn_flags = arch_irn_flags_none;
658 irn_flags |= arch_irn_flag_rematerializable;
660 be_info_init_irn(res, irn_flags, in_reqs, n_res);
663 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
664 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
672 static arch_register_req_t
const *in_reqs[] = {
673 &TEMPLATE_class_reg_req_fp,
674 &TEMPLATE_class_reg_req_fp,
689 arch_irn_flags_t irn_flags = arch_irn_flags_none;
691 be_info_init_irn(res, irn_flags, in_reqs, n_res);
694 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
695 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
703 static arch_register_req_t
const *in_reqs[] = {
704 &arch_memory_requirement,
705 &TEMPLATE_class_reg_req_gp,
706 &TEMPLATE_class_reg_req_fp,
722 arch_irn_flags_t irn_flags = arch_irn_flags_none;
723 irn_flags |= arch_irn_flag_rematerializable;
725 be_info_init_irn(res, irn_flags, in_reqs, n_res);
728 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
729 out_infos[0].req = &arch_memory_requirement;
737 static arch_register_req_t
const *in_reqs[] = {
738 &TEMPLATE_class_reg_req_fp,
739 &TEMPLATE_class_reg_req_fp,
754 arch_irn_flags_t irn_flags = arch_irn_flags_none;
755 irn_flags |= arch_irn_flag_rematerializable;
757 be_info_init_irn(res, irn_flags, in_reqs, n_res);
760 reg_out_info_t *
const out_infos = be_get_info(res)->out_infos;
761 out_infos[0].req = &TEMPLATE_class_reg_req_fp;
772 void TEMPLATE_create_opcodes(
void)
777 TEMPLATE_opcode_start = cur_opcode;
782 set_op_tag(op, TEMPLATE_op_tag);
783 op_TEMPLATE_Add = op;
788 set_op_tag(op, TEMPLATE_op_tag);
789 op_TEMPLATE_And = op;
794 set_op_tag(op, TEMPLATE_op_tag);
795 op_TEMPLATE_Const = op;
800 set_op_tag(op, TEMPLATE_op_tag);
801 op_TEMPLATE_Jmp = op;
806 set_op_tag(op, TEMPLATE_op_tag);
807 op_TEMPLATE_Load = op;
812 set_op_tag(op, TEMPLATE_op_tag);
813 op_TEMPLATE_Minus = op;
818 set_op_tag(op, TEMPLATE_op_tag);
819 op_TEMPLATE_Mul = op;
824 set_op_tag(op, TEMPLATE_op_tag);
825 op_TEMPLATE_Not = op;
830 set_op_tag(op, TEMPLATE_op_tag);
836 set_op_tag(op, TEMPLATE_op_tag);
837 op_TEMPLATE_Return = op;
842 set_op_tag(op, TEMPLATE_op_tag);
843 op_TEMPLATE_Shl = op;
848 set_op_tag(op, TEMPLATE_op_tag);
849 op_TEMPLATE_Shr = op;
854 set_op_tag(op, TEMPLATE_op_tag);
855 op_TEMPLATE_Store = op;
860 set_op_tag(op, TEMPLATE_op_tag);
861 op_TEMPLATE_Sub = op;
866 set_op_tag(op, TEMPLATE_op_tag);
867 op_TEMPLATE_Xor = op;
872 set_op_tag(op, TEMPLATE_op_tag);
873 op_TEMPLATE_fAdd = op;
878 set_op_tag(op, TEMPLATE_op_tag);
879 op_TEMPLATE_fConst = op;
884 set_op_tag(op, TEMPLATE_op_tag);
885 op_TEMPLATE_fDiv = op;
890 set_op_tag(op, TEMPLATE_op_tag);
891 op_TEMPLATE_fLoad = op;
896 set_op_tag(op, TEMPLATE_op_tag);
897 op_TEMPLATE_fMinus = op;
902 set_op_tag(op, TEMPLATE_op_tag);
903 op_TEMPLATE_fMul = op;
908 set_op_tag(op, TEMPLATE_op_tag);
909 op_TEMPLATE_fStore = op;
914 set_op_tag(op, TEMPLATE_op_tag);
915 op_TEMPLATE_fSub = op;
919 void TEMPLATE_free_opcodes(
void)
921 free_ir_op(op_TEMPLATE_Add); op_TEMPLATE_Add = NULL;
922 free_ir_op(op_TEMPLATE_And); op_TEMPLATE_And = NULL;
923 free_ir_op(op_TEMPLATE_Const); op_TEMPLATE_Const = NULL;
924 free_ir_op(op_TEMPLATE_Jmp); op_TEMPLATE_Jmp = NULL;
925 free_ir_op(op_TEMPLATE_Load); op_TEMPLATE_Load = NULL;
926 free_ir_op(op_TEMPLATE_Minus); op_TEMPLATE_Minus = NULL;
927 free_ir_op(op_TEMPLATE_Mul); op_TEMPLATE_Mul = NULL;
928 free_ir_op(op_TEMPLATE_Not); op_TEMPLATE_Not = NULL;
929 free_ir_op(op_TEMPLATE_Or); op_TEMPLATE_Or = NULL;
930 free_ir_op(op_TEMPLATE_Return); op_TEMPLATE_Return = NULL;
931 free_ir_op(op_TEMPLATE_Shl); op_TEMPLATE_Shl = NULL;
932 free_ir_op(op_TEMPLATE_Shr); op_TEMPLATE_Shr = NULL;
933 free_ir_op(op_TEMPLATE_Store); op_TEMPLATE_Store = NULL;
934 free_ir_op(op_TEMPLATE_Sub); op_TEMPLATE_Sub = NULL;
935 free_ir_op(op_TEMPLATE_Xor); op_TEMPLATE_Xor = NULL;
936 free_ir_op(op_TEMPLATE_fAdd); op_TEMPLATE_fAdd = NULL;
937 free_ir_op(op_TEMPLATE_fConst); op_TEMPLATE_fConst = NULL;
938 free_ir_op(op_TEMPLATE_fDiv); op_TEMPLATE_fDiv = NULL;
939 free_ir_op(op_TEMPLATE_fLoad); op_TEMPLATE_fLoad = NULL;
940 free_ir_op(op_TEMPLATE_fMinus); op_TEMPLATE_fMinus = NULL;
941 free_ir_op(op_TEMPLATE_fMul); op_TEMPLATE_fMul = NULL;
942 free_ir_op(op_TEMPLATE_fStore); op_TEMPLATE_fStore = NULL;
943 free_ir_op(op_TEMPLATE_fSub); op_TEMPLATE_fSub = NULL;
void set_op_dump(ir_op *op, dump_node_func func)
Sets dump callback func for operation op.
void * get_irn_generic_attr(ir_node *node)
Returns a pointer to the node attributes.
ir_mode * mode_X
execution
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_attrs_equal(ir_op *op, node_attrs_equal_func func)
Sets attrs_equal callback func for operation op.
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.
Nodes of this opcode can be placed in any basic block.
struct ir_graph ir_graph
Procedure Graph.
struct dbg_info dbg_info
Source Reference.
struct ir_node ir_node
Procedure Graph Node.
ir_mode * mode_F
ieee754 binary32 float (single precision)
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.
unsigned get_irn_opcode(const ir_node *node)
Returns the opcode-enum of the node.
struct ir_entity ir_entity
Entity.
ir_graph * get_irn_irg(const ir_node *node)
Returns the ir_graph this node belongs to.
Node must remain in this basic block if it can throw an exception, else can float.
ir_op * get_irn_op(const ir_node *node)
Returns the opcode struct of the node.
void ir_op_set_memory_index(ir_op *op, int memory_index)
Sets memory input of operation using memory.
struct ir_op ir_op
Node Opcode.
ir_node * optimize_node(ir_node *n)
Applies local optimizations to a single node.
void free_ir_op(ir_op *code)
Frees an ir operation.
Nodes must remain in this basic block.
ir_mode * mode_T
tuple (none)
This operation has no arguments and is some kind of a constant.
struct ir_tarval ir_tarval
Target Machine Value.
void verify_new_node(ir_node *node)
If firm is built in debug mode, verify that a newly created node is fine.
void set_op_copy_attr(ir_op *op, copy_attr_func func)
Sets attribute copy callback func for operation op.
This operation has a memory input and may change the memory state.
Any other arity, either fixed for the opcode or known when creating the node.