1515#define MAX_TYPE_LEN 32
1616#define MAX_PARAMS 8
1717#define MAX_LOCALS 1500
18- #define MAX_FIELDS 32
18+ #define MAX_FIELDS 64
1919#define MAX_FUNCS 512
2020#define MAX_FUNC_TRIES 2160
2121#define MAX_BLOCKS 2048
2222#define MAX_TYPES 64
2323#define MAX_IR_INSTR 40000
2424#define MAX_BB_PRED 128
2525#define MAX_BB_DOM_SUCC 64
26+ #define MAX_BB_RDOM_SUCC 256
2627#define MAX_GLOBAL_IR 256
2728#define MAX_LABEL 4096
2829#define MAX_SOURCE 327680
@@ -173,6 +174,7 @@ struct var {
173174 int subscripts_idx ;
174175 rename_t rename ;
175176 ref_block_list_t ref_block_list ; /* blocks which kill variable */
177+ struct insn * last_assign ;
176178 int consumed ;
177179 bool is_ternary_ret ;
178180 bool is_log_and_ret ;
@@ -308,6 +310,8 @@ struct insn {
308310 var_t * rs1 ;
309311 var_t * rs2 ;
310312 int sz ;
313+ bool useful ; /* Used in DCE process. Set true if instruction is useful. */
314+ basic_block_t * belong_to ;
311315 phi_operand_t * phi_ops ;
312316 char str [64 ];
313317};
@@ -352,6 +356,7 @@ struct basic_block {
352356 struct basic_block * then_ ; /* conditional BB */
353357 struct basic_block * else_ ;
354358 struct basic_block * idom ;
359+ struct basic_block * r_idom ;
355360 struct basic_block * rpo_next ;
356361 struct basic_block * rpo_r_next ;
357362 var_t * live_gen [MAX_ANALYSIS_STACK_SIZE ];
@@ -365,10 +370,15 @@ struct basic_block {
365370 int rpo ;
366371 int rpo_r ;
367372 struct basic_block * DF [64 ];
373+ struct basic_block * RDF [64 ];
368374 int df_idx ;
375+ int rdf_idx ;
369376 int visited ;
377+ bool useful ; /* indicate whether this BB contains useful instructions */
370378 struct basic_block * dom_next [64 ];
371379 struct basic_block * dom_prev ;
380+ struct basic_block * rdom_next [256 ];
381+ struct basic_block * rdom_prev ;
372382 fn_t * belong_to ;
373383 block_t * scope ;
374384 symbol_list_t symbol_list ; /* variable declaration */
0 commit comments