1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Christian Schaefer, Goetz Lindenmaier
13 *** This file constructs the ir for the following pseudo-program:
31 ir_node *a, *b, *c, *d, *x;
33 printf("creating an IR graph: CONST_EVAL_EXAMPLE...\n");
37 /* Try both optimizations: */
38 set_opt_constant_folding(1);
41 owner = new_type_class (id_from_str ("CONST_EVAL_EXAMPLE", 18));
42 ent = new_entity ((type *)owner, id_from_str ("main", 4), NULL);
44 irg = new_ir_graph (ent, 4);
46 a = new_Const (mode_i, tarval_from_long (mode_i, 5));
47 b = new_Const (mode_i, tarval_from_long (mode_i, 7));
50 mature_block (irg->current_block);
52 c = new_Add (new_Const (mode_i, tarval_from_long (mode_i, 5)),
53 new_Const (mode_i, tarval_from_long (mode_i, 7)),
55 d = new_Add (new_Const (mode_i, tarval_from_long (mode_i, 7)),
56 new_Const (mode_i, tarval_from_long (mode_i, 5)),
64 x = new_Return (get_store (), 2, in);
67 add_in_edge (irg->end_block, x);
68 mature_block (irg->end_block);
70 printf("\nDone building the graph. Dumping it.\n");
71 dump_ir_block_graph (irg);
73 printf("use xvcg to view this graph:\n");
74 printf("/ben/trapp/bin/i486/xvcg GRAPHNAME\n");