cgbackut.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 1,466 行 · 第 1/4 页

H
1,466
字号
typedef struct stab_ctl         STAB_CTL; // -- state table instance
struct stab_ctl
{   SYMBOL rw;                  // - R/W symbol
    STAB_DEFN *defn;            // - state table definition
    SE* marked_posn;            // - current state in generated code
};

typedef struct obj_init         OBJ_INIT; // - object being init'ed
struct obj_init
{   DTREG_OBJ* reg;             // - object registration
    SE* obj_se;                 // - state entry for that object
    SE* ctor_test;              // - state entry for ctor-test
    STAB_OBJ* defn;             // - components state table
    TYPE obj_type;              // - type of object
    SYMBOL obj_sym;             // - base symbol
    patch_handle patch;         // - patch handle for state
    target_size_t obj_offset;   // - offset from base symbol
    PAD_UNSIGNED
};


typedef struct call_stab        CALL_STAB; // - state-table info for call
struct call_stab
{   CALL_STAB *next;            // - next in ring
    call_handle handle;         // - handle for a call
    SE* se;                     // - current state-table position
    unsigned cd_arg;            // - integral CDTOR arg
    unsigned has_cd_arg :1;     // - "cd_arg" has been defined
    PAD_UNSIGNED
};


typedef struct fn_ctl FN_CTL;
struct fn_ctl                   // FN_CTL -- for each active file in process
{
    unsigned base_labs_cs;      // - stack base: labels (control)
    unsigned base_goto_near;    // - stack base: gotos (near)
    unsigned sym_trans_id;      // - symbol translation id at function start
    unsigned cond_flags;        // - # conditional flags
    unsigned cdtor_val;         // - CDTOR value, when has_cdtor_val is set
    unsigned cond_next;         // - next bit offset for conditional flags
    unsigned try_depth;         // - depth of nested try statements
    SYMBOL return_symbol;       // - return symbol
    SYMBOL this_sym;            // - this symbol
    SYMBOL cdtor_sym;           // - extra cdtor int parm symbol
    SYMBOL func;                // - function being generated
    SYMBOL new_ctor_ptr;        // - points at new'ed item being ctor'ed
    label_handle return_label;  // - return label
    label_handle cdarg_lab;     // - label for CDARG test
    label_handle try_label;     // - label at top of try statement
    call_handle handle;         // - handle for IBRP substitution
    back_handle prof_data;      // - profiling data handle
    SE* state_table_bound;      // - bounding entry in function state table
    SE* pre_init;               // - pos'n before symbol initialization
    SE* fun_sv;                 // - current state entry for function
    SE* ctor_components;        // - start of CTOR component SE.s
    SE* dtor_components;        // - end of dtor components
    SE* ctored_obj;             // - object ctored by current expression
    SE* marked_at_start;        // - marked position at function start
    STAB_OBJ* obj_registration; // - registration for type
    CALL_STAB* expr_calls;      // - calls for current expression
    CGFILE* cgfile;             // - CGFILE for this function

    DT_METHOD dtor_method;      // - current destruction method
    DT_METHOD func_dtor_method; // - function destruction method

    uint deregistered   :1;     // - TRUE ==> function has been de-registered
    uint has_fn_exc     :1;     // - TRUE ==> has function exception spec.
    uint is_ctor        :1;     // - TRUE ==> is a CTOR
    uint is_dtor        :1;     // - TRUE ==> is a DTOR
    uint ctor_complete  :1;     // - TRUE ==> has completed the CTOR'ing
    uint coded_return   :1;     // - TRUE ==> return in user code
    uint has_ctor_test  :1;     // - TRUE ==> function might use CTOR-TEST
    uint has_cdtor_val  :1;     // - TRUE ==> has integral CDTOR argument
    uint temp_dtoring   :1;     // - TRUE ==> temporary DTORING req'd in expr.
    uint ctor_test      :1;     // - TRUE ==> expr. causes CTOR-TEST
    uint dtor_reg_reqd  :1;     // - TRUE ==> dtor registration required
    uint debug_info     :1;     // - TRUE ==> debug info for function
    PAD_UNSIGNED
};

typedef struct                  // CTOR_FLAG_SET -- patch entry for ctor flag
{   patch_handle ph_clr;        // - handle for clr mask
    SE* se;                     // - state entry for CTOR
} CTOR_FLAG_SET;

#define UNDEF_AREL ((target_offset_t)(-1)) // undefined auto-relocation offset


// PROTOTYPES

void AutoRelFree(               // FREE ALL RELOCATIONS
    void )
;
void AutoRelRegister(           // REGISTER A RELOCATION
    SYMBOL sym,                 // - symbol
    target_offset_t* a_off )    // - addr[ offset to be relocated ]
;
void BeGenTsRef(                // GENERATE REFERENCE TO TYPE-SIGNATURE
    TYPE_SIG* ts )              // - type signature
;
TYPE_SIG_ENT* BeTypeSigEnt(     // ALLOCATE A TYPE_SIG_ENT
    TYPE type )                 // - type for signature
;
TYPE_SIG_ENT* BeTypeSigEntsCopy(// MAKE COPY OF TYPE-SIGNATURE entries
    TYPE_SIG_ENT* orig )        // - original entries
;
TYPE_SIG *BeTypeSignature(      // GET TYPE_SIG FOR A TYPE
    TYPE type )                 // - input type
;
void BeGenTypeSigEnts(          // EMIT TYPE_SIG_ENT RING
    TYPE_SIG_ENT* ring )        // - ring of entries
;
void BeGenRttiInfo(             // GENERATE RTTI INFORMATION
    void )
;
void BeGenTypeSignatures(       // GENERATE ALL TYPE SIGNATURES
    void )
;
SE* BlkPosnCurr(                // GET CURRENT BLOCK POSITION
    void )
;
SE* BlkPosnEnclosing(           // GET CURRENT POSITION OF ENCLOSING BLOCK
    void )
;
void BlkPosnPop(                // POP A BLOCK POSITION
    void )
;
void BlkPosnPush(               // PUSH A NEW BLOCK POSITION
    SCOPE scope )               // - defining scope
;
SE* BlkPosnScope(               // GET BLOCK POSITION FOR A SCOPE
    SCOPE scope )               // - scope in question
;
SE* BlkPosnTempBeg(             // GET STARTING POS'N FOR TEMP DTOR'ING
    void )
;
SE* BlkPosnTempBegSet(          // SET STARTING POS'N FOR TEMP DTOR'ING
    SE* se )                    // - starting position
;
SE* BlkPosnTempEnd(             // GET ENDING POS'N FOR TEMP DTOR'ING
    void )
;
SE* BlkPosnTempEndSet(          // SET ENDING POS'N FOR TEMP DTOR'ING
    SE* se )                    // - ending position
;
void BlkPosnTrash(              // TRASH TOP BLOCK POSITION
    void )
;
SE* BlkPosnUpdate(              // UPDATE POSITION IN CURRENT BLOCK
    SE* se )                    // - state entry for current position
;
boolean BlkPosnUseStab(         // TEST IF REALLY USING STATE TABLE IN SCOPE
    void )
;
void CallIndirectPop(           // POP AN INDIRECT CALL ENTRY
    void )
;
SYMBOL CallIndirectPush(        // PUSH SYMBOL FOR INDIRECT CALL
    TYPE type )                 // - expression type
;
void CallIndirectVirtual(       // MARK INDIRECT CALL AS VIRTUAL
    SYMBOL vfunc,               // - the virtual function
    boolean is_virtual,         // - TRUE ==> an actual virtual call
    target_offset_t adj_this,   // - adjustment for "this"
    target_offset_t adj_retn )  // - adjustment for return
;
CALL_STAB* CallStabAlloc(       // ALLOCATE CALL_STAB
    call_handle handle,         // - handle for call
    FN_CTL* fctl )              // - function hosting the call
;
boolean CallStabCdArgGet(       // GET CD-ARG FOR A CALL
    call_handle handle,         // - handle for call
    unsigned *a_cd_arg )        // - addr[ value for CD-ARG ]
;
unsigned CallStabCdArgSet(      // SET CD-ARG FOR A CALL
    call_handle handle,         // - handle for call
    unsigned cd_arg )           // - value for CD-ARG
;
void CallStabFree(              // FREE CALL_STAB
    FN_CTL* fctl,               // - function hosting the call
    CALL_STAB* cstb )           // - call information
;
SE* CallStabStateTablePosn(     // GET STATE-TABLE POSITION AT CALL POINT
    call_handle handle )        // - handle for inline call
;
boolean CallStackTopInlined(    // TEST IF TOP OF CALL STACK IS INLINED
    void )
;
call_handle CallStackPop(       // POP CALL STACK
    void )
;
void CallStackPush(             // PUSH CALL STACK
    SYMBOL func,                // - NULL, or inlined function
    call_handle handle,         // - handle for call
    cg_type cg_retn )           // - cg type of call
;
target_offset_t CallStackRetnAdj( // GET RETURN ADJUSTMENT FOR VIRTUAL CALL
    void )
;
target_offset_t CallStackRetnType( // GET RETURN TYPE FOR CALL
    void )
;
target_offset_t CallStackThisAdj( // GET "THIS" ADJUSTMENT FOR VIRTUAL CALL
    void )
;
call_handle CallStackTopHandle( // GET HANDLE FOR TOP OF CALL STACK
    void )
;
SYMBOL CallStackTopFunction(    // GET FUNCTION FOR TOP OF CALL STACK
    void )
;
cg_name CgAddrSymbol(           // PASS ADDR OF SYMBOL TO CODE GENERATOR
    SYMBOL sym )                // - symbol
;
void CgAssign(                  // EMIT AN ASSIGNMENT
    cg_name lhs,                // - lhs argument
    cg_name rhs,                // - rhs argument
    cg_type type )              // - type for assignment
;
void CgAssignPtr(               // EMIT A POINTER ASSIGNMENT
    cg_name lhs,                // - lhs argument
    cg_name rhs )               // - rhs argument
;
cg_name CgAssignStateVar(       // ASSIGN STATE-VAR VALUE
    SYMBOL blk,                 // - R/W Block
    SE* se,                     // - state entry
    target_offset_t offset )    // - offset of state variable
;
CALL_STAB* CgBackCallGened(     // SETUP FOR GENERATED CALL
    call_handle handle )        // - call handle
;
FN_CTL* CgBackFnCtlFini(        // COMPLETE FN_CTL WITH CGBKMAIN INFO
    FN_CTL* fctl )              // - current file information
;
FN_CTL* CgBackFnCtlInit(        // INITIALIZE FN_CTL WITH CGBKMAIN INFO
    FN_CTL* fctl )              // - current file information
;
unsigned CgBackInlinedDepth(    // GET CURRENT INLINED DEPTH
    void )
;
SYMBOL CgBackOpDelete(          // GET ADDRESIBLE OPERATOR DELETE FOR A TYPE
    TYPE type )                 // - the type
;
cg_name CgCallBackAutoCtor(     // SET CALL BACKS FOR A DCL'ED AUTO
    cg_name expr,               // - expression
    cg_type type,               // - type of expression
    SE* se )                    // - state entry for ctored object
;
cg_name CgCallBackCtorDone(     // SET A CALL BACK FOR A CTOR-TEST : DONE
    cg_name expr,               // - expression
    cg_type type,               // - type of expression
    SE* se )                    // - state entry for ctored object
;
cg_name CgCallBackCtorStart(    // SET A CALL BACK FOR A CTOR-TEST : START
    cg_name expr,               // - expression
    cg_type type,               // - type of expression
    SE* se )                    // - state entry to be inserted on call back
;
cg_name CgCallBackInitRefBeg(   // START CALL-BACK FOR INIT-REF
    SE* se )                    // - state entry for init-ref variable
;
cg_name CgCallBackLeft(         // MAKE A LEFT CALL-BACK
    cg_name expr,               // - expression
    void (*fun)( void* ),       // - call-back function
    void* data,                 // - data for call back
    cg_type type )              // - type of expression
;
void CgCallBackNewCtored(       // NEW OBJECT WAS CTOR'ED
    SE* se_del,                 // - state entry for delete during CTOR throw
    FN_CTL* fctl )              // - function information
;
cg_name CgCallBackRight(        // MAKE A RIGHT CALL-BACK
    cg_name expr,               // - expression
    void (*fun)( void* ),       // - call-back function
    void* data,                 // - data for call back
    cg_type type )              // - type of expression
;
cg_name CgCallBackTempCtor(     // SET CALL BACKS FOR TEMP CTORED
    cg_name expr,               // - expression
    cg_type type,               // - type of expression
    SE* se )                    // - state entry to be inserted on call back
;
void CgCdArgDefine(             // DEFINE CDOPT VALUE
    unsigned value )            // - cdopt value
;
void CgCdArgRemove(             // REMOVE CDTOR ENTRY FOR A CALL-HANDLE
    call_handle handle )        // - handle for call
;
void CgCdArgUsed(               // USE A CALL-HANDLE DIRECTLY
    call_handle handle )        // - handle for call
;
SYMBOL CgCmdArrayInit(          // GET SYMBOL FOR DTC_ARRAY_INIT COMMAND
    SE* se )                    // - state entry in state table
;
SYMBOL CgCmdComponent(          // GET SYMBOL FOR DTC_COMP... COMMAND
    SE* se )                    // - state entry in state table
;
SYMBOL CgCmdCtorTest(           // GET SYMBOL FOR CTOR-TEST COMMAND
    SE* se )                    // - state entry
;
SYMBOL CgCmdDel1(               // GET SYMBOL FOR DTC_DEL_1
    SE* se )                    // - state entry in state table
;
SYMBOL CgCmdDel1Array(          // GET SYMBOL FOR DTC_DEL_1
    SE* se )                    // - state entry in state table
;
SYMBOL CgCmdDel2(               // GET SYMBOL FOR DTC_DEL_2
    SE* se )                    // - state entry in state table
;
SYMBOL CgCmdDel2Array(          // GET SYMBOL FOR DTC_DEL_2
    SE* se )                    // - state entry in state table
;
SYMBOL CgCmdFnExc(              // GET SYMBOL FOR FN-EXCEPTION SPEC. COMMAND
    SE* se )                    // - state entry in state table
;
void CgCmdsGenerate(            // GENERATE DTOR CMD.S
    void )
;
SYMBOL CgCmdSetSv(              // GET SYMBOL FOR SET_SV CMD TO BE GEN'ED
    SE* se )                    // - state entry in state table
;
SYMBOL CgCmdTestFlag(           // GET SYMBOL FOR TEST_FLAG CMD TO BE GEN'ED
    SE* se )                    // - state entry in state table
;
SYMBOL CgCmdTry(                // GET SYMBOL FOR TRY BLOCK
    SE* se )                    // - state entry in state table
;
cg_name CgComma(                // CONSTRUCT COMMA EXPRESSION
    cg_name lhs,                // - expression on left
    cg_name rhs,                // - expression on right
    cg_type type )              // - type of right expression
;
void CgCommaBefore(             // EMIT COMMA'ED EXPRESSION BEFORE
    cg_name expr,               // - expression
    cg_type type )              // - type of above expression
;
void CgCommaOptional(           // EMIT OPTIONAL COMMA'ED EXPRESSION
    cg_name expr,               // - expression or NULL
    cg_type type )              // - type of expression
;
void CgCommaWithTopExpr(        // PUSH COMMA'D EXPRESSION WITH TOP EXPR
    cg_name expr,               // - rhs expression
    cg_type type )              // - rhs type
;
void CgControl(                 // CONTROL OPCODE
    cg_op operand,              // - operand
    cg_name expr,               // - expression
    cg_type type,               // - expression type
    label_handle label )        // - label
;
void CgCtorTestTempsRegister(   // REGISTER DTORING TEMPS FOR CTOR
    FN_CTL* fctl )              // - function control
;
SYMBOL CgDeclHiddenParm(        // DECLARE HIDDEN ARG (THIS, CDTOR)
    SCOPE scope,                // - function parameters scope
    TYPE type,                  // - symbol type
    SYMBOL symbol_model,        // - model for symbol
    unsigned specname_index )   // - special name index
;
void CgDeclParms(               // DEFINE ARGS FOR CURRENT FN IN CORRECT ORDER
    FN_CTL *fctl,               // - current function control pointer
    SCOPE scope )               // - argument scope
;
boolean CgDeclSkippableConstObj(// DETERMINE IF SKIPPABLE CONST OBJECT
    SYMBOL sym )                // - symbol
;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?