#include "workaround.h"#include "opcode_core.h"#include "messg.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) << 14))) |
Functions/Subroutines | |
| const char * | OPERATOR_name (OPERATOR) |
| 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) << 14))) |
Definition at line 69 of file opcode.cxx.
References Operator_To_Opcode_Table_Inited, and TRUE.
Referenced by Init_inline(), ipa_dot_so_init(), and main().
Definition at line 85 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, OPR_NE, rop, and TYPE_ID.
Referenced by VN_BINARY_EXPR::_canonicalize(), cancel_in_relop(), CODEMAP::Hash_op_and_canon(), EXP_WORKLST::Is_the_same_as(), CODEREP::Match(), COPYPROP::Propagatable_thru_phis(), simp_relop(), and SIMPNODE_SimplifyExp2_h().
Definition at line 239 of file opcode.h.
References Is_True, Is_Valid_Opcode, OPCODE_make_op_MACRO, and ret.
| const char* OPERATOR_name | ( | OPERATOR | opr | ) |
Looks up the name of this operator in the table from opcode_gen.c
Definition at line 55 of file opcode.cxx.
References OPERATOR_info_struct::_name, Is_True, OPERATOR_FIRST, OPERATOR_info, and OPERATOR_LAST.
Referenced by DCE::Add_goto_stmt(), WN_UNROLL::Analyze_body_expr(), ARA_Initialize_Loops(), EMITTER::Compute_use_def_stmt(), OPT_STAB::Convert_black_box(), OPT_STAB::Convert_IO_statement(), GTABLE::Dismantle(), Du_Sanity_Check_Matching_Du(), Du_Sanity_Check_r(), Dump_WN(), OPT_FEEDBACK::Emit_feedback(), FB_Sanity_Check(), Get_symbol_info_for_cvt_io(), RVI::Is_base_lda(), lower_bit_field_id(), lower_field_id(), lower_load_bits(), lower_store_bits(), Mono(), Print_Def_Use(), STMTREP::Print_node(), STMTREP::Print_str(), Promote_Pointer(), FEEDBACK::Query_total_out(), DSE::Set_Required_WN(), Step_Size(), FB_CFG::Walk_WN_statement(), WN2F_Translate_DoLoop_Bound(), WN_has_side_effects(), WN_set_st_addr_saved(), and WN_Tree_Type().
To make this lookup routine routine simple but efficient, we use a closed hashing scheme.
Definition at line 68 of file opcode.cxx.
Referenced by Init_Operator_To_Opcode_Table().
1.5.6