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

Last change on this file since 523 was 523, checked in by dai_9181, 16 years ago

ヘッダファイルを整理中

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