#include "defs.h"#include "opcode_core.h"#include "errors.h"#include "opcode_gen.h"

Go to the source code of this file.
Defines | |
| #define | opcode_INCLUDED "opcode.h" |
| #define | OPCODE_make_op_MACRO(opr, rtype, desc) ((OPCODE) ((opr) | ((rtype) << 8) | ((desc) << 13))) |
Functions | |
| const char * | OPERATOR_name (OPERATOR) |
| OPERATOR | Name_To_OPERATOR (const char *nm) |
| OPCODE | OPCODE_commutative_op (OPCODE op) |
| void | Init_Operator_To_Opcode_Table (void) |
| OPCODE | OPCODE_make_op (OPERATOR opr, TYPE_ID rtype, TYPE_ID desc) |
Variables | |
| BOOL | Operator_To_Opcode_Table_Inited |
| #define opcode_INCLUDED "opcode.h" |
Opcodes, Opcode Types, and Opcode Flags ---------------------------------------
Description:
This file includes opcode_core.h (see the interface there) and provides some accessing functions to the data. It is split like this because the accessors call FmtAssert() and other routines that non-compiler passes might want to avoid.
This file should be updated whenever opcode_gen is updated. opcode_gen is a perl file that is somewhat readable -- if the comments get out of date here, one can always look there (and bring them up to date).
Exported Functions:
OPCODE OPCODE_make_op( OPERATOR opr, TYPE_ID rtype, TYPE_ID desc )
Given the operator, rtype and desc type, return the opcode. The opr, rtype and desc MUST map to a valid OPCODE. Otherwise, the compilation terminates with an internal error.
const char *OPCODE_name(OPCODE op)
Returns a string representation of the opcode.
const char *OPERATOR_name(OPERATOR opr)
Returns a string representation of the operator.
The remaining exported functions are actually not declared in this file but in the automatically generated include files.
mINT8 OPCODE_nkids(OPCODE op)
Returns the number of kids this opcode must have, or -1 if not fixed, i.e. call, array, return.
The following exported functions return 0 if the opcode does not have the stated property. Otherwise, the value returned is non-zero.
UINT32 OPCODE_is_scf(OPCODE op)
Opcode is OPR_FUNC_ENTRY, OPR_BLOCK, OPR_DO_LOOP, OPR_DO_WHILE, OPR_WHILE_DO, OPR_IF.
UINT32 OPCODE_is_stmt(OPCODE op)
Opcode occurs at top of an expression tree, e.g. a store, call, goto, pragma, etc. No structured control flow falls in this category.
UINT32 OPCODE_is_expression(OPCODE op)
Opcode occurs underneath a statement, e.g. OPR_DADD.
UINT32 OPCODE_is_leaf(OPCODE op)
Opcode is an expression or statement that never has children. Note that OPR_RETURN is not a leaf, since it may have children.
UINT32 OPCODE_is_load(OPCODE op) UINT32 OPCODE_is_store(OPCODE op)
Opocde gets memory, e.g. ILOAD, MLOAD, LDID, etc (or store) Goto, branch, label, altentry
UINT32 OPCODE_is_call(OPCODE op)
Intrinsic call or regular, but not an intrinsic op.
UINT32 OPCODE_is_compare(OPCODE op)
Comparison, e.g. GE
UINT32 OPCODE_is_non_scf(OPCODE op)
Opcode directly relates to control flow, but is not structured. Goto, branch, label, altentry
UINT32 OPCODE_is_boolean(OPCODE op)
Boolean return value, e.g. a comparison.
UINT32 OPCODE_is_endsbb(OPCODE op)
Call, a goto, branch, call, return.
UINT32 OPCODE_is_comp_unit_if(OPCODE op)
Compilation unit interface, e.g. REGION
UINT32 OPCODE_is_not_executable(OPCODE op)
Currently PRAGMA, COMMENT, LABEL and OPT_ opcodes.
UINT32 OPCODE_is_prefetcn(OPCODE op)
Obvious.
OPCODE OPCODE_commutative_op(OPCODE op)
Return an opcode op1 such that x op y is y op1 x. If none exists, return (OPCODE) 0.
The following exported functions describe qualities of the WN that has this opcode. E.g. OPCODE_has_sym(op) indicates that a WN holding this opcode also holds an ST_IDX.
UINT32 OPCODE_has_next_prev(OPCODE op) UINT32 OPCODE_has_sym(OPCODE op) UINT32 OPCODE_has_label(OPCODE op) UINT32 OPCODE_has_num_entries(OPCODE op) UINT32 OPCODE_has_offset(OPCODE op) UINT32 OPCODE_has_bits(OPCODE op) UINT32 OPCODE_has_ndim(OPCODE op) UINT32 OPCODE_has_esize(OPCODE op) UINT32 OPCODE_has_value(OPCODE op) UINT32 OPCODE_has_flags(OPCODE op) UINT32 OPCODE_has_inumber(OPCODE op) UINT32 OPCODE_has_1ty(OPCODE op) UINT32 OPCODE_has_2ty(OPCODE op)
The 'has' fields indicate which fields of a WN are used.
OPCODE_MAPCAT OPCODE_mapcat(OPCODE op)
Annotation category of an opcode. Current values are OPCODE_MAPCAT_{HDR,SCF,LDST,PRAGMA,OSTMT,OEXP,ARRAY,CALL}.
| #define OPCODE_make_op_MACRO | ( | opr, | |||
| rtype, | |||||
| desc | ) | ((OPCODE) ((opr) | ((rtype) << 8) | ((desc) << 13))) |
Definition at line 205 of file opcode.h.
Referenced by OPCODE_make_op().
| void Init_Operator_To_Opcode_Table | ( | void | ) |
Definition at line 73 of file opcode.cxx.
References Operator_To_Opcode_Table_Inited, and TRUE.
Referenced by main().
| OPERATOR Name_To_OPERATOR | ( | const char * | nm | ) |
Definition at line 59 of file opcode.cxx.
References ir_a2b::MapStrToEnum(), OPERATOR_info, and OPERATOR_LAST.

Definition at line 89 of file opcode.cxx.
References OPCODE_desc(), OPCODE_make_op(), OPCODE_operator(), OPCODE_rtype(), OPR_ADD, OPR_BAND, OPR_BIOR, OPR_BNOR, OPR_BXOR, OPR_EQ, OPR_GE, OPR_GT, OPR_LAND, OPR_LE, OPR_LIOR, OPR_LT, OPR_MAX, OPR_MIN, OPR_MPY, and OPR_NE.
Referenced by cancel_in_relop(), simp_relop(), and SIMPNODE_SimplifyExp2_h().

Definition at line 223 of file opcode.h.
References Is_True, Is_Valid_Opcode, OPCODE_make_op_MACRO, and ret.
Referenced by arrsection_to_array(), cancel_in_relop(), cwh_addr_do_bounds_check(), cwh_convert_to_ty(), cwh_do_tranformational(), cwh_dope_from_expression(), cwh_expr_bincalc(), cwh_inline_allocate(), cwh_io_conv_array_to_dope(), cwh_io_conv_arrsection_to_dope(), cwh_io_split_io_items(), cwh_make_typed_opcode(), cwh_stmt_call_helper(), DRA_EC_Array_Portion_Parms(), DRA_Insert_Pragmas(), F90_Wrap_ARREXP(), fei_addr(), fei_allocate(), fei_array_construct(), fei_doloop(), fei_dv_deref(), fei_field_dot(), fei_interface(), fei_matmul(), fei_mvbits(), fei_namelist(), fei_noio_implied_do(), fei_nullify(), fei_present(), fei_use(), Fill_Align_Symbol(), Gen_Call_Array(), Gen_Free_Cart(), Gen_Malloc_Cart(), get_inverse_relop(), Insert_Alloca(), IPL_EX_Collapse_Trip_Counts(), IPL_EX_New_Expr_Expr(), IPL_EX_New_Value_Expr(), IPL_EXS_Outer_Fold(), Make_Reduction_Identity(), MemCtr_Add_Common(), MemCtr_Add_Global(), MemCtr_Add_Local(), Need_type_conversion(), OPCODE_commutative_op(), Rewrite_Pragmas_On_Structs(), Rewrite_Structs_In_MPRegion(), simp_cvt(), simp_eq_neq(), simp_not(), simp_relop(), SIMPNODE_SimplifyExp2_h(), SIMPNODE_SimplifyExp3(), WN2C_create_ref_param_lda(), WN2F_Initiate_OneInt(), WN2F_Initiate_ZeroInt(), WN_Create(), WN_Create_Generic(), WN_Create_Intrinsic(), WN_CreateComma(), WN_CreateConst(), WN_CreateCvtl(), WN_CreateExp1(), WN_CreateExp2(), WN_CreateExp3(), WN_CreateIlda(), WN_CreateIload(), WN_CreateIloadx(), WN_CreateIntconst(), WN_CreateIstore(), WN_CreateIstorex(), WN_CreateLda(), WN_CreateLdid(), WN_CreateParm(), WN_CreatePStid(), WN_CreatePstore(), WN_CreateRcomma(), WN_CreateStid(), WN_Flip_Le_And_Ge(), wn_loop_reverse_compare(), WN_LOOP_TripCount(), WN_opcode(), WN_Solve_For(), and WN_Upper_Bound_Standardize().
| const char* OPERATOR_name | ( | OPERATOR | opr | ) |
Convert between operator name and string
Definition at line 52 of file opcode.cxx.
References INT, ir_a2b::MapEnumToStr(), OPERATOR_info, and OPERATOR_LAST.
Referenced by WN2F_Translate_DoLoop_Bound(), WN_has_side_effects(), and WN_set_st_addr_saved().

To make this lookup routine routine simple but efficient, we use a closed hashing scheme.
Definition at line 72 of file opcode.cxx.
Referenced by Init_Operator_To_Opcode_Table().
1.6.1