* Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
*/
-# include <stdio.h>
-# include <string.h>
+#include <stdio.h>
+#include <string.h>
+
+
+#include <libfirm/firm.h>
-# include "irvrfy.h"
-# include "firm.h"
-# include "irdump.h"
/** This file constructs the ir to test a problem with code placement.
#define PROGNAME "PLACE_WITH_DEAD"
-int main(int argc, char **argv)
+int main(void)
{
- type *prim_t_int;
+ ir_type *prim_t_int;
ir_graph *irg; /* this variable contains the irgraph */
- type *owner; /* the class in which this method is defined */
- type *method; /* the type of this method */
- entity *ent; /* represents this method as entity of owner */
+ ir_type *owner; /* the class in which this method is defined */
+ ir_type *method; /* the ir_type of this method */
+ ir_entity *ent; /* represents this method as ir_entity of owner */
ir_node *a, *b, *x;
symconst_symbol sym;
/* init library */
init_firm (NULL);
- /* Make basic type information for primitive type int. */
+ /* Make basic ir_type information for primitive ir_type int. */
prim_t_int = new_type_primitive(new_id_from_chars ("int", 3), mode_Ls);
- /* Make the method type and entity */
+ /* Make the method ir_type and ir_entity */
owner = get_glob_type();
method = new_type_method (new_id_from_str(PROGNAME"_main_tp"), 0, 1);
set_method_res_type(method, 0, prim_t_int);
/* Generate the two constants. A SymConst can not be constant evaluated. */
sym.type_p = new_type_class(new_id_from_str("SomeClass"));
a = new_Const (mode_Is, new_tarval_from_long (0, mode_Is));
- b = new_SymConst (sym, symconst_size);
+ b = new_SymConst (mode_Iu, sym, symconst_type_size);
/* Generate the Conv with Bad as block */
a = new_Conv(b, mode_Ls);
mature_immBlock (get_irg_current_block(irg));
add_immBlock_pred (get_irg_end_block(irg), x);
mature_immBlock (get_irg_end_block(irg));
- finalize_cons (irg);
+ irg_finalize_cons (irg);
irg_vrfy(irg);
printf("Done building the graph. Dumping it.\n");
dump_ir_graph (irg, 0);
printf("Code placement ...\n");
+ set_opt_global_cse(1); /* need this option for code placement */
place_code(irg);
dump_ir_block_graph (irg, "-placed");
dump_ir_graph (irg, "-placed");
irg_vrfy(irg);
- printf("use xvcg to view this graph:\n");
- printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n");
+ printf("Use ycomp to view this graph:\n");
+ printf("ycomp GRAPHNAME\n\n");
return (0);
}