#include <stdio.h>
#include "../pass5d/op_codes.h"
#include "../parm.h"
#include "RIC.h"
Go to the source code of this file.
Data Structures | |
struct | reg_descr |
Defines | |
#define | DEBUG |
#define | TRACE |
#define | HASHT_SIZE 32 |
#define | mod_sz(n) ((n) & 0x1f) |
#define | NO_REG -2 |
#define | is_real_reg(r) |
#define | S_LIVE 0 |
#define | S_DEAD 1 |
#define | S_UDC 2 |
#define | NOT_CONSTANT 0x40000000 |
#define | reg_nil ((regp) 0) |
#define | DP_DOT "_Float_Dot" |
#define | SP_DOT "_SFloat_Dot" |
#define | SBFSZ 120 |
Typedefs | |
typedef struct RIC_instr * | RICp |
typedef struct reg_descr * | regp |
Functions | |
void | add_after (RICp p, RICp q) |
void | delete (RICp p) |
void | clear_block () |
void | write_block () |
RICp | make_instr (int opc, int arg1, int arg2, int arg3) |
RICp | make_lbl_instr (int opc, char *lbl) |
RICp | read_instr () |
void | set_regs (RICp p) |
regp | lookup () |
void | clear_equiv (regp r) |
regp | lookup (int reg_no) |
void | clear_hasht () |
void | propagate () |
void | eliminate () |
void | optimize_block () |
main (int argc, char **argv) | |
Variables | |
char | label_buf [MAXLABELSZ+1] |
struct RIC_instr * | cbb = RIC_nil |
struct RIC_instr * | cbb_last = RIC_nil |
regp | hasht [HASHT_SIZE] |
long | const_arg_table [3] |
RICp | arg_instrs [3] |
#define DP_DOT "_Float_Dot" |
Referenced by propagate().
#define HASHT_SIZE 32 |
#define is_real_reg | ( | r | ) |
Value:
((r) >= FIRST_AVAIL_LOC || (r) == TL \ || (r) == RL || (r) == T2)
Definition at line 202 of file filter.c.
Referenced by clear_equiv(), propagate(), and set_regs().
#define NO_REG -2 |
Definition at line 16 of file filter.c.
Referenced by clear_equiv(), eliminate(), lookup(), propagate(), and set_regs().
#define NOT_CONSTANT 0x40000000 |
#define reg_nil ((regp) 0) |
Definition at line 394 of file filter.c.
Referenced by clear_equiv(), clear_hasht(), lookup(), and propagate().
#define S_DEAD 1 |
#define S_LIVE 0 |
#define S_UDC 2 |
#define SBFSZ 120 |
Referenced by propagate().
#define SP_DOT "_SFloat_Dot" |
Referenced by propagate().
Definition at line 27 of file filter.c.
References RIC_instr::next_instr, RIC_instr::prev_instr, and RIC_nil.
Referenced by clear_hasht(), eliminate(), main(), and propagate().
void clear_block | ( | ) |
void clear_equiv | ( | regp | r | ) |
Definition at line 401 of file filter.c.
References reg_descr::const_val, reg_descr::equiv_reg, FALSE, is_real_reg, lookup(), reg_descr::mapped_regs, reg_descr::next_mapped_reg, NO_REG, NOT_CONSTANT, reg_nil, reg_descr::this_reg, and TRUE.
Referenced by propagate().
void clear_hasht | ( | ) |
Definition at line 492 of file filter.c.
References add_after(), GC_free(), HASHT_SIZE, make_instr(), reg_descr::next_reg, reg_nil, RIC_nil, S_UDC, SK, reg_descr::status, reg_descr::this_reg, and UDC.
Referenced by optimize_block().
void delete | ( | RICp | p | ) |
Definition at line 48 of file filter.c.
References AL, RIC_instr::arg, HINT, LBA, LBR, RIC_instr::next_instr, NP, NSC, RIC_instr::op_code, RIC_instr::prev_instr, PT, RIC_nil, and STSZ.
void eliminate | ( | ) |
Definition at line 836 of file filter.c.
References add_after(), DCL, DEAD, FALSE, HINT, lookup(), make_instr(), NO_REG, NONE, RIC_nil, S_DEAD, S_LIVE, S_UDC, SK, reg_descr::status, TRUE, and UDC.
Referenced by optimize_block().
regp lookup | ( | int | reg_no | ) |
Definition at line 467 of file filter.c.
References reg_descr::const_val, reg_descr::equiv_reg, GC_malloc(), mod_sz, reg_descr::next_reg, NO_REG, NOT_CONSTANT, reg_nil, and reg_descr::this_reg.
regp lookup | ( | ) |
Referenced by clear_equiv(), eliminate(), and propagate().
main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 961 of file filter.c.
References add_after(), BFN, BR, BRF, BRT, BSF, clear_block(), GC_init(), LBL, optimize_block(), read_instr(), RIC_nil, set_regs(), and write_block().
RICp make_instr | ( | int | opc, | |
int | arg1, | |||
int | arg2, | |||
int | arg3 | |||
) |
Definition at line 121 of file filter.c.
References RIC_instr::arg, FALSE, GC_malloc(), RIC_instr::label_arg, and RIC_instr::op_code.
Referenced by clear_hasht(), eliminate(), propagate(), and read_instr().
RICp make_lbl_instr | ( | int | opc, | |
char * | lbl | |||
) |
Definition at line 137 of file filter.c.
References GC_malloc(), RIC_instr::label, RIC_instr::label_arg, RIC_instr::op_code, and TRUE.
Referenced by propagate(), and read_instr().
void optimize_block | ( | ) |
Definition at line 951 of file filter.c.
References clear_hasht(), eliminate(), and propagate().
Referenced by main().
void propagate | ( | ) |
Definition at line 529 of file filter.c.
References add_after(), ALA, ALH, ARG, C0, C1, C2, C3, C4, CLC, clear_equiv(), const_arg_table, reg_descr::const_val, DCL, DDT, DP_DOT, reg_descr::equiv_reg, FALSE, FDT, is_real_reg, LBA, LDI, LDL, LDN, lookup(), make_instr(), make_lbl_instr(), reg_descr::mapped_regs, MOV, reg_descr::next_mapped_reg, NO_REG, NONE, NOT_CONSTANT, reg_nil, RIC_nil, RL, S_LIVE, S_UDC, SBFSZ, set_regs(), SK, SP, SP_DOT, reg_descr::status, TL, TRUE, and UDC.
Referenced by optimize_block().
RICp read_instr | ( | ) |
Definition at line 153 of file filter.c.
References RIC_instr::arg, GC_free(), HINT, label_buf, make_instr(), make_lbl_instr(), MAX_LABEL_OP, MAXLABELSZ, N_OP_CODES, OPT, and RIC_nil.
Referenced by main().
void set_regs | ( | RICp | p | ) |
Definition at line 208 of file filter.c.
References ABI, ADF, ADI, ADP, ADT, ALA, ALH, ALS, AND, ARG, RIC_instr::arg, BFN, BR, BRF, BRT, BSF, CLC, CLI, CLL, DCL, DDT, DEA, DEAD, DVF, DVI, EQF, EQI, ERR, EXF, EXT, FALSE, FDT, FIRST_AVAIL_LOC, FLS, GAR, GEF, GEI, GTF, GTI, HINT, IDT, is_real_reg, LBA, LBL, LBR, LDC, LDI, LDL, LDN, LDS, LEF, LEI, LIVE, LTF, LTI, MLF, MLI, MOV, NEF, NEI, NGF, NGI, NO_REG, NONE, NOT, RIC_instr::op1_reg, RIC_instr::op2_reg, RIC_instr::op_code, OR, PRO, PSH, RIC_instr::result_reg, RL, RTN, SBF, SBI, SHF, SHI, RIC_instr::side_effect, SK, STI, STSZ, T2, TAR, TFB, TFE, TL, TRU, TRUE, and UDC.
Referenced by main(), and propagate().
void write_block | ( | ) |
Definition at line 96 of file filter.c.
References RIC_instr::arg, RIC_instr::label, RIC_instr::label_arg, RIC_instr::next_instr, RIC_instr::op_code, and RIC_nil.
Referenced by main().
RICp arg_instrs[3] |
long const_arg_table[3] |