From 0bbfd7a3b32de91cad2507d3af954b88d0ff7d04 Mon Sep 17 00:00:00 2001 From: Beyhan Date: Thu, 7 Oct 2004 11:35:57 +0000 Subject: [PATCH] test for strength reduction [r4087] --- testprograms/Makefile.in | 51 +-- ...RENGTH_RED_EXAMPLE_m1-strength_reduced.vcg | 404 ++++++++++++++++++ ...RENGTH_RED_EXAMPLE_m2-strength_reduced.vcg | 237 ++++++++++ ...RENGTH_RED_EXAMPLE_m3-strength_reduced.vcg | 257 +++++++++++ ...RENGTH_RED_EXAMPLE_m4-strength_reduced.vcg | 257 +++++++++++ ...RENGTH_RED_EXAMPLE_m5-strength_reduced.vcg | 237 ++++++++++ testprograms/ref-results/run-result.txt | 48 +++ testprograms/strength_red_example.c | 383 +++++++++++++++++ 8 files changed, 1849 insertions(+), 25 deletions(-) create mode 100644 testprograms/ref-results/STRENGTH_RED_EXAMPLE_m1-strength_reduced.vcg create mode 100644 testprograms/ref-results/STRENGTH_RED_EXAMPLE_m2-strength_reduced.vcg create mode 100644 testprograms/ref-results/STRENGTH_RED_EXAMPLE_m3-strength_reduced.vcg create mode 100644 testprograms/ref-results/STRENGTH_RED_EXAMPLE_m4-strength_reduced.vcg create mode 100644 testprograms/ref-results/STRENGTH_RED_EXAMPLE_m5-strength_reduced.vcg create mode 100644 testprograms/strength_red_example.c diff --git a/testprograms/Makefile.in b/testprograms/Makefile.in index c774432c9..157cdd99b 100644 --- a/testprograms/Makefile.in +++ b/testprograms/Makefile.in @@ -19,31 +19,32 @@ subdir := testprograms DIFF ?= diff -c0 REF_DIR = $(srcdir)/ref-results -SOURCES := Makefile.in \ - array-heap_example.c \ - array-stack_example.c \ - call_str_example.c \ - cond_example.c \ - const_ent_example.c \ - const_eval_example.c \ - dead_block_example.c \ - empty.c \ - endless_loop.c \ - float_example.c \ - global_cse.c \ - global_var_example.c \ - identify_types.c \ - if_else_example.c \ - if_example.c \ - if_while_example.c \ - inheritance_example.c \ - irr_cf_example.c \ - irr_loop_example.c \ - memory_example.c \ - oo_inline_example.c \ - oo_program_example.c \ - recursions.c \ - three_cfpred_example.c \ +SOURCES := Makefile.in \ + array-heap_example.c \ + array-stack_example.c \ + call_str_example.c \ + cond_example.c \ + const_ent_example.c \ + const_eval_example.c \ + dead_block_example.c \ + empty.c \ + endless_loop.c \ + float_example.c \ + global_cse.c \ + global_var_example.c \ + identify_types.c \ + if_else_example.c \ + if_example.c \ + if_while_example.c \ + inheritance_example.c \ + irr_cf_example.c \ + irr_loop_example.c \ + memory_example.c \ + oo_inline_example.c \ + oo_program_example.c \ + recursions.c \ + strength_red_example.c \ + three_cfpred_example.c \ while_example.c GENFILES = %.vcg results.txt diff --git a/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m1-strength_reduced.vcg b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m1-strength_reduced.vcg new file mode 100644 index 000000000..603d12194 --- /dev/null +++ b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m1-strength_reduced.vcg @@ -0,0 +1,404 @@ +graph: { title: "ir graph of STRENGTH_RED_EXAMPLE_m1" +display_edge_labels: no +layoutalgorithm: mindepth +manhattan_edges: yes +port_sharing: no +orientation: bottom_to_top +classname 1: "intrablock Data" +classname 16: "interblock Data" +classname 2: "Block" +classname 13: "Control Flow" +classname 14: "intrablock Memory" +classname 17: "interblock Memory" +classname 15: "Dominators" +classname 3: "Entity type" +classname 4: "Entity owner" +classname 5: "Method Param" +classname 6: "Method Res" +classname 7: "Super" +classname 8: "Union" +classname 9: "Points-to" +classname 10: "Array Element Type" +classname 11: "Overwrites" +classname 12: "Member" +infoname 1: "Attribute" +infoname 2: "Verification errors" +colorentry 100: 0 0 0 +colorentry 101: 20 0 0 +colorentry 102: 40 0 0 +colorentry 103: 60 0 0 +colorentry 104: 80 0 0 +colorentry 105: 100 0 0 +colorentry 106: 120 0 0 +colorentry 107: 140 0 0 +colorentry 108: 150 0 0 +colorentry 109: 180 0 0 +colorentry 110: 200 0 0 +colorentry 111: 220 0 0 +colorentry 112: 240 0 0 +colorentry 113: 255 0 0 +colorentry 113: 255 20 20 +colorentry 114: 255 40 40 +colorentry 115: 255 60 60 +colorentry 116: 255 80 80 +colorentry 117: 255 100 100 +colorentry 118: 255 120 120 +colorentry 119: 255 140 140 +colorentry 120: 255 150 150 +colorentry 121: 255 180 180 +colorentry 122: 255 200 200 +colorentry 123: 255 220 220 +colorentry 124: 255 240 240 +colorentry 125: 255 250 250 + +graph: { title: "g33" label: "STRENGTH_RED_EXAMPLE_m1" status:clustered color:white +graph: { title: "n23" label: "Block 23" status:clustered color:yellow +edge: {sourcename: "n23" targetname: "n95" label: "0" class:13 priority:60 color:red} +node: {title: "n24" label: "End 24" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"color: blue} +} + +graph: { title: "n90" label: "Block 90" status:clustered color:yellow +edge: {sourcename: "n90" targetname: "n72" label: "0" class:13 priority:60 color:red} +node: {title: "n95" label: "Return 95" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +return in method of type STRENGTH_RED_EXAMPLE_meth_tp + res 0 type: int +"} +edge: {sourcename: "n95" targetname: "n88" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n95" targetname: "n89" label: "1" class:16 priority:10} +} + +graph: { title: "n66" label: "Block 66" status:clustered color:yellow +edge: {sourcename: "n66" targetname: "n43" label: "0" class:13 priority:60 color:red} +backedge: {sourcename: "n66" targetname: "n84" label: "1" linestyle:dashed class:13 priority:60 color:red} +node: {title: "n88" label: "PhiM 88" info1: "mode: M +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 backedges: +"color: green} +edge: {sourcename: "n88" targetname: "n64" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n88" targetname: "n82" label: "1" class:17 priority:10 color:blue} +node: {title: "n359" label: "PhiIs 359" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 backedges: +"color: green} +edge: {sourcename: "n359" targetname: "n357" label: "0" class:16 priority:10} +edge: {sourcename: "n359" targetname: "n360" label: "1" class:16 priority:10} +node: {title: "n72" label: "ProjX 0 72" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n72" targetname: "n71" label: "0" class:13 priority:60 color:red} +node: {title: "n73" label: "ProjX 1 73" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n73" targetname: "n71" label: "0" class:13 priority:60 color:red} +node: {title: "n71" label: "Cond 71" info1: "mode: T +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"} +edge: {sourcename: "n71" targetname: "n70" label: "0" class:1 priority:50} +node: {title: "n70" label: "Projb Lt 70" info1: "mode: b +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n70" targetname: "n69" label: "0" class:1 priority:50} +node: {title: "n69" label: "CmpT 69" info1: "mode: T +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n69n35" label: "0x0Is 35" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n69" targetname: "n69n35" label: "0" class:16 priority:10} +edge: {sourcename: "n69" targetname: "n89" label: "1" class:1 priority:50} +node: {title: "n89" label: "PhiIs 89" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 backedges: +"color: green} +edge: {sourcename: "n89" targetname: "n65" label: "0" class:16 priority:10} +edge: {sourcename: "n89" targetname: "n83" label: "1" class:16 priority:10} +} + +graph: { title: "n74" label: "Block 74" status:clustered color:yellow +edge: {sourcename: "n74" targetname: "n73" label: "0" class:13 priority:60 color:red} +node: {title: "n82" label: "ProjM 0 82" info1: "mode: M +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n82" targetname: "n80" label: "0" class:17 priority:10 color:blue} +node: {title: "n80" label: "Store 80" info1: "mode: T +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 3 +volatility: volatility_non_volatile +"} +node: {title: "n80n52" label: "0x13Is 52" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n80" targetname: "n88" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n80" targetname: "n77" label: "1" class:1 priority:50} +edge: {sourcename: "n80" targetname: "n80n52" label: "2" class:16 priority:10} +node: {title: "n77" label: "AddP 77" info1: "mode: P +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n77n48" label: "SymC &a 48" info1: "mode: P +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +kind addr_ent +entity GlobalType.a (21) + +"} +edge: {sourcename: "n77" targetname: "n77n48" label: "0" class:16 priority:10} +edge: {sourcename: "n77" targetname: "n359" label: "1" class:16 priority:10} +node: {title: "n360" label: "SubIs 360" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n360n47" label: "0x4Is 47" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n360" targetname: "n359" label: "0" class:16 priority:10} +edge: {sourcename: "n360" targetname: "n360n47" label: "1" class:16 priority:10} +node: {title: "n84" label: "Jmp 84" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +"} +node: {title: "n83" label: "SubIs 83" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n83n46" label: "0x1Is 46" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n83" targetname: "n89" label: "0" class:16 priority:10} +edge: {sourcename: "n83" targetname: "n83n46" label: "1" class:16 priority:10} +} + +graph: { title: "n37" label: "Block 37" status:clustered color:yellow +edge: {sourcename: "n37" targetname: "n36" label: "0" class:13 priority:60 color:red} +backedge: {sourcename: "n37" targetname: "n58" label: "1" linestyle:dashed class:13 priority:60 color:red} +node: {title: "n64" label: "PhiM 64" info1: "mode: M +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 backedges: +"color: green} +edge: {sourcename: "n64" targetname: "n31" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n64" targetname: "n56" label: "1" class:17 priority:10 color:blue} +node: {title: "n353" label: "PhiIs 353" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 backedges: +"color: green} +node: {title: "n353n35" label: "0x0Is 35" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n353" targetname: "n353n35" label: "0" class:16 priority:10} +edge: {sourcename: "n353" targetname: "n354" label: "1" class:16 priority:10} +node: {title: "n357" label: "MulIs 357" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n357n47" label: "0x4Is 47" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n357" targetname: "n357n47" label: "0" class:16 priority:10} +edge: {sourcename: "n357" targetname: "n65" label: "1" class:1 priority:50} +node: {title: "n43" label: "ProjX 0 43" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n43" targetname: "n42" label: "0" class:13 priority:60 color:red} +node: {title: "n65" label: "PhiIs 65" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 backedges: +"color: green} +node: {title: "n65n35" label: "0x0Is 35" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n65" targetname: "n65n35" label: "0" class:16 priority:10} +edge: {sourcename: "n65" targetname: "n57" label: "1" class:16 priority:10} +node: {title: "n44" label: "ProjX 1 44" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n44" targetname: "n42" label: "0" class:13 priority:60 color:red} +node: {title: "n42" label: "Cond 42" info1: "mode: T +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"} +edge: {sourcename: "n42" targetname: "n41" label: "0" class:1 priority:50} +node: {title: "n41" label: "Projb Gt 41" info1: "mode: b +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n41" targetname: "n40" label: "0" class:1 priority:50} +node: {title: "n40" label: "CmpT 40" info1: "mode: T +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n40n39" label: "0xAIs 39" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n40" targetname: "n40n39" label: "0" class:16 priority:10} +edge: {sourcename: "n40" targetname: "n65" label: "1" class:1 priority:50} +} + +graph: { title: "n34" label: "Block 34" status:clustered color:yellow +edge: {sourcename: "n34" targetname: "n28" label: "0" class:13 priority:60 color:red} +node: {title: "n36" label: "Jmp 36" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +"} +} + +graph: { title: "n45" label: "Block 45" status:clustered color:yellow +edge: {sourcename: "n45" targetname: "n44" label: "0" class:13 priority:60 color:red} +node: {title: "n56" label: "ProjM 0 56" info1: "mode: M +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n56" targetname: "n54" label: "0" class:17 priority:10 color:blue} +node: {title: "n54" label: "Store 54" info1: "mode: T +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 3 +volatility: volatility_non_volatile +"} +node: {title: "n54n52" label: "0x13Is 52" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n54" targetname: "n64" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n54" targetname: "n51" label: "1" class:1 priority:50} +edge: {sourcename: "n54" targetname: "n54n52" label: "2" class:16 priority:10} +node: {title: "n51" label: "AddP 51" info1: "mode: P +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n51n48" label: "SymC &a 48" info1: "mode: P +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +kind addr_ent +entity GlobalType.a (21) + +"} +edge: {sourcename: "n51" targetname: "n51n48" label: "0" class:16 priority:10} +edge: {sourcename: "n51" targetname: "n353" label: "1" class:16 priority:10} +node: {title: "n354" label: "AddIs 354" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n354n47" label: "0x4Is 47" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n354" targetname: "n354n47" label: "0" class:16 priority:10} +edge: {sourcename: "n354" targetname: "n353" label: "1" class:16 priority:10} +node: {title: "n57" label: "AddIs 57" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 2 +"} +node: {title: "n57n46" label: "0x1Is 46" info1: "mode: Is +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n57" targetname: "n57n46" label: "0" class:16 priority:10} +edge: {sourcename: "n57" targetname: "n65" label: "1" class:16 priority:10} +node: {title: "n58" label: "Jmp 58" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +"} +} + +graph: { title: "n25" label: "Block 25" status:clustered color:yellow +edge: {sourcename: "n25" targetname: "n28" label: "0" class:13 priority:60 color:red} +node: {title: "n31" label: "ProjM 1 31" info1: "mode: M +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n31" targetname: "n26" label: "0" class:17 priority:10 color:blue} +node: {title: "n28" label: "ProjX 0 28" info1: "mode: X +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 1 +"color: yellow} +edge: {sourcename: "n28" targetname: "n26" label: "0" class:13 priority:60 color:red} +node: {title: "n26" label: "Start 26" info1: "mode: T +visited: 30 +irg: STRENGTH_RED_EXAMPLE_m1 +arity: 0 +start of method of type STRENGTH_RED_EXAMPLE_meth_tp + param 0 type: int +"color: blue} +} + +} + +} diff --git a/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m2-strength_reduced.vcg b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m2-strength_reduced.vcg new file mode 100644 index 000000000..dec085679 --- /dev/null +++ b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m2-strength_reduced.vcg @@ -0,0 +1,237 @@ +graph: { title: "ir graph of STRENGTH_RED_EXAMPLE_m2" +display_edge_labels: no +layoutalgorithm: mindepth +manhattan_edges: yes +port_sharing: no +orientation: bottom_to_top +classname 1: "intrablock Data" +classname 16: "interblock Data" +classname 2: "Block" +classname 13: "Control Flow" +classname 14: "intrablock Memory" +classname 17: "interblock Memory" +classname 15: "Dominators" +classname 3: "Entity type" +classname 4: "Entity owner" +classname 5: "Method Param" +classname 6: "Method Res" +classname 7: "Super" +classname 8: "Union" +classname 9: "Points-to" +classname 10: "Array Element Type" +classname 11: "Overwrites" +classname 12: "Member" +infoname 1: "Attribute" +infoname 2: "Verification errors" +colorentry 100: 0 0 0 +colorentry 101: 20 0 0 +colorentry 102: 40 0 0 +colorentry 103: 60 0 0 +colorentry 104: 80 0 0 +colorentry 105: 100 0 0 +colorentry 106: 120 0 0 +colorentry 107: 140 0 0 +colorentry 108: 150 0 0 +colorentry 109: 180 0 0 +colorentry 110: 200 0 0 +colorentry 111: 220 0 0 +colorentry 112: 240 0 0 +colorentry 113: 255 0 0 +colorentry 113: 255 20 20 +colorentry 114: 255 40 40 +colorentry 115: 255 60 60 +colorentry 116: 255 80 80 +colorentry 117: 255 100 100 +colorentry 118: 255 120 120 +colorentry 119: 255 140 140 +colorentry 120: 255 150 150 +colorentry 121: 255 180 180 +colorentry 122: 255 200 200 +colorentry 123: 255 220 220 +colorentry 124: 255 240 240 +colorentry 125: 255 250 250 + +graph: { title: "g116" label: "STRENGTH_RED_EXAMPLE_m2" status:clustered color:white +graph: { title: "n106" label: "Block 106" status:clustered color:yellow +edge: {sourcename: "n106" targetname: "n151" label: "0" class:13 priority:60 color:red} +node: {title: "n107" label: "End 107" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 1 +"color: blue} +} + +graph: { title: "n148" label: "Block 148" status:clustered color:yellow +edge: {sourcename: "n148" targetname: "n127" label: "0" class:13 priority:60 color:red} +node: {title: "n151" label: "Return 151" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 2 +return in method of type STRENGTH_RED_EXAMPLE_meth_tp + res 0 type: int +"} +node: {title: "n151n131" label: "0x4Is 131" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n151" targetname: "n155" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n151" targetname: "n151n131" label: "1" class:16 priority:10} +} + +graph: { title: "n121" label: "Block 121" status:clustered color:yellow +edge: {sourcename: "n121" targetname: "n120" label: "0" class:13 priority:60 color:red} +backedge: {sourcename: "n121" targetname: "n142" label: "1" linestyle:dashed class:13 priority:60 color:red} +node: {title: "n155" label: "PhiM 155" info1: "mode: M +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 2 backedges: +"color: green} +edge: {sourcename: "n155" targetname: "n114" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n155" targetname: "n140" label: "1" class:17 priority:10 color:blue} +node: {title: "n127" label: "ProjX 0 127" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 1 +"color: yellow} +edge: {sourcename: "n127" targetname: "n126" label: "0" class:13 priority:60 color:red} +node: {title: "n128" label: "ProjX 1 128" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 1 +"color: yellow} +edge: {sourcename: "n128" targetname: "n126" label: "0" class:13 priority:60 color:red} +node: {title: "n126" label: "Cond 126" info1: "mode: T +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 1 +"} +edge: {sourcename: "n126" targetname: "n125" label: "0" class:1 priority:50} +node: {title: "n125" label: "Projb Gt 125" info1: "mode: b +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 1 +"color: yellow} +edge: {sourcename: "n125" targetname: "n376" label: "0" class:1 priority:50} +node: {title: "n376" label: "CmpT 376" info1: "mode: T +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 2 +"} +node: {title: "n376n375" label: "0x28Is 375" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n376" targetname: "n372" label: "0" class:1 priority:50} +edge: {sourcename: "n376" targetname: "n376n375" label: "1" class:16 priority:10} +node: {title: "n372" label: "PhiIs 372" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 2 backedges: +"color: green} +node: {title: "n372n118" label: "0x0Is 118" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n372" targetname: "n372n118" label: "0" class:16 priority:10} +edge: {sourcename: "n372" targetname: "n373" label: "1" class:16 priority:10} +} + +graph: { title: "n117" label: "Block 117" status:clustered color:yellow +edge: {sourcename: "n117" targetname: "n111" label: "0" class:13 priority:60 color:red} +node: {title: "n120" label: "Jmp 120" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +"} +} + +graph: { title: "n129" label: "Block 129" status:clustered color:yellow +edge: {sourcename: "n129" targetname: "n128" label: "0" class:13 priority:60 color:red} +node: {title: "n140" label: "ProjM 0 140" info1: "mode: M +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 1 +"color: yellow} +edge: {sourcename: "n140" targetname: "n138" label: "0" class:17 priority:10 color:blue} +node: {title: "n138" label: "Store 138" info1: "mode: T +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 3 +volatility: volatility_non_volatile +"} +node: {title: "n138n136" label: "0x13Is 136" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n138" targetname: "n155" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n138" targetname: "n135" label: "1" class:1 priority:50} +edge: {sourcename: "n138" targetname: "n138n136" label: "2" class:16 priority:10} +node: {title: "n135" label: "AddP 135" info1: "mode: P +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 2 +"} +node: {title: "n135n119" label: "SymC &a 119" info1: "mode: P +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +kind addr_ent +entity GlobalType.a (104) + +"} +edge: {sourcename: "n135" targetname: "n372" label: "0" class:16 priority:10} +edge: {sourcename: "n135" targetname: "n135n119" label: "1" class:16 priority:10} +node: {title: "n142" label: "Jmp 142" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +"} +node: {title: "n373" label: "AddIs 373" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 2 +"} +node: {title: "n373n131" label: "0x4Is 131" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n373" targetname: "n373n131" label: "0" class:16 priority:10} +edge: {sourcename: "n373" targetname: "n372" label: "1" class:16 priority:10} +} + +graph: { title: "n108" label: "Block 108" status:clustered color:yellow +edge: {sourcename: "n108" targetname: "n111" label: "0" class:13 priority:60 color:red} +node: {title: "n114" label: "ProjM 1 114" info1: "mode: M +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 1 +"color: yellow} +edge: {sourcename: "n114" targetname: "n109" label: "0" class:17 priority:10 color:blue} +node: {title: "n111" label: "ProjX 0 111" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 1 +"color: yellow} +edge: {sourcename: "n111" targetname: "n109" label: "0" class:13 priority:60 color:red} +node: {title: "n109" label: "Start 109" info1: "mode: T +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m2 +arity: 0 +start of method of type STRENGTH_RED_EXAMPLE_meth_tp + param 0 type: int +"color: blue} +} + +} + +} diff --git a/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m3-strength_reduced.vcg b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m3-strength_reduced.vcg new file mode 100644 index 000000000..1714d7006 --- /dev/null +++ b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m3-strength_reduced.vcg @@ -0,0 +1,257 @@ +graph: { title: "ir graph of STRENGTH_RED_EXAMPLE_m3" +display_edge_labels: no +layoutalgorithm: mindepth +manhattan_edges: yes +port_sharing: no +orientation: bottom_to_top +classname 1: "intrablock Data" +classname 16: "interblock Data" +classname 2: "Block" +classname 13: "Control Flow" +classname 14: "intrablock Memory" +classname 17: "interblock Memory" +classname 15: "Dominators" +classname 3: "Entity type" +classname 4: "Entity owner" +classname 5: "Method Param" +classname 6: "Method Res" +classname 7: "Super" +classname 8: "Union" +classname 9: "Points-to" +classname 10: "Array Element Type" +classname 11: "Overwrites" +classname 12: "Member" +infoname 1: "Attribute" +infoname 2: "Verification errors" +colorentry 100: 0 0 0 +colorentry 101: 20 0 0 +colorentry 102: 40 0 0 +colorentry 103: 60 0 0 +colorentry 104: 80 0 0 +colorentry 105: 100 0 0 +colorentry 106: 120 0 0 +colorentry 107: 140 0 0 +colorentry 108: 150 0 0 +colorentry 109: 180 0 0 +colorentry 110: 200 0 0 +colorentry 111: 220 0 0 +colorentry 112: 240 0 0 +colorentry 113: 255 0 0 +colorentry 113: 255 20 20 +colorentry 114: 255 40 40 +colorentry 115: 255 60 60 +colorentry 116: 255 80 80 +colorentry 117: 255 100 100 +colorentry 118: 255 120 120 +colorentry 119: 255 140 140 +colorentry 120: 255 150 150 +colorentry 121: 255 180 180 +colorentry 122: 255 200 200 +colorentry 123: 255 220 220 +colorentry 124: 255 240 240 +colorentry 125: 255 250 250 + +graph: { title: "g177" label: "STRENGTH_RED_EXAMPLE_m3" status:clustered color:white +graph: { title: "n167" label: "Block 167" status:clustered color:yellow +edge: {sourcename: "n167" targetname: "n211" label: "0" class:13 priority:60 color:red} +node: {title: "n168" label: "End 168" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 1 +"color: blue} +} + +graph: { title: "n208" label: "Block 208" status:clustered color:yellow +edge: {sourcename: "n208" targetname: "n188" label: "0" class:13 priority:60 color:red} +node: {title: "n211" label: "Return 211" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 2 +return in method of type STRENGTH_RED_EXAMPLE_meth_tp + res 0 type: int +"} +node: {title: "n211n192" label: "0x4Is 192" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n211" targetname: "n215" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n211" targetname: "n211n192" label: "1" class:16 priority:10} +} + +graph: { title: "n182" label: "Block 182" status:clustered color:yellow +edge: {sourcename: "n182" targetname: "n181" label: "0" class:13 priority:60 color:red} +backedge: {sourcename: "n182" targetname: "n202" label: "1" linestyle:dashed class:13 priority:60 color:red} +node: {title: "n215" label: "PhiM 215" info1: "mode: M +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 2 backedges: +"color: green} +edge: {sourcename: "n215" targetname: "n175" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n215" targetname: "n200" label: "1" class:17 priority:10 color:blue} +node: {title: "n388" label: "PhiIs 388" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 2 backedges: +"color: green} +node: {title: "n388n386" label: "0x28Is 386" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n388" targetname: "n388n386" label: "0" class:16 priority:10} +edge: {sourcename: "n388" targetname: "n389" label: "1" class:16 priority:10} +node: {title: "n188" label: "ProjX 0 188" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 1 +"color: yellow} +edge: {sourcename: "n188" targetname: "n187" label: "0" class:13 priority:60 color:red} +node: {title: "n189" label: "ProjX 1 189" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 1 +"color: yellow} +edge: {sourcename: "n189" targetname: "n187" label: "0" class:13 priority:60 color:red} +node: {title: "n187" label: "Cond 187" info1: "mode: T +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 1 +"} +edge: {sourcename: "n187" targetname: "n186" label: "0" class:1 priority:50} +node: {title: "n186" label: "Projb Lt 186" info1: "mode: b +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 1 +"color: yellow} +edge: {sourcename: "n186" targetname: "n185" label: "0" class:1 priority:50} +node: {title: "n185" label: "CmpT 185" info1: "mode: T +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 2 +"} +node: {title: "n185n184" label: "0x0Is 184" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n185" targetname: "n185n184" label: "0" class:16 priority:10} +edge: {sourcename: "n185" targetname: "n216" label: "1" class:1 priority:50} +node: {title: "n216" label: "PhiIs 216" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 2 backedges: +"color: green} +node: {title: "n216n179" label: "0xAIs 179" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n216" targetname: "n216n179" label: "0" class:16 priority:10} +edge: {sourcename: "n216" targetname: "n201" label: "1" class:16 priority:10} +} + +graph: { title: "n178" label: "Block 178" status:clustered color:yellow +edge: {sourcename: "n178" targetname: "n172" label: "0" class:13 priority:60 color:red} +node: {title: "n181" label: "Jmp 181" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +"} +} + +graph: { title: "n190" label: "Block 190" status:clustered color:yellow +edge: {sourcename: "n190" targetname: "n189" label: "0" class:13 priority:60 color:red} +node: {title: "n200" label: "ProjM 0 200" info1: "mode: M +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 1 +"color: yellow} +edge: {sourcename: "n200" targetname: "n198" label: "0" class:17 priority:10 color:blue} +node: {title: "n198" label: "Store 198" info1: "mode: T +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 3 +volatility: volatility_non_volatile +"} +edge: {sourcename: "n198" targetname: "n215" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n198" targetname: "n196" label: "1" class:1 priority:50} +edge: {sourcename: "n198" targetname: "n216" label: "2" class:16 priority:10} +node: {title: "n196" label: "AddP 196" info1: "mode: P +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 2 +"} +node: {title: "n196n180" label: "SymC &a 180" info1: "mode: P +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +kind addr_ent +entity GlobalType.a (165) + +"} +edge: {sourcename: "n196" targetname: "n388" label: "0" class:16 priority:10} +edge: {sourcename: "n196" targetname: "n196n180" label: "1" class:16 priority:10} +node: {title: "n389" label: "SubIs 389" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 2 +"} +node: {title: "n389n192" label: "0x4Is 192" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n389" targetname: "n388" label: "0" class:16 priority:10} +edge: {sourcename: "n389" targetname: "n389n192" label: "1" class:16 priority:10} +node: {title: "n202" label: "Jmp 202" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +"} +node: {title: "n201" label: "SubIs 201" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 2 +"} +node: {title: "n201n191" label: "0x1Is 191" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n201" targetname: "n216" label: "0" class:16 priority:10} +edge: {sourcename: "n201" targetname: "n201n191" label: "1" class:16 priority:10} +} + +graph: { title: "n169" label: "Block 169" status:clustered color:yellow +edge: {sourcename: "n169" targetname: "n172" label: "0" class:13 priority:60 color:red} +node: {title: "n175" label: "ProjM 1 175" info1: "mode: M +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 1 +"color: yellow} +edge: {sourcename: "n175" targetname: "n170" label: "0" class:17 priority:10 color:blue} +node: {title: "n172" label: "ProjX 0 172" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 1 +"color: yellow} +edge: {sourcename: "n172" targetname: "n170" label: "0" class:13 priority:60 color:red} +node: {title: "n170" label: "Start 170" info1: "mode: T +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m3 +arity: 0 +start of method of type STRENGTH_RED_EXAMPLE_meth_tp + param 0 type: int +"color: blue} +} + +} + +} diff --git a/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m4-strength_reduced.vcg b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m4-strength_reduced.vcg new file mode 100644 index 000000000..c1ecf677b --- /dev/null +++ b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m4-strength_reduced.vcg @@ -0,0 +1,257 @@ +graph: { title: "ir graph of STRENGTH_RED_EXAMPLE_m4" +display_edge_labels: no +layoutalgorithm: mindepth +manhattan_edges: yes +port_sharing: no +orientation: bottom_to_top +classname 1: "intrablock Data" +classname 16: "interblock Data" +classname 2: "Block" +classname 13: "Control Flow" +classname 14: "intrablock Memory" +classname 17: "interblock Memory" +classname 15: "Dominators" +classname 3: "Entity type" +classname 4: "Entity owner" +classname 5: "Method Param" +classname 6: "Method Res" +classname 7: "Super" +classname 8: "Union" +classname 9: "Points-to" +classname 10: "Array Element Type" +classname 11: "Overwrites" +classname 12: "Member" +infoname 1: "Attribute" +infoname 2: "Verification errors" +colorentry 100: 0 0 0 +colorentry 101: 20 0 0 +colorentry 102: 40 0 0 +colorentry 103: 60 0 0 +colorentry 104: 80 0 0 +colorentry 105: 100 0 0 +colorentry 106: 120 0 0 +colorentry 107: 140 0 0 +colorentry 108: 150 0 0 +colorentry 109: 180 0 0 +colorentry 110: 200 0 0 +colorentry 111: 220 0 0 +colorentry 112: 240 0 0 +colorentry 113: 255 0 0 +colorentry 113: 255 20 20 +colorentry 114: 255 40 40 +colorentry 115: 255 60 60 +colorentry 116: 255 80 80 +colorentry 117: 255 100 100 +colorentry 118: 255 120 120 +colorentry 119: 255 140 140 +colorentry 120: 255 150 150 +colorentry 121: 255 180 180 +colorentry 122: 255 200 200 +colorentry 123: 255 220 220 +colorentry 124: 255 240 240 +colorentry 125: 255 250 250 + +graph: { title: "g237" label: "STRENGTH_RED_EXAMPLE_m4" status:clustered color:white +graph: { title: "n227" label: "Block 227" status:clustered color:yellow +edge: {sourcename: "n227" targetname: "n271" label: "0" class:13 priority:60 color:red} +node: {title: "n228" label: "End 228" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 1 +"color: blue} +} + +graph: { title: "n268" label: "Block 268" status:clustered color:yellow +edge: {sourcename: "n268" targetname: "n248" label: "0" class:13 priority:60 color:red} +node: {title: "n271" label: "Return 271" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 2 +return in method of type STRENGTH_RED_EXAMPLE_meth_tp + res 0 type: int +"} +node: {title: "n271n252" label: "0x4Is 252" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n271" targetname: "n275" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n271" targetname: "n271n252" label: "1" class:16 priority:10} +} + +graph: { title: "n242" label: "Block 242" status:clustered color:yellow +edge: {sourcename: "n242" targetname: "n241" label: "0" class:13 priority:60 color:red} +backedge: {sourcename: "n242" targetname: "n262" label: "1" linestyle:dashed class:13 priority:60 color:red} +node: {title: "n275" label: "PhiM 275" info1: "mode: M +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 2 backedges: +"color: green} +edge: {sourcename: "n275" targetname: "n235" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n275" targetname: "n261" label: "1" class:17 priority:10 color:blue} +node: {title: "n401" label: "PhiIs 401" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 2 backedges: +"color: green} +node: {title: "n401n239" label: "0x0Is 239" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n401" targetname: "n401n239" label: "0" class:16 priority:10} +edge: {sourcename: "n401" targetname: "n402" label: "1" class:16 priority:10} +node: {title: "n248" label: "ProjX 0 248" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 1 +"color: yellow} +edge: {sourcename: "n248" targetname: "n247" label: "0" class:13 priority:60 color:red} +node: {title: "n249" label: "ProjX 1 249" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 1 +"color: yellow} +edge: {sourcename: "n249" targetname: "n247" label: "0" class:13 priority:60 color:red} +node: {title: "n247" label: "Cond 247" info1: "mode: T +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 1 +"} +edge: {sourcename: "n247" targetname: "n246" label: "0" class:1 priority:50} +node: {title: "n246" label: "Projb Gt 246" info1: "mode: b +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 1 +"color: yellow} +edge: {sourcename: "n246" targetname: "n245" label: "0" class:1 priority:50} +node: {title: "n245" label: "CmpT 245" info1: "mode: T +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 2 +"} +node: {title: "n245n244" label: "0xAIs 244" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n245" targetname: "n245n244" label: "0" class:16 priority:10} +edge: {sourcename: "n245" targetname: "n276" label: "1" class:1 priority:50} +node: {title: "n276" label: "PhiIs 276" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 2 backedges: +"color: green} +node: {title: "n276n239" label: "0x0Is 239" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n276" targetname: "n276n239" label: "0" class:16 priority:10} +edge: {sourcename: "n276" targetname: "n254" label: "1" class:16 priority:10} +} + +graph: { title: "n238" label: "Block 238" status:clustered color:yellow +edge: {sourcename: "n238" targetname: "n232" label: "0" class:13 priority:60 color:red} +node: {title: "n241" label: "Jmp 241" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +"} +} + +graph: { title: "n250" label: "Block 250" status:clustered color:yellow +edge: {sourcename: "n250" targetname: "n249" label: "0" class:13 priority:60 color:red} +node: {title: "n261" label: "ProjM 0 261" info1: "mode: M +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 1 +"color: yellow} +edge: {sourcename: "n261" targetname: "n259" label: "0" class:17 priority:10 color:blue} +node: {title: "n259" label: "Store 259" info1: "mode: T +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 3 +volatility: volatility_non_volatile +"} +edge: {sourcename: "n259" targetname: "n275" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n259" targetname: "n403" label: "1" class:1 priority:50} +edge: {sourcename: "n259" targetname: "n254" label: "2" class:1 priority:50} +node: {title: "n403" label: "AddP 403" info1: "mode: P +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 2 +"} +node: {title: "n403n240" label: "SymC &a 240" info1: "mode: P +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +kind addr_ent +entity GlobalType.a (225) + +"} +edge: {sourcename: "n403" targetname: "n403n240" label: "0" class:16 priority:10} +edge: {sourcename: "n403" targetname: "n402" label: "1" class:1 priority:50} +node: {title: "n402" label: "AddIs 402" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 2 +"} +node: {title: "n402n252" label: "0x4Is 252" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n402" targetname: "n402n252" label: "0" class:16 priority:10} +edge: {sourcename: "n402" targetname: "n401" label: "1" class:16 priority:10} +node: {title: "n262" label: "Jmp 262" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +"} +node: {title: "n254" label: "AddIs 254" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 2 +"} +node: {title: "n254n251" label: "0x1Is 251" info1: "mode: Is +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n254" targetname: "n254n251" label: "0" class:16 priority:10} +edge: {sourcename: "n254" targetname: "n276" label: "1" class:16 priority:10} +} + +graph: { title: "n229" label: "Block 229" status:clustered color:yellow +edge: {sourcename: "n229" targetname: "n232" label: "0" class:13 priority:60 color:red} +node: {title: "n235" label: "ProjM 1 235" info1: "mode: M +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 1 +"color: yellow} +edge: {sourcename: "n235" targetname: "n230" label: "0" class:17 priority:10 color:blue} +node: {title: "n232" label: "ProjX 0 232" info1: "mode: X +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 1 +"color: yellow} +edge: {sourcename: "n232" targetname: "n230" label: "0" class:13 priority:60 color:red} +node: {title: "n230" label: "Start 230" info1: "mode: T +visited: 25 +irg: STRENGTH_RED_EXAMPLE_m4 +arity: 0 +start of method of type STRENGTH_RED_EXAMPLE_meth_tp + param 0 type: int +"color: blue} +} + +} + +} diff --git a/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m5-strength_reduced.vcg b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m5-strength_reduced.vcg new file mode 100644 index 000000000..f8b626e85 --- /dev/null +++ b/testprograms/ref-results/STRENGTH_RED_EXAMPLE_m5-strength_reduced.vcg @@ -0,0 +1,237 @@ +graph: { title: "ir graph of STRENGTH_RED_EXAMPLE_m5" +display_edge_labels: no +layoutalgorithm: mindepth +manhattan_edges: yes +port_sharing: no +orientation: bottom_to_top +classname 1: "intrablock Data" +classname 16: "interblock Data" +classname 2: "Block" +classname 13: "Control Flow" +classname 14: "intrablock Memory" +classname 17: "interblock Memory" +classname 15: "Dominators" +classname 3: "Entity type" +classname 4: "Entity owner" +classname 5: "Method Param" +classname 6: "Method Res" +classname 7: "Super" +classname 8: "Union" +classname 9: "Points-to" +classname 10: "Array Element Type" +classname 11: "Overwrites" +classname 12: "Member" +infoname 1: "Attribute" +infoname 2: "Verification errors" +colorentry 100: 0 0 0 +colorentry 101: 20 0 0 +colorentry 102: 40 0 0 +colorentry 103: 60 0 0 +colorentry 104: 80 0 0 +colorentry 105: 100 0 0 +colorentry 106: 120 0 0 +colorentry 107: 140 0 0 +colorentry 108: 150 0 0 +colorentry 109: 180 0 0 +colorentry 110: 200 0 0 +colorentry 111: 220 0 0 +colorentry 112: 240 0 0 +colorentry 113: 255 0 0 +colorentry 113: 255 20 20 +colorentry 114: 255 40 40 +colorentry 115: 255 60 60 +colorentry 116: 255 80 80 +colorentry 117: 255 100 100 +colorentry 118: 255 120 120 +colorentry 119: 255 140 140 +colorentry 120: 255 150 150 +colorentry 121: 255 180 180 +colorentry 122: 255 200 200 +colorentry 123: 255 220 220 +colorentry 124: 255 240 240 +colorentry 125: 255 250 250 + +graph: { title: "g297" label: "STRENGTH_RED_EXAMPLE_m5" status:clustered color:white +graph: { title: "n287" label: "Block 287" status:clustered color:yellow +edge: {sourcename: "n287" targetname: "n332" label: "0" class:13 priority:60 color:red} +node: {title: "n288" label: "End 288" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 1 +"color: blue} +} + +graph: { title: "n329" label: "Block 329" status:clustered color:yellow +edge: {sourcename: "n329" targetname: "n308" label: "0" class:13 priority:60 color:red} +node: {title: "n332" label: "Return 332" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 2 +return in method of type STRENGTH_RED_EXAMPLE_meth_tp + res 0 type: int +"} +node: {title: "n332n312" label: "0x4Is 312" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n332" targetname: "n336" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n332" targetname: "n332n312" label: "1" class:16 priority:10} +} + +graph: { title: "n302" label: "Block 302" status:clustered color:yellow +edge: {sourcename: "n302" targetname: "n301" label: "0" class:13 priority:60 color:red} +backedge: {sourcename: "n302" targetname: "n323" label: "1" linestyle:dashed class:13 priority:60 color:red} +node: {title: "n336" label: "PhiM 336" info1: "mode: M +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 2 backedges: +"color: green} +edge: {sourcename: "n336" targetname: "n295" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n336" targetname: "n322" label: "1" class:17 priority:10 color:blue} +node: {title: "n308" label: "ProjX 0 308" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 1 +"color: yellow} +edge: {sourcename: "n308" targetname: "n307" label: "0" class:13 priority:60 color:red} +node: {title: "n309" label: "ProjX 1 309" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 1 +"color: yellow} +edge: {sourcename: "n309" targetname: "n307" label: "0" class:13 priority:60 color:red} +node: {title: "n307" label: "Cond 307" info1: "mode: T +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 1 +"} +edge: {sourcename: "n307" targetname: "n306" label: "0" class:1 priority:50} +node: {title: "n306" label: "Projb Lt 306" info1: "mode: b +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 1 +"color: yellow} +edge: {sourcename: "n306" targetname: "n420" label: "0" class:1 priority:50} +node: {title: "n420" label: "CmpT 420" info1: "mode: T +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 2 +"} +node: {title: "n420n304" label: "0x0Is 304" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n420" targetname: "n415" label: "0" class:1 priority:50} +edge: {sourcename: "n420" targetname: "n420n304" label: "1" class:16 priority:10} +node: {title: "n415" label: "PhiIs 415" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 2 backedges: +"color: green} +node: {title: "n415n413" label: "0x28Is 413" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n415" targetname: "n415n413" label: "0" class:16 priority:10} +edge: {sourcename: "n415" targetname: "n416" label: "1" class:16 priority:10} +} + +graph: { title: "n298" label: "Block 298" status:clustered color:yellow +edge: {sourcename: "n298" targetname: "n292" label: "0" class:13 priority:60 color:red} +node: {title: "n301" label: "Jmp 301" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +"} +} + +graph: { title: "n310" label: "Block 310" status:clustered color:yellow +edge: {sourcename: "n310" targetname: "n309" label: "0" class:13 priority:60 color:red} +node: {title: "n322" label: "ProjM 0 322" info1: "mode: M +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 1 +"color: yellow} +edge: {sourcename: "n322" targetname: "n320" label: "0" class:17 priority:10 color:blue} +node: {title: "n320" label: "Store 320" info1: "mode: T +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 3 +volatility: volatility_non_volatile +"} +node: {title: "n320n318" label: "0x13Is 318" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n320" targetname: "n336" label: "0" class:17 priority:10 color:blue} +edge: {sourcename: "n320" targetname: "n417" label: "1" class:1 priority:50} +edge: {sourcename: "n320" targetname: "n320n318" label: "2" class:16 priority:10} +node: {title: "n417" label: "AddP 417" info1: "mode: P +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 2 +"} +node: {title: "n417n300" label: "SymC &a 300" info1: "mode: P +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +kind addr_ent +entity GlobalType.a (285) + +"} +edge: {sourcename: "n417" targetname: "n417n300" label: "0" class:16 priority:10} +edge: {sourcename: "n417" targetname: "n416" label: "1" class:1 priority:50} +node: {title: "n323" label: "Jmp 323" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +"} +node: {title: "n416" label: "SubIs 416" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 2 +"} +node: {title: "n416n312" label: "0x4Is 312" info1: "mode: Is +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +Const of type type_unknown +"color: yellow} +edge: {sourcename: "n416" targetname: "n415" label: "0" class:16 priority:10} +edge: {sourcename: "n416" targetname: "n416n312" label: "1" class:16 priority:10} +} + +graph: { title: "n289" label: "Block 289" status:clustered color:yellow +edge: {sourcename: "n289" targetname: "n292" label: "0" class:13 priority:60 color:red} +node: {title: "n295" label: "ProjM 1 295" info1: "mode: M +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 1 +"color: yellow} +edge: {sourcename: "n295" targetname: "n290" label: "0" class:17 priority:10 color:blue} +node: {title: "n292" label: "ProjX 0 292" info1: "mode: X +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 1 +"color: yellow} +edge: {sourcename: "n292" targetname: "n290" label: "0" class:13 priority:60 color:red} +node: {title: "n290" label: "Start 290" info1: "mode: T +visited: 24 +irg: STRENGTH_RED_EXAMPLE_m5 +arity: 0 +start of method of type STRENGTH_RED_EXAMPLE_meth_tp + param 0 type: int +"color: blue} +} + +} + +} diff --git a/testprograms/ref-results/run-result.txt b/testprograms/ref-results/run-result.txt index 0313f94f4..5436a627f 100644 --- a/testprograms/ref-results/run-result.txt +++ b/testprograms/ref-results/run-result.txt @@ -151,6 +151,54 @@ Use xvcg to view these graphs: /ben/goetz/bin/xvcg GRAPHNAME +Creating an IR graph: IF_EXAMPLE... +Done building the graph. Dumping and optimizing it. +The constant of Reducing node is: reduce_itervar(l.221) ConstIs: 47 (0x80f3a38) +The Phi node isreduce_itervar(l.222) PhiIs: 65 (0x80f3f2c) +Reducing node: reduce_itervar(l.223) MulIs: 50 (0x80f3b10) + iter var is reduce_itervar(l.224) AddIs: 57 (0x80f3d2c) + in graph reduce_itervar(l.225) graph STRENGTH_RED_EXAMPLE_m1: 33 (0x80f3220) in class GlobalType. +The constant of Reducing node is: reduce_itervar(l.221) ConstIs: 47 (0x80f3a38) +The Phi node isreduce_itervar(l.222) PhiIs: 89 (0x80f5bf8) +Reducing node: reduce_itervar(l.223) MulIs: 76 (0x80f427c) + iter var is reduce_itervar(l.224) SubIs: 83 (0x80f5a54) + in graph reduce_itervar(l.225) graph STRENGTH_RED_EXAMPLE_m1: 33 (0x80f3220) in class GlobalType. +Reduced 0 iteration variables in graph GlobalType.STRENGTH_RED_EXAMPLE_m1 +.The constant of Reducing node is: reduce_itervar(l.221) ConstIs: 131 (0x80f7398) +The Phi node isreduce_itervar(l.222) PhiIs: 156 (0x80f7a28) +Reducing node: reduce_itervar(l.223) MulIs: 133 (0x80f7424) + iter var is reduce_itervar(l.224) AddIs: 141 (0x80f7688) + in graph reduce_itervar(l.225) graph STRENGTH_RED_EXAMPLE_m2: 116 (0x80f6b20) in class GlobalType. +It is possibale to exchange the Cmp with a new Cmp +The constant of Cmp node is: reduce_itervar(l.291) ConstIs: 123 (0x80f7128) +The Phi node is reduce_itervar(l.292) PhiIs: 156 (0x80f7a28) +Cmp node: reduce_itervar(l.293) CmpT: 124 (0x80f7170) + in graph reduce_itervar(l.294) graph STRENGTH_RED_EXAMPLE_m2: 116 (0x80f6b20) in class GlobalType. +Reduced 0 iteration variables in graph GlobalType.STRENGTH_RED_EXAMPLE_m2 +.The constant of Reducing node is: reduce_itervar(l.221) ConstIs: 192 (0x80f9c18) +The Phi node isreduce_itervar(l.222) PhiIs: 216 (0x80fa260) +Reducing node: reduce_itervar(l.223) MulIs: 194 (0x80f9ca4) + iter var is reduce_itervar(l.224) SubIs: 201 (0x80f9ec0) + in graph reduce_itervar(l.225) graph STRENGTH_RED_EXAMPLE_m3: 177 (0x80f93d0) in class GlobalType. +Reduced 0 iteration variables in graph GlobalType.STRENGTH_RED_EXAMPLE_m3 +.The constant of Reducing node is: reduce_itervar(l.221) ConstIs: 252 (0x80fc4b0) +The Phi node isreduce_itervar(l.222) PhiIs: 276 (0x80fcaf8) +Reducing node: reduce_itervar(l.223) MulIs: 255 (0x80fc584) + iter var is reduce_itervar(l.224) AddIs: 254 (0x80fc53c) + in graph reduce_itervar(l.225) graph STRENGTH_RED_EXAMPLE_m4: 237 (0x80fbc38) in class GlobalType. +Reduced 0 iteration variables in graph GlobalType.STRENGTH_RED_EXAMPLE_m4 +.The constant of Reducing node is: reduce_itervar(l.221) ConstIs: 312 (0x80fed68) +The Phi node isreduce_itervar(l.222) PhiIs: 337 (0x80ff3f8) +Reducing node: reduce_itervar(l.223) MulIs: 315 (0x80fee3c) + iter var is reduce_itervar(l.224) SubIs: 314 (0x80fedf4) + in graph reduce_itervar(l.225) graph STRENGTH_RED_EXAMPLE_m5: 297 (0x80fe520) in class GlobalType. +It is possibale to exchange the Cmp with a new Cmp +The constant of Cmp node is: reduce_itervar(l.291) ConstIs: 304 (0x80feaf8) +The Phi node is reduce_itervar(l.292) PhiIs: 337 (0x80ff3f8) +Cmp node: reduce_itervar(l.293) CmpT: 305 (0x80feb40) + in graph reduce_itervar(l.294) graph STRENGTH_RED_EXAMPLE_m5: 297 (0x80fe520) in class GlobalType. +Reduced 0 iteration variables in graph GlobalType.STRENGTH_RED_EXAMPLE_m5 +. Creating an IR graph: THREE_CFPRED_EXAMPLE ... Optimizing ... Dumping the graph and a control flow graph. diff --git a/testprograms/strength_red_example.c b/testprograms/strength_red_example.c new file mode 100644 index 000000000..fe6983a4e --- /dev/null +++ b/testprograms/strength_red_example.c @@ -0,0 +1,383 @@ +/* + * Project: libFIRM + * File name: testprograms/strength_red_example.c + * Purpose: Shows how strength red works + * Author: Beyhan Veliev + * Modified by: + * Created: + * CVS-ID: $Id$ + * Copyright: (c) 2004 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ + +# include +# include + +# include "firm.h" + +# include "irvrfy.h" +# include "irdump.h" + + +/** +* This file constructs the ir for the following pseudo-program: +* +* int a[10]; +* +* void main(void) { +* int i = 0; +* +* while (i < 10) { +* a[i] = 19; +* i++ +* } +* } +**/ + +#define CLASSNAME "STRENGTH_RED_EXAMPLE" +#define METHODNAME1 "STRENGTH_RED_EXAMPLE_m1" +#define METHODNAME2 "STRENGTH_RED_EXAMPLE_m2" +#define METHODNAME3 "STRENGTH_RED_EXAMPLE_m3" +#define METHODNAME4 "STRENGTH_RED_EXAMPLE_m4" +#define METHODNAME5 "STRENGTH_RED_EXAMPLE_m5" +#define METHODTPNAME "STRENGTH_RED_EXAMPLE_meth_tp" +#define NRARGS 1 +#define NRES 1 +#define L_BOUND 0 +#define U_BOUND 10 +#define N_DIMS 1 + /** The type int. **/ +#define PRIM_NAME "int" + + + +static int i_pos = 0; +static int arr_pos = 1; +static type *typ; + +static ir_node *r1, *f, *r; + +typedef enum { + loop_forward, + loop_backward, +} loop_dir_t; + +static void function_begin(type *owner, type *mtp, char *fct_name, loop_dir_t loop_dir) { + symconst_symbol sym; + ir_node *x, *t, *cmp; + /* The entity for the procedure */ + entity *ent = new_entity (owner, new_id_from_str (fct_name), mtp); + /* The parameter and result types of the procedure. */ + set_method_param_type(mtp, 0, typ); + set_method_res_type(mtp, 0, typ); + + /* make type infromation for the array */ + type *array_type = new_type_array(new_id_from_chars("array", 5),N_DIMS, typ); + + /* set the bounds for the array */ + set_array_bounds(array_type, 0, + new_Const(mode_Iu, new_tarval_from_long (L_BOUND, mode_Iu)), + new_Const(mode_Iu, new_tarval_from_long (U_BOUND, mode_Iu))); + /* The array is an entity of the global typ */ + entity *array_ent = new_entity( owner, new_id_from_chars("a", 1), array_type); + + /** The code of the procedure **/ + + /* Generates start and end blocks and nodes, and a first, initial block */ +#define NRLOCS 2 + new_ir_graph (ent, NRLOCS); + + /* The value position used for: */ + i_pos = 0; + + /* Generate the constant and assign it to b. The assignment is resolved to a + dataflow edge. */ + if (loop_dir == loop_forward) { + set_value (i_pos, new_Const (mode_Is, new_tarval_from_long (0, mode_Is))); + } else { + set_value (i_pos, new_Const (mode_Is, new_tarval_from_long (10, mode_Is))); + } + sym.entity_p = array_ent ; + set_value (arr_pos, new_SymConst(sym, symconst_addr_ent)); + + x = new_Jmp (); + + /* We know all predecessors of the block and all set_values and set_stores are + preformed. We can mature the block. */ + mature_immBlock (get_irg_current_block(current_ir_graph)); + + /* Generate a conditional branch */ + r1 = new_immBlock(); + add_immBlock_pred(get_irg_current_block(current_ir_graph), x); + + if (loop_dir == loop_forward) { + cmp = new_Cmp(new_Const (mode_Is, new_tarval_from_long(10, mode_Is)), + get_value(i_pos, mode_Is)); + x = new_Cond (new_Proj(cmp, mode_b, Gt)); + } else { + cmp = new_Cmp(new_Const (mode_Is, new_tarval_from_long(0, mode_Is)), + get_value(i_pos, mode_Is)); + x = new_Cond (new_Proj(cmp, mode_b, Lt)); + } + f = new_Proj (x, mode_X, 0); + t = new_Proj (x, mode_X, 1); + + /* generate and fill the loop body block */ + r = new_immBlock (); + add_immBlock_pred (r, t); +} + +static void function_end(ir_node *b) { + ir_node *x = new_Jmp (); + mature_immBlock (r); + add_immBlock_pred(r1, x); + + + new_immBlock(); + add_immBlock_pred(get_cur_block(), f); + mature_immBlock (get_cur_block()); + /* The Return statement */ + { + ir_node *in[1], *store ; + in[0] = b; + store = get_store(); + + x = new_Return (store, 1, in); + } + add_immBlock_pred(get_irg_end_block(current_ir_graph), x); + + mature_immBlock (r1); + /* finalize the end block generated in new_ir_graph() */ + mature_immBlock (get_irg_end_block(current_ir_graph)); +} + +int +main(void) +{ + ir_graph *irg; + type *owner; + entity *ent, *array_ent; + type *proc_tp, *array_type; /* type information for the method main */ + ir_node *x,*x1 , *r, *t, *f, *f1, *t1, *cmp, *r1, *r2; + int i_pos; + + printf("\nCreating an IR graph: IF_EXAMPLE...\n"); + + init_firm (NULL); + + do_node_verification(NODE_VERIFICATION_REPORT); + + typ = new_type_primitive(new_id_from_chars(PRIM_NAME, strlen(PRIM_NAME)), mode_Is); + + /** The global array variable a **/ + + + /** Type information for the procedure **/ + owner = get_glob_type(); + /* Type information for the procedure */ + proc_tp = new_type_method(new_id_from_chars(METHODTPNAME, strlen(METHODTPNAME)), + NRARGS, NRES); + set_method_param_type(proc_tp, 0, typ); + set_method_res_type(proc_tp, 0, typ); + + + /* --------------------------------------------------------------------- */ + + /* The entity for the procedure */ + ent = new_entity (owner, + new_id_from_str (METHODNAME1), + proc_tp); + /* The parameter and result types of the procedure. */ + + /* make type infromation for the array */ + array_type = new_type_array(new_id_from_chars("array", 5),N_DIMS, typ); + + /* set the bounds for the array */ + set_array_bounds(array_type, 0, + new_Const(mode_Iu, new_tarval_from_long (L_BOUND, mode_Iu)), + new_Const(mode_Iu, new_tarval_from_long (U_BOUND, mode_Iu))); + /* The array is an entity of the global typ */ + array_ent = new_entity( owner, new_id_from_chars("a", 1), array_type); + + /** The code of the procedure **/ + + + /* Generates start and end blocks and nodes, and a first, initial block */ +#undef NRLOCS +#define NRLOCS 1 + irg = new_ir_graph (ent, NRLOCS); + + /* The value position used for: */ + i_pos = 0; + + /* Generate the constant and assign it to b. The assignment is resovled to a + dataflow edge. */ + set_value (i_pos, new_Const (mode_Is, new_tarval_from_long (0, mode_Is))); + x = new_Jmp (); + + /* We know all predecessors of the block and all set_values and set_stores are + preformed. We can mature the block. */ + mature_immBlock (get_irg_current_block(irg)); + + /* Generate a conditional branch */ + r1 = new_immBlock(); + add_immBlock_pred(get_irg_current_block(irg), x); + cmp = new_Cmp(new_Const (mode_Is, new_tarval_from_long(10, mode_Is)), + get_value(i_pos, mode_Is)); + x = new_Cond (new_Proj(cmp, mode_b, Gt)); + f = new_Proj (x, mode_X, 0); + t = new_Proj (x, mode_X, 1); + + /* generate and fill the then block */ + r = new_immBlock (); + add_immBlock_pred (r, t); + + ir_node *b, *c, *d, *res; + symconst_symbol sym; + c = new_Const (mode_Is, new_tarval_from_long (1, mode_Is)); + b = new_Const (mode_Is, new_tarval_from_long (4, mode_Is)); + sym.entity_p = array_ent ; + d = new_SymConst(sym, symconst_addr_ent); + res = new_Add(d, new_Mul(get_value(i_pos, mode_Is), b, mode_Is), mode_P); + set_store (new_Proj (new_Store (get_store (), res, new_Const (mode_Is, + new_tarval_from_long (19,mode_Is))), + mode_M, 0)); + set_value (i_pos, new_Add(get_value(i_pos, mode_Is), c , mode_Is)); + + x = new_Jmp (); + mature_immBlock (r); + + add_immBlock_pred(r1, x); + mature_immBlock (r1); + + r2 = new_immBlock(); + add_immBlock_pred(get_irg_current_block(irg), f); + cmp = new_Cmp(new_Const (mode_Is, new_tarval_from_long(0, mode_Is)),get_value(i_pos, mode_Is)); + x = new_Cond (new_Proj(cmp, mode_b, Lt)); + f1 = new_Proj (x, mode_X, 0); + t1 = new_Proj (x, mode_X, 1); + + ir_node *block = new_immBlock(); + add_immBlock_pred(block, t1); + + res = new_Add(d, new_Mul(get_value(i_pos, mode_Is), b, mode_Is), mode_P); + set_store (new_Proj (new_Store (get_store (), res, new_Const (mode_Is, + new_tarval_from_long (19, mode_Is))), mode_M, 0)); + set_value (i_pos, new_Sub(get_value(i_pos, mode_Is), c , mode_Is)); + + x1 = new_Jmp (); + + mature_immBlock (block); + + add_immBlock_pred(r2, x1); + mature_immBlock (r2); + + block = new_immBlock(); + add_immBlock_pred(block, f1); + mature_immBlock (block); + /* The Return statement */ + { + ir_node *in[1], *store ; + in[0] = get_value (i_pos, mode_Is); + store = get_store(); + + x = new_Return (store, 1, in); + } + add_immBlock_pred(get_irg_end_block(irg), x); + + /* finalize the end block generated in new_ir_graph() */ + mature_immBlock (get_irg_end_block(irg)); + + + /* -------------------------------------------------------------------------------- */ + + function_begin(owner, proc_tp, METHODNAME2, loop_forward); + + c = new_Const (mode_Is, new_tarval_from_long (1, mode_Is)); + b = new_Const (mode_Is, new_tarval_from_long (4, mode_Is)); + + res = new_Add(get_value(arr_pos, mode_P), new_Mul(get_value(i_pos, mode_Is), b, mode_Is), mode_P); + set_store (new_Proj (new_Store (get_store (), res, new_Const (mode_Is, + new_tarval_from_long (19, mode_Is))), + mode_M, 0)); + + set_value (i_pos, new_Add(get_value(i_pos, mode_Is), c, mode_Is)); + + function_end(b); + + /* -------------------------------------------------------------------------- */ + + function_begin(owner, proc_tp, METHODNAME3, loop_backward); + + c = new_Const (mode_Is, new_tarval_from_long (1, mode_Is)); + b = new_Const (mode_Is, new_tarval_from_long (4, mode_Is)); + + + res = new_Add(get_value(arr_pos, mode_P), new_Mul(get_value(i_pos, mode_Is), b, mode_Is), mode_P); + set_store (new_Proj (new_Store (get_store (), res, get_value(i_pos, mode_Is)), mode_M, 0)); + + set_value (i_pos, new_Sub(get_value(i_pos, mode_Is), c, mode_Is)); + + function_end(b); + + /* -------------------------------------------------------------------------- */ + + function_begin(owner, proc_tp, METHODNAME4, loop_forward); + + c = new_Const (mode_Is, new_tarval_from_long (1, mode_Is)); + b = new_Const (mode_Is, new_tarval_from_long (4, mode_Is)); + + set_value (i_pos, new_Add(get_value(i_pos, mode_Is), c, mode_Is)); + + res = new_Add(get_value(arr_pos, mode_P), new_Mul(get_value(i_pos, mode_Is), b, mode_Is), mode_P); + set_store (new_Proj (new_Store (get_store (), res,get_value(i_pos, mode_Is)), + mode_M, 0)); + + function_end(b); + + /* -------------------------------------------------------------------------- */ + + function_begin(owner, proc_tp, METHODNAME5, loop_backward); + + c = new_Const (mode_Is, new_tarval_from_long (1, mode_Is)); + b = new_Const (mode_Is, new_tarval_from_long (4, mode_Is)); + + set_value (i_pos, new_Sub(get_value(i_pos, mode_Is), c, mode_Is)); + + + res = new_Add(get_value(arr_pos, mode_P), new_Mul(get_value(i_pos, mode_Is), b, mode_Is), mode_P); + set_store (new_Proj (new_Store (get_store (), res, new_Const (mode_Is, + new_tarval_from_long (19, mode_Is))), + mode_M, 0)); + + function_end(b); + + /* -------------------------------------------------------------------------- */ + + int i, n_irgs = get_irp_n_irgs(); + + printf("Done building the graph. Dumping and optimizing it.\n"); + dump_consts_local(1); + turn_off_edge_labels(); + for (i = 0; i < n_irgs; ++i) { + current_ir_graph = get_irp_irg(i); + irg_vrfy(current_ir_graph); + finalize_cons (current_ir_graph); + + /* output the vcg file */ + //dump_ir_block_graph (current_ir_graph, "-early"); + construct_backedges(current_ir_graph); + //dump_ir_block_graph (current_ir_graph, 0); + dump_all_types(0); + set_opt_strength_red_verbose(2); + set_firm_verbosity(2); + reduce_strength(current_ir_graph); + + //dump_loop_tree(current_ir_graph, ""); + dump_ir_block_graph (current_ir_graph, "-strength_reduced"); + } + //printf("use xvcg to view this graph:\n"); + //printf("/ben/goetz/bin/xvcg GRAPHNAME\n\n"); + + return (0); +} -- 2.20.1