source: dev/trunk/ab5.0/abdev/compiler_x86/Opcode.h@ 652

Last change on this file since 652 was 603, checked in by dai_9181, 17 years ago

ObjectModuleに関連するクラス一式をab_commonプロジェクトに移動した。

File size: 9.4 KB
RevLine 
[206]1#pragma once
[3]2
[225]3#include "MachineFixed.h"
[206]4
5
[3]6//変数の種類
[62]7#define NON_VAR 0
8#define VAR_GLOBAL 1 // Global Variable
9#define VAR_REFGLOBAL 2 // Global Refference Variable
10#define VAR_LOCAL 3 // Local Variable
11#define VAR_REFLOCAL 4 // Local Refference Variable
12#define VAR_DIRECTMEM 5 // Direct memory
[3]13
[49]14
[3]15extern int cp;
16
[253]17#define breakpoint compiler.codeGenerator.PutOld( (char)0xCC );
[49]18
19
[3]20//プロシージャ
21struct PROCEDURE{
22 char name[255];
23 int address;
24 int types[MAX_PARMS];
25 _int8 ByVal[MAX_PARMS];
26 BOOL ReturnType;
27};
28
29//With情報
30struct WITHINFO{
31 char **ppName;
32 int *pWithCp;
33 int num;
34};
35
36
37//RSrcSection.cpp
38char *GetRSrcSectionBuffer(int *pLen);
39
40//Compile.cpp
[372]41void Compile( const char *source );
[3]42void ChangeOpcode(char *Command);
43void GetGlobalDataForDll(void);
44DWORD CompileBuffer(char Return_Sequence,WORD Return_Command);
45
46//Compile_Calc.cpp
47void ChangeTypeToDouble_ToFpuReg(int OldType);
48void ChangeTypeToDouble(int OldType);
49void ChangeTypeToSingle(int OldType);
50void ChangeTypeToInt64(int OldType);
51void ChangeTypeToLong(int OldType);
52void ChangeTypeToInteger(int OldType);
53void ChangeTypeToByte(int OldType);
[290]54void SetVariableFromEax( const Type &varType, int CalcType,RELATIVE_VAR *pRelativeVar);
[129]55void OpcodeCalc( const char *Command );
[3]56
57//NumOpe.cpp
58void PushReturnValue(int type);
[415]59bool TermOpeOnlyVariable( const char *term, Type &resultType, RELATIVE_VAR &relativeVar, bool isWriteAccess );
[128]60bool TermOpe(
61 const char *term,
62 const Type &baseType,
63 Type &resultType,
64 bool &isLiteral,
[435]65 bool &isNeedHeapFreeStructure,
[128]66 bool *pIsClassName = NULL,
[415]67 bool isProcedureCallOnly = false,
68 bool isWriteAccess = false );
[97]69bool NumOpe( int reg,
70 const char *expression,
71 const Type &baseType,
72 Type &resultType,
[436]73 bool *pbIsNeedHeapFreeStructure = NULL );
[75]74bool NumOpe( const char *Command,
75 const Type &baseType,
76 Type &resultType,
[436]77 bool *pbIsNeedHeapFreeStructure = NULL );
[3]78
79//NumOpe_Arithmetic.cpp
80void GetStackData_ToRegister(int *type,int sp);
81BOOL CalcTwoTerm_Arithmetic(int idCalc,int *type,LONG_PTR *index_stack,int *pStackPointer);
82BOOL Calc_Mod(int *type,int *pStackPointer);
83BOOL Calc_Divide(int *type,int *pStackPointer,int BaseType);
84BOOL Calc_IntDivide(int *type,LONG_PTR *index_stack,int *pStackPointer);
85BOOL Calc_MinusMark(int *type,int sp);
86BOOL Calc_Power(int *type,int *pStackPointer);
87BOOL Calc_Cast(int *type,LONG_PTR *index_stack,int *pStackPointer);
88BOOL Calc_SHL(int *type,int *pStackPointer);
89BOOL Calc_SHR(int *type,int *pStackPointer);
90
91//NumOpe_Logical.cpp
92BOOL Calc_Xor(int *type,LONG_PTR *index_stack,int *pStackPointer);
93BOOL Calc_Or(int *type,LONG_PTR *index_stack,int *pStackPointer);
94BOOL Calc_And(int *type,LONG_PTR *index_stack,int *pStackPointer);
95BOOL Calc_Not(int *type,int sp);
96
97//NumOpe_Relation.cpp
98BOOL Calc_Relation_PE(int *type_stack,LONG_PTR *index_stack,int *pStackPointer);
99BOOL Calc_Relation_QE(int *type_stack,LONG_PTR *index_stack,int *pStackPointer);
100BOOL Calc_Relation_P(int *type_stack,LONG_PTR *index_stack,int *pStackPointer);
101BOOL Calc_Relation_Q(int *type_stack,LONG_PTR *index_stack,int *pStackPointer);
102BOOL Calc_Relation_NotEqual(int *type,int *pStackPointer);
103BOOL Calc_Relation_Equal(int *type,int *pStackPointer);
104
105//NumOpe_TypeOperation.cpp
[290]106void ExtendStackTo64( const Type &oldType );
107void ChangeTypeToWhole( const Type &oldType, const Type &newType );
[3]108
109//Compile_Set_Var.cpp
110BOOL IsUse_ecx(RELATIVE_VAR *pRelativeVar);
[75]111void SetStructVariable( const Type &varType, const Type &calcType, BOOL bUseHeap);
[64]112void SetRealVariable(int VarType, int CalcType, RELATIVE_VAR *pRelativeVar);
[66]113void SetWholeVariable( int varSize,int calcType, RELATIVE_VAR *pRelative );
[64]114
[3]115void SetDoubleVariable(int type,DWORD VarKind,DWORD offset,BOOL bOffsetOffset);
116void SetSingleVariable(int type,DWORD VarKind,DWORD offset,BOOL bOffsetOffset);
117void SetInt64Variable(int type,RELATIVE_VAR *pRelative);
118void SetDWordVariable(int type,DWORD VarKind,DWORD offset,BOOL bOffsetOffset);
119void SetLongVariable(int type,DWORD VarKind,DWORD offset,BOOL bOffsetOffset);
120void Set16Variable(int type,DWORD VarKind,DWORD offset,BOOL bOffsetOffset);
121void Set8Variable(int type,DWORD VarKind,DWORD offset,BOOL bOffsetOffset);
[36]122void SetBooleanVariable(int type,RELATIVE_VAR *pRelative);
[97]123void ExtendTypeTo64(int type);
124void ExtendTypeTo32(int type,int reg);
125void ExtendTypeTo16(int type,int reg);
[3]126
127//increment.cpp
[129]128void IncDec(int idCalc, const char *lpszLeft, const char *lpszRight);
[3]129
130//calc2.cpp
131#define EXP_TYPE_NUMBER 1
132#define EXP_TYPE_EAX 2
133#define EXP_TYPE_FPU 3
134#define EXP_TYPE_VAR 4
135int NumOpEx(char *Command,double *pDbl,DWORD *pdwType,RELATIVE_VAR *pRelativeVar);
136
137//SetVar.cpp
138BOOL SetVariable(DWORD dwVarType,RELATIVE_VAR *pVarRelativeVar,
139 DWORD dwExpType,DWORD dwType,void *data);
140
141//Compile_Calc_PushVar.cpp
142void SetReg_RealVariable(int type,RELATIVE_VAR *pRelativeVar);
[308]143void SetReg_WholeVariable( const Type &type, RELATIVE_VAR *pRelativeVar,int reg, bool is64Head = false);
[3]144void PushLongVariable(RELATIVE_VAR *pRelativeVar);
145
146//Compile_Object.cpp
[75]147void Operator_New( const CClass &classObj, const char *objectSizeStr, const char *parameter, const Type &baseType );
[64]148void OpcodeDelete(const char *Parameter, bool isSweeping);
[3]149
150//Compile_Var.cpp
[66]151void SetRelativeOffset( RELATIVE_VAR &relativeVar );
[290]152bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const Type &classType, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess);
[3]153void SetThisPtrToReg(int reg);
[206]154bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts = NULL );
155bool SetInitGlobalData(int offset,const Type &type,const Subscripts &subscripts,const char *InitBuf);
[8]156#define DIMFLAG_INITDEBUGVAR 1
157#define DIMFLAG_NONCALL_CONSTRACTOR 2
158#define DIMFLAG_STATIC 4
159#define DIMFLAG_CONST 8
[299]160void dim( char *VarName, const Subscripts &subscripts, const Type &type, const char *InitBuf,const char *ConstractParameter,DWORD dwFlags);
[3]161void SetVarPtrToEax(RELATIVE_VAR *pRelativeVar);
[97]162void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar);
[95]163bool Compile_AddGlobalRootsForGc();
[3]164
[71]165//ParamImpl.cpp
166class ParamImpl{
[3]167 char *Parms[255];
[376]168 Types types;
[3]169 int ParmsNum;
170
[292]171 Type leftType;
[76]172 Type returnType;
[3]173
[20]174 //一時オブジェクト管理用
175 bool useTempObject;
176 bool useTempParameters[255];
[436]177 bool isNeedFreeStructures[255];
[20]178 int nCountOfTempObjects;
179
[3]180public:
[71]181 ParamImpl(const char *buffer);
[75]182 ParamImpl(const Parameters &params);
[71]183 ~ParamImpl();
[292]184 void SetLeftType( const Type &type )
185 {
186 this->leftType = type;
187 }
[75]188 void SetReturnType( const Type &returnType );
[3]189
190private:
[424]191 bool EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType, const Type &leftType, const UserProc &userProc, bool &isErrored );
[3]192public:
[424]193 const UserProc *_OverloadSolution( const char *name, std::vector<const UserProc *> &subs, const Type &leftType, bool isEnabledReturnType );
194 const UserProc *OverloadSolution( const char *name, std::vector<const UserProc *> &subs, const Type &leftType, bool isEnabledReturnType = false );
[3]195
[77]196 void ApplyDefaultParameters( const Parameters &params );
[523]197 bool ErrorCheck( const std::string &procName, const Parameters &params, int SecondParmNum = -1 );
[73]198 void MacroParameterSupport( const Parameters &params );
[76]199 void SetStructParameter( const Type &baseType, const char *expression );
[523]200 int SetParameter( const std::string &procName, const Parameters &params, int SecondParmNum = -1, const UserProc *pUserProc = NULL );
[20]201
202 //一時オブジェクトパラメータの生成と破棄
[523]203 int NewTempParameters( const std::string &procName, const Parameters &params, int SecondParmNum = -1 );
[20]204 void DeleteTempParameters();
[3]205};
206
207//Compile_CallProc.cpp
208#define PROCFLAG_NEW 1
[76]209bool Opcode_CallProcPtr( const char *variable, const char *lpszParms,ProcPointer *pProcPointer);
[290]210bool Opcode_CallProc(const char *Parameter,const UserProc *pUserProc,DWORD dwFlags,const char *ObjectName );
[250]211bool Opcode_CallDllProc( const char *lpszParms, const DllProc *pDllProc );
[325]212void Opcode_CallDelegate( const Delegate &dg, const char *methodPtrValueStr, const char *objPtrValueStr, const char *params );
[3]213
214//Compile_ProcOp.cpp
[316]215void _compile_proc(const UserProc *pUserProc);
[3]216
217//Compile_Func.cpp
218int GetFunctionFromName(char *FuncName);
[331]219bool Opcode_CallFunc( const char *Parameter, const int FuncNum, const Type &baseType, Type &resultType, bool isCallOn = true );
[3]220
221//OperatorProc.cpp
[76]222void FreeTempObject(int reg,const CClass *pobj_c);
[435]223int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack, LONG_PTR *index_stack,bool isNeedHeapFreeStructureStack[],int &sp);
[75]224void CallCastOperatorProc(Type &calcType,BOOL bCalcUseHeap,const Type &toType);
[334]225void CallIndexerGetterProc( const Type &classType, const char *ObjectName, char *Parameter,Type &resultType, DWORD dwProcFlags = 0 );
[3]226
227//Compile_Statement.cpp
[129]228void OpcodeOthers( const char *Command );
[3]229void OpcodeIf(char *Parameter);
230void OpcodeGoto(char *Parameter);
231void OpcodeWhile(char *Parameter);
232void OpcodeFor(char *Parameter);
[372]233void OpcodeForeach( const char *Parameter );
[3]234void OpcodeDo(char *Parameter);
235void OpcodeContinue(void);
236void OpcodeExitSub(void);
[76]237void OpcodeSelect(const char *lpszParms);
[3]238void OpcodeCase(char *Parameter);
239void OpcodeGosub(char *Parameter);
240void OpcodeReturn(char *Parameter);
241void OpcodeSetPtrData(char *Parameter,int type);
242
243
244
245
246//op32_main.cpp
247BOOL IsSafeReg(int reg);
Note: See TracBrowser for help on using the repository browser.