projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
replaced malloc.h by stdlib.h and values.h by limits.g for better portability
[libfirm]
/
testprograms
/
if_example.c
diff --git
a/testprograms/if_example.c
b/testprograms/if_example.c
index
794db2c
..
dc4d48d
100644
(file)
--- a/
testprograms/if_example.c
+++ b/
testprograms/if_example.c
@@
-1,9
+1,9
@@
/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-*
*
All rights reserved.
-*
*
-*
*
Authors: Christian Schaefer, Goetz Lindenmaier
-*
*
-*
*
testprogram.
+* All rights reserved.
+*
+* Authors: Christian Schaefer, Goetz Lindenmaier
+*
+* testprogram.
*/
# include <stdio.h>
*/
# include <stdio.h>
@@
-14,15
+14,15
@@
# include "firm.h"
/**
# include "firm.h"
/**
-*
**
This file constructs the ir for the following pseudo-program:
-*
**
-*
**
int main(int a) {
-*
**
int b = 2;
-*
**
if ( a == b )
-*
**
{ a := a - 3; }
-*
**
-*
**
return a;
-*
**
}
+* This file constructs the ir for the following pseudo-program:
+*
+* int main(int a) {
+* int b = 2;
+* if ( a == b )
+* { a := a - 3; }
+*
+* return a;
+* }
**/
int
**/
int
@@
-38,10
+38,10
@@
main(void)
printf("\nCreating an IR graph: IF_EXAMPLE...\n");
printf("\nCreating an IR graph: IF_EXAMPLE...\n");
- init_firm ();
+ init_firm (
NULL
);
#define CLASSNAME "IF_EXAMPLE"
#define CLASSNAME "IF_EXAMPLE"
-#define METHODNAME "main"
+#define METHODNAME "
IF_EXAMPLE_
main"
#define NRARGS 1
#define NRES 1
#define NRARGS 1
#define NRES 1
@@
-58,7
+58,7
@@
main(void)
/* The type int. This type is necessary to model the result and parameters
the procedure. */
#define PRIM_NAME "int"
/* The type int. This type is necessary to model the result and parameters
the procedure. */
#define PRIM_NAME "int"
- typ = new_type_primitive(id_from_str(PRIM_NAME, strlen(PRIM_NAME)), mode_
i
);
+ typ = new_type_primitive(id_from_str(PRIM_NAME, strlen(PRIM_NAME)), mode_
Is
);
/* The parameter and result types of the procedure. */
set_method_param_type(proc_main, 0, typ);
set_method_res_type(proc_main, 0, typ);
/* The parameter and result types of the procedure. */
set_method_param_type(proc_main, 0, typ);
set_method_res_type(proc_main, 0, typ);
@@
-75,16
+75,16
@@
main(void)
/* Get the procedure parameter and assign it to the parameter variable
a. */
/* Get the procedure parameter and assign it to the parameter variable
a. */
- set_value (a_pos, new_Proj (get_irg_args(irg), mode_
i
, 0));
+ set_value (a_pos, new_Proj (get_irg_args(irg), mode_
Is
, 0));
/* Generate the constant and assign it to b. The assignment is resovled to a
dataflow edge. */
/* Generate the constant and assign it to b. The assignment is resovled to a
dataflow edge. */
- set_value (b_pos, new_Const (mode_
i, tarval_from_long (mode_i, 2
)));
+ set_value (b_pos, new_Const (mode_
Is, new_tarval_from_long (2, mode_Is
)));
/* We know all predecessors of the block and all set_values and set_stores are
preformed. We can mature the block. */
mature_block (get_irg_current_block(irg));
/* Generate a conditional branch */
/* We know all predecessors of the block and all set_values and set_stores are
preformed. We can mature the block. */
mature_block (get_irg_current_block(irg));
/* Generate a conditional branch */
- cmp = new_Cmp(get_value(a_pos, mode_
i), get_value(b_pos, mode_i
));
+ cmp = new_Cmp(get_value(a_pos, mode_
Is), get_value(b_pos, mode_Is
));
x = new_Cond (new_Proj(cmp, mode_b, Eq));
f = new_Proj (x, mode_X, 0);
t = new_Proj (x, mode_X, 1);
x = new_Cond (new_Proj(cmp, mode_b, Eq));
f = new_Proj (x, mode_X, 0);
t = new_Proj (x, mode_X, 1);
@@
-92,9
+92,9
@@
main(void)
/* generate and fill the then block */
r = new_immBlock ();
add_in_edge (r, t);
/* generate and fill the then block */
r = new_immBlock ();
add_in_edge (r, t);
- a = new_Sub(get_value(a_pos, mode_
i
),
- new_Const (mode_
i, tarval_from_long (mode_i, 3
)),
- mode_
i
);
+ a = new_Sub(get_value(a_pos, mode_
Is
),
+ new_Const (mode_
Is, new_tarval_from_long (3, mode_Is
)),
+ mode_
Is
);
set_value (a_pos, a);
mature_block (r);
set_value (a_pos, a);
mature_block (r);
@@
-108,7
+108,7
@@
main(void)
/* The Return statement */
{
ir_node *in[1], *store ;
/* The Return statement */
{
ir_node *in[1], *store ;
- in[0] = get_value (a_pos, mode_
i
);
+ in[0] = get_value (a_pos, mode_
Is
);
store = get_store();
x = new_Return (store, 1, in);
store = get_store();
x = new_Return (store, 1, in);