Skip to content

Commit 03d76f6

Browse files
committed
Remove phase 1 IR
Phase 1 IR is previously served as a solution for bridging C frontend to backend (elf code generation), which becomes obsolete after the introduction of SSA middle-end. In this patch, "ph1_ir_t" and related structures & functionalities are removed. Notice that IR dumping is replace with "insn_t" with SSA-based control flow, and several opcodes are removed as being only used in "ph1_ir_t".
1 parent 411a6f6 commit 03d76f6

File tree

11 files changed

+562
-1104
lines changed

11 files changed

+562
-1104
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ CFLAGS := -O -g \
44
-fwrapv \
55
-Wall -Wextra \
66
-Wno-unused-but-set-variable \
7+
-Wno-unused-parameter \
8+
-Wno-unused-function \
9+
-Wshadow \
710
-Wno-variadic-macros \
811
-Wno-uninitialized \
912
-Wno-strict-prototypes \

src/defs.h

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,9 @@ typedef enum {
205205
OP_load_data_address, /* lookup address of a constant in data section */
206206

207207
/* control flow */
208-
OP_label,
209-
OP_branch, /* conditional jump */
210-
OP_jump, /* unconditional jump */
211-
OP_func_ret, /* returned value */
212-
OP_block_start, /* code block start */
213-
OP_block_end, /* code block end */
208+
OP_branch, /* conditional jump */
209+
OP_jump, /* unconditional jump */
210+
OP_func_ret, /* returned value */
214211

215212
/* function pointer */
216213
OP_address_of_func, /* resolve function entry */
@@ -338,17 +335,6 @@ typedef struct {
338335
block_t *tail;
339336
} block_list_t;
340337

341-
/* phase-1 IR definition */
342-
typedef struct {
343-
opcode_t op;
344-
char func_name[MAX_VAR_LEN];
345-
int param_num;
346-
int size;
347-
var_t *dest;
348-
var_t *src0;
349-
var_t *src1;
350-
} ph1_ir_t;
351-
352338
typedef struct basic_block basic_block_t;
353339

354340
/* Definition of a dynamic array structure for sources in src/globals.c
@@ -469,8 +455,10 @@ struct basic_block {
469455
insn_list_t insn_list;
470456
ph2_ir_list_t ph2_ir_list;
471457
bb_connection_t prev[MAX_BB_PRED];
472-
struct basic_block *next; /* normal BB */
473-
struct basic_block *then_; /* conditional BB */
458+
char bb_label_name[MAX_VAR_LEN]; /* Used in instruction dumping when ir_dump
459+
is enabled. */
460+
struct basic_block *next; /* normal BB */
461+
struct basic_block *then_; /* conditional BB */
474462
struct basic_block *else_;
475463
struct basic_block *idom;
476464
struct basic_block *r_idom;

0 commit comments

Comments
 (0)