-/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-** All rights reserved.
-**
-** Authors: Christian Schaefer, Goetz Lindenmaier
-**
-** testprogram.
-*/
+/*
+ * Project: libFIRM
+ * File name: testprograms/dead_block_example.c
+ * Purpose: Test unreachable code elimination.
+ * Author: Christian Schaefer, Goetz Lindenmaier
+ * Modified by:
+ * Created:
+ * CVS-ID: $Id$
+ * Copyright: (c) 1999-2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
# include <stdio.h>
# include <string.h>
*/
/**
-*** This file constructs a control flow of following shape:
-***
-***
-*** firstBlock
-*** / \
-*** / \
-*** |/_ _\|
-*** Block1 Block2 deadBlock
-*** \ | /
-*** \ | /
-*** _\| \ / |/_
-*** nextBlock
-***
-***
-*** This is a program as, e.g.,
-***
-*** if () then
-*** { Jmp label1; } // happens anyways
-*** else
-*** { Jmp label1; } // happens anyways
-*** label1:
-*** return();
-*** Jmp label1;
-***
+* This file constructs a control flow of following shape:
+*
+*
+* firstBlock
+* / \
+* / \
+* |/_ _\|
+* Block1 Block2 deadBlock
+* \ | /
+* \ | /
+* _\| \ / |/_
+* nextBlock
+*
+*
+* This is a program as, e.g.,
+*
+* if () then
+* { Jmp label1; } // happens anyways
+* else
+* { Jmp label1; } // happens anyways
+* label1:
+* return();
+* Jmp label1;
+*
**/
int main(int argc, char **argv)
*deadBlock, *x;
/* init library */
- init_firm ();
+ init_firm (NULL);
/*** Make basic type information for primitive type int. ***/
prim_t_int = new_type_primitive(id_from_str ("int", 3), mode_Is);
ent = new_entity (owner,
id_from_str (METHODNAME, strlen(METHODNAME)),
proc_main);
-
+ get_entity_ld_name(ent); /* To enforce name mangling for vcg graph name */
#define NUM_OF_LOCAL_VARS 1
irg = new_ir_graph (ent, NUM_OF_LOCAL_VARS);
/* to make a condition */
- c1 = new_Const (mode_Is, tarval_from_long (mode_Is, 1));
- c2 = new_Const (mode_Is, tarval_from_long (mode_Is, 2));
+ c1 = new_Const (mode_Is, new_tarval_from_long (1, mode_Is));
+ c2 = new_Const (mode_Is, new_tarval_from_long (2, mode_Is));
set_value(0, c2);
cond = new_Cond(new_Proj(new_Cmp(c1, c2), mode_b, Eq));