| 1 | //Opcode.h | 
|---|
| 2 |  | 
|---|
| 3 |  | 
|---|
| 4 | //レジスタを示す定数 | 
|---|
| 5 | #define REG_EAX 1 | 
|---|
| 6 | #define REG_EBX 2 | 
|---|
| 7 | #define REG_ECX 3 | 
|---|
| 8 | #define REG_EDX 4 | 
|---|
| 9 | #define REG_ESP 5 | 
|---|
| 10 | #define REG_EBP 6 | 
|---|
| 11 |  | 
|---|
| 12 | #define REGISTER_OPERAND(reg) (reg&0x07) | 
|---|
| 13 |  | 
|---|
| 14 | #define REG_NON     -1 | 
|---|
| 15 | #define REG_RAX     0x00    //reg:000 | 
|---|
| 16 | #define REG_RCX     0x01    //reg:001 | 
|---|
| 17 | #define REG_RDX     0x02    //reg:010 | 
|---|
| 18 | #define REG_RBX     0x03    //reg:011 | 
|---|
| 19 | #define REG_RSP     0x04    //reg:100 | 
|---|
| 20 | #define REG_RBP     0x05    //reg:101 | 
|---|
| 21 | #define REG_RSI     0x06    //reg:110 | 
|---|
| 22 | #define REG_RDI     0x07    //reg:111 | 
|---|
| 23 | #define REG_R8      0x08    //reg:000(REXプリフィックス) | 
|---|
| 24 | #define REG_R9      0x09    //reg:001(REXプリフィックス) | 
|---|
| 25 | #define REG_R10     0x0A    //reg:010(REXプリフィックス) | 
|---|
| 26 | #define REG_R11     0x0B    //reg:011(REXプリフィックス) | 
|---|
| 27 | #define REG_R12     0x0C    //reg:100(REXプリフィックス) | 
|---|
| 28 | #define REG_R13     0x0D    //reg:101(REXプリフィックス) | 
|---|
| 29 | #define REG_R14     0x0E    //reg:110(REXプリフィックス) | 
|---|
| 30 | #define REG_R15     0x0F    //reg:111(REXプリフィックス) | 
|---|
| 31 |  | 
|---|
| 32 | #define REG_XMM0    0x10    //reg:000 | 
|---|
| 33 | #define REG_XMM1    0x11    //reg:001 | 
|---|
| 34 | #define REG_XMM2    0x12    //reg:010 | 
|---|
| 35 | #define REG_XMM3    0x13    //reg:011 | 
|---|
| 36 | #define REG_XMM4    0x14    //reg:100 | 
|---|
| 37 | #define REG_XMM5    0x15    //reg:101 | 
|---|
| 38 | #define REG_XMM6    0x16    //reg:110 | 
|---|
| 39 | #define REG_XMM7    0x17    //reg:111 | 
|---|
| 40 | #define REG_XMM8    0x18    //reg:000 | 
|---|
| 41 | #define REG_XMM9    0x19    //reg:001 | 
|---|
| 42 | #define REG_XMM10   0x1A    //reg:010 | 
|---|
| 43 | #define REG_XMM11   0x1B    //reg:011 | 
|---|
| 44 | #define REG_XMM12   0x1C    //reg:100 | 
|---|
| 45 | #define REG_XMM13   0x1D    //reg:101 | 
|---|
| 46 | #define REG_XMM14   0x1E    //reg:110 | 
|---|
| 47 | #define REG_XMM15   0x1F    //reg:111 | 
|---|
| 48 |  | 
|---|
| 49 | #define IS_XMM_REG(reg) (reg&0x10) | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 | //変数の種類 | 
|---|
| 54 | #define NON_VAR         0 | 
|---|
| 55 | #define VAR_GLOBAL      1   //Global Variable | 
|---|
| 56 | #define VAR_LOCAL       2   //Local Variable | 
|---|
| 57 | #define VAR_REFLOCAL    3   //Local Refference Variable | 
|---|
| 58 | #define VAR_DIRECTMEM   4   //Direct memory | 
|---|
| 59 |  | 
|---|
| 60 | extern int cp; | 
|---|
| 61 | extern int obp; | 
|---|
| 62 | extern char *OpBuffer; | 
|---|
| 63 |  | 
|---|
| 64 | //ラベルアドレス | 
|---|
| 65 | struct LABEL{ | 
|---|
| 66 | char *pName; | 
|---|
| 67 | int line; | 
|---|
| 68 | DWORD address; | 
|---|
| 69 | }; | 
|---|
| 70 |  | 
|---|
| 71 | //Goto未知ラベル | 
|---|
| 72 | struct GOTOLABELSCHEDULE{ | 
|---|
| 73 | char *pName; | 
|---|
| 74 | int line; | 
|---|
| 75 | DWORD pos; | 
|---|
| 76 | DWORD now_cp; | 
|---|
| 77 | }; | 
|---|
| 78 |  | 
|---|
| 79 |  | 
|---|
| 80 | //プロシージャの種類 | 
|---|
| 81 | #define PROC_DEFAULT    1   //ユーザー定義関数 | 
|---|
| 82 | #define PROC_DLL        2   //DLL関数 | 
|---|
| 83 | #define PROC_BUILTIN    3   //コンパイラ埋め込み型 | 
|---|
| 84 | #define PROC_PTR        4   //関数ポインタ | 
|---|
| 85 |  | 
|---|
| 86 | //プロシージャ | 
|---|
| 87 | struct PROCEDURE{ | 
|---|
| 88 | char name[255]; | 
|---|
| 89 | int address; | 
|---|
| 90 | int types[MAX_PARMS]; | 
|---|
| 91 | _int8 ByVal[MAX_PARMS]; | 
|---|
| 92 | BOOL ReturnType; | 
|---|
| 93 | }; | 
|---|
| 94 |  | 
|---|
| 95 | //With情報 | 
|---|
| 96 | struct WITHINFO{ | 
|---|
| 97 | char **ppName; | 
|---|
| 98 | int *pWithCp; | 
|---|
| 99 | int num; | 
|---|
| 100 | }; | 
|---|
| 101 |  | 
|---|
| 102 |  | 
|---|
| 103 | class CStackFrame:public CSchedule{ | 
|---|
| 104 | /////////////////////////// | 
|---|
| 105 | // スタックフレーム管理 | 
|---|
| 106 | /////////////////////////// | 
|---|
| 107 |  | 
|---|
| 108 | int lowest_sp;          //スタックポインタの最下位位置 | 
|---|
| 109 | int now_sp;             //スタックポインタ | 
|---|
| 110 | int max_parm_size;      //パラメータの最大サイズ | 
|---|
| 111 | int local_parm_size;    //ローカル領域のパラメータサイズ | 
|---|
| 112 |  | 
|---|
| 113 | public: | 
|---|
| 114 | //コンストラクタ | 
|---|
| 115 | CStackFrame(); | 
|---|
| 116 |  | 
|---|
| 117 | //デストラクタ | 
|---|
| 118 | ~CStackFrame(); | 
|---|
| 119 |  | 
|---|
| 120 | void SetLocalParmSize(int size); | 
|---|
| 121 | int GetFrameSize(); | 
|---|
| 122 | void push(int reg); | 
|---|
| 123 | void push(int xmm_reg,int var_size); | 
|---|
| 124 | void ref(int reg); | 
|---|
| 125 | void ref(int xmm_reg,int var_size); | 
|---|
| 126 | void pop(int reg); | 
|---|
| 127 | void pop(int xmm_reg,int var_size); | 
|---|
| 128 | void parameter_allocate(int size); | 
|---|
| 129 | void RunningSchedule(void); | 
|---|
| 130 |  | 
|---|
| 131 | void error_check(void); | 
|---|
| 132 | }; | 
|---|
| 133 | extern CStackFrame *pobj_sf; | 
|---|
| 134 |  | 
|---|
| 135 |  | 
|---|
| 136 | class CBlockReg{ | 
|---|
| 137 | int array_BlockReg[256]; | 
|---|
| 138 | int num; | 
|---|
| 139 |  | 
|---|
| 140 | public: | 
|---|
| 141 | CBlockReg(); | 
|---|
| 142 | void lock(int reg); | 
|---|
| 143 | void unlock(int reg); | 
|---|
| 144 | BOOL check(int reg); | 
|---|
| 145 | void clear(void); | 
|---|
| 146 |  | 
|---|
| 147 | //レジスタのバックアップと復旧 | 
|---|
| 148 | void backup(); | 
|---|
| 149 | void restore(); | 
|---|
| 150 | }; | 
|---|
| 151 | extern CBlockReg *pobj_BlockReg; | 
|---|
| 152 | class CRegister{ | 
|---|
| 153 | //////////////////// | 
|---|
| 154 | // レジスタ管理 | 
|---|
| 155 | //////////////////// | 
|---|
| 156 |  | 
|---|
| 157 | //利用可能なレジスタを列挙する関数 | 
|---|
| 158 | void EnumRegister(int *pRegList,int nMaxList,int *array_reg,int *sp,int AnswerReg); | 
|---|
| 159 |  | 
|---|
| 160 | int array_UseReg[16],sp_UseReg; | 
|---|
| 161 |  | 
|---|
| 162 | int array_XmmReg[16]; | 
|---|
| 163 | int sp_XmmReg; | 
|---|
| 164 |  | 
|---|
| 165 | int init_sp_reg,init_sp_xmm_reg; | 
|---|
| 166 |  | 
|---|
| 167 | public: | 
|---|
| 168 | CRegister(){}; | 
|---|
| 169 | CRegister(int AnswerReg); | 
|---|
| 170 | ~CRegister(){}; | 
|---|
| 171 |  | 
|---|
| 172 | //コンパイラにバグがないかをチェックする機構 | 
|---|
| 173 | void bug_check(); | 
|---|
| 174 |  | 
|---|
| 175 | //汎用レジスタ | 
|---|
| 176 | int GetNextReg(); | 
|---|
| 177 | int GetLockingReg(); | 
|---|
| 178 | int LockReg(); | 
|---|
| 179 | int UnlockReg(); | 
|---|
| 180 |  | 
|---|
| 181 | //XMMレジスタ | 
|---|
| 182 | int GetNextXmmReg(); | 
|---|
| 183 | int GetLockingXmmReg(); | 
|---|
| 184 | int LockXmmReg(); | 
|---|
| 185 | int UnlockXmmReg(); | 
|---|
| 186 |  | 
|---|
| 187 | //レジスタのバックアップと復旧 | 
|---|
| 188 | void backup(); | 
|---|
| 189 | void restore(); | 
|---|
| 190 | }; | 
|---|
| 191 | extern CRegister *pobj_reg; | 
|---|
| 192 |  | 
|---|
| 193 |  | 
|---|
| 194 | #define BACKUP_REGISTER_RESOURCE                                \ | 
|---|
| 195 | /* レジスタをスタックフレームにバックアップ */              \ | 
|---|
| 196 | pobj_BlockReg->backup();                                    \ | 
|---|
| 197 | if(pobj_reg) pobj_reg->backup();                            \ | 
|---|
| 198 | \ | 
|---|
| 199 | /* レジスタブロッキングオブジェクトを退避して再生成 */      \ | 
|---|
| 200 | CBlockReg *pobj_BlockReg_back;                              \ | 
|---|
| 201 | pobj_BlockReg_back=pobj_BlockReg;                           \ | 
|---|
| 202 | pobj_BlockReg=new CBlockReg;                                \ | 
|---|
| 203 | \ | 
|---|
| 204 | /* レジスタ管理オブジェクトポインタを退避して0をセット */    \ | 
|---|
| 205 | CRegister *pobj_reg_back;                                   \ | 
|---|
| 206 | pobj_reg_back=pobj_reg;                                     \ | 
|---|
| 207 | pobj_reg=0; | 
|---|
| 208 |  | 
|---|
| 209 | #define RESTORE_REGISTER_RESOURCE                               \ | 
|---|
| 210 | /* レジスタブロッキングオブジェクトポインタを復元 */       \ | 
|---|
| 211 | delete pobj_BlockReg;                                       \ | 
|---|
| 212 | pobj_BlockReg=pobj_BlockReg_back;                           \ | 
|---|
| 213 | \ | 
|---|
| 214 | /* レジスタ管理オブジェクトポインタを復元 */               \ | 
|---|
| 215 | delete pobj_reg;                                            \ | 
|---|
| 216 | pobj_reg=pobj_reg_back;                                     \ | 
|---|
| 217 | \ | 
|---|
| 218 | /* レジスタをスタックフレームから復元 */                 \ | 
|---|
| 219 | if(pobj_reg) pobj_reg->restore();                           \ | 
|---|
| 220 | pobj_BlockReg->restore(); | 
|---|
| 221 |  | 
|---|
| 222 |  | 
|---|
| 223 |  | 
|---|
| 224 | //MakePeHdr.cpp | 
|---|
| 225 | int AddDataTable(char *buffer,int length); | 
|---|
| 226 |  | 
|---|
| 227 | //RSrcSection.cpp | 
|---|
| 228 | char *GetRSrcSectionBuffer(int *pLen); | 
|---|
| 229 |  | 
|---|
| 230 | //Compile.cpp | 
|---|
| 231 | void ChangeOpcode(char *Command); | 
|---|
| 232 | void GetGlobalDataForDll(void); | 
|---|
| 233 | DWORD CompileBuffer(char Return_Sequence,WORD Return_Command); | 
|---|
| 234 |  | 
|---|
| 235 | //Register.cpp | 
|---|
| 236 | BOOL IsGeneralReg(int reg); | 
|---|
| 237 | BOOL IsXmmReg(int reg); | 
|---|
| 238 | BOOL IsVolatileReg(int reg); | 
|---|
| 239 |  | 
|---|
| 240 | //Compile_Calc.cpp | 
|---|
| 241 | void ChangeTypeToDouble_ToFpuReg(int OldType); | 
|---|
| 242 | void ChangeTypeToDouble(int OldType); | 
|---|
| 243 | void ChangeTypeToSingle(int OldType); | 
|---|
| 244 | void ChangeTypeToInt64(int OldType); | 
|---|
| 245 | void ChangeTypeToLong(int OldType); | 
|---|
| 246 | void ChangeTypeToInteger(int OldType); | 
|---|
| 247 | void ChangeTypeToByte(int OldType); | 
|---|
| 248 | void SetVariableFromRax(int VarType,int CalcType,RELATIVE_VAR *pRelativeVar); | 
|---|
| 249 | void OpcodeCalc(char *Command); | 
|---|
| 250 |  | 
|---|
| 251 | //NumOpe.cpp | 
|---|
| 252 | int NumOpe(int *pReg,const char *Command,int BaseType,LONG_PTR lpBaseIndex,LONG_PTR *plpIndex,BOOL *pbUseHeap=0); | 
|---|
| 253 |  | 
|---|
| 254 | //NumOpe_Arithmetic.cpp | 
|---|
| 255 | void GetStackData_ToRegister(int *type,int sp); | 
|---|
| 256 | BOOL CalcTwoTerm_Arithmetic(int idCalc,int *type,LONG_PTR *index_stack,int *pStackPointer); | 
|---|
| 257 | BOOL Calc_Mod(int *type,LONG_PTR *index_stack,int *pStackPointer); | 
|---|
| 258 | BOOL Calc_Divide(int *type,int *pStackPointer,int BaseType); | 
|---|
| 259 | BOOL Calc_IntDivide(int *type,LONG_PTR *index_stack,int *pStackPointer); | 
|---|
| 260 | BOOL Calc_MinusMark(int *type,int sp); | 
|---|
| 261 | BOOL Calc_Power(int *type,int *pStackPointer); | 
|---|
| 262 | BOOL Calc_Shift(int idCalc,int *type,int *pStackPointer); | 
|---|
| 263 |  | 
|---|
| 264 | //NumOpe_Logical.cpp | 
|---|
| 265 | BOOL CalcTwoTerm_Logical(int idCalc,int *type,LONG_PTR *index_stack,int *pStackPointer); | 
|---|
| 266 | BOOL Calc_Not(int *type,int sp); | 
|---|
| 267 |  | 
|---|
| 268 | //NumOpe_Relation.cpp | 
|---|
| 269 | BOOL CalcTwoTerm_Relational(int idCalc,int *type,LONG_PTR *index_stack,int *pStackPointer); | 
|---|
| 270 |  | 
|---|
| 271 | //NumOpe_TypeOperation.cpp | 
|---|
| 272 | void ExtendTypeTo64(int type,int reg); | 
|---|
| 273 | void ExtendTypeTo32(int type,int reg); | 
|---|
| 274 | void ExtendTypeTo16(int type,int reg); | 
|---|
| 275 | void ChangeTypeToXmm_Double(int type,int xmm_reg,int general_reg); | 
|---|
| 276 | void ChangeTypeToXmm_Single(int type,int xmm_reg,int general_reg); | 
|---|
| 277 | void ChangeTypeToWhole(int OldType,int NewType,int reg,int xmm_reg); | 
|---|
| 278 | void SetOneTermToReg_RealCalc(int TermType,int *pXmmReg); | 
|---|
| 279 | void SetOneTermToReg_Whole64Calc(int TermType,int *pReg); | 
|---|
| 280 | void SetOneTermToReg_Whole32Calc(int TermType,int *pReg); | 
|---|
| 281 | void SetTowTermToReg_RealCalc(int AnswerType,int *type,int sp,int *pXmmReg1,int *pXmmReg2); | 
|---|
| 282 | void SetTowTermToReg_Whole64Calc(int *type,int sp,int *pReg1,int *pReg2); | 
|---|
| 283 | void SetTowTermToReg_Whole32Calc(int *type,int sp,int *pReg1,int *pReg2); | 
|---|
| 284 | BOOL Calc_Cast(int *type,LONG_PTR *index_stack,int *pStackPointer); | 
|---|
| 285 |  | 
|---|
| 286 | //Compile_Set_Var.cpp | 
|---|
| 287 | BOOL IsUse_r11(RELATIVE_VAR *pRelativeVar); | 
|---|
| 288 | void SetObjectVariableFromRax(LONG_PTR lpVarIndex,int CalcType,LONG_PTR lpCalcIndex,RELATIVE_VAR *pRelativeVar,BOOL bUseHeap); | 
|---|
| 289 | void SetDoubleVariable(int type,RELATIVE_VAR *pRelative); | 
|---|
| 290 | void SetSingleVariable(int type,RELATIVE_VAR *pRelative); | 
|---|
| 291 | void SetWholeVariable(int var_size,int type,RELATIVE_VAR *pRelative); | 
|---|
| 292 |  | 
|---|
| 293 | //increment.cpp | 
|---|
| 294 | void IncDec(int idCalc, char *lpszLeft, char *lpszRight); | 
|---|
| 295 |  | 
|---|
| 296 | //calc2.cpp | 
|---|
| 297 | #define EXP_TYPE_NUMBER 1 | 
|---|
| 298 | #define EXP_TYPE_EAX    2 | 
|---|
| 299 | #define EXP_TYPE_FPU    3 | 
|---|
| 300 | #define EXP_TYPE_VAR    4 | 
|---|
| 301 | int NumOpEx(char *Command,double *pDbl,DWORD *pdwType,RELATIVE_VAR *pRelativeVar); | 
|---|
| 302 |  | 
|---|
| 303 | //SetVar.cpp | 
|---|
| 304 | BOOL SetVariable(DWORD dwVarType,RELATIVE_VAR *pVarRelativeVar, | 
|---|
| 305 | DWORD dwExpType,DWORD dwType,void *data); | 
|---|
| 306 |  | 
|---|
| 307 | //Compile_Calc_PushVar.cpp | 
|---|
| 308 | void SetXmmReg_DoubleVariable(RELATIVE_VAR *pRelativeVar,int xmm_reg); | 
|---|
| 309 | void SetXmmReg_SingleVariable(RELATIVE_VAR *pRelativeVar,int xmm_reg); | 
|---|
| 310 | void SetReg_WholeVariable(int type,RELATIVE_VAR *pRelativeVar,int reg); | 
|---|
| 311 |  | 
|---|
| 312 | //Compile_Object.cpp | 
|---|
| 313 | int Operator_New(const char *Parameter,LONG_PTR *plpIndex); | 
|---|
| 314 | void OpcodeDelete(const char *Parameter); | 
|---|
| 315 |  | 
|---|
| 316 | //Compile_Var.cpp | 
|---|
| 317 | void GetWithName(char *buffer); | 
|---|
| 318 | void SetThisPtrToReg(int reg); | 
|---|
| 319 | BOOL GetVarOffset(bool isErrorEnabled,bool isWriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss=0); | 
|---|
| 320 | BOOL SetInitGlobalData(int offset,int type,LONG_PTR lpIndex,int *SubScripts,char *InitBuf); | 
|---|
| 321 | #define DIMFLAG_INITDEBUGVAR            1 | 
|---|
| 322 | #define DIMFLAG_NONCALL_CONSTRACTOR     2 | 
|---|
| 323 | #define DIMFLAG_STATIC                  4 | 
|---|
| 324 | #define DIMFLAG_CONST                   8 | 
|---|
| 325 | void OpcodeDim(char *Parameter,DWORD dwFlag); | 
|---|
| 326 | void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar); | 
|---|
| 327 |  | 
|---|
| 328 | //CParameter.cpp | 
|---|
| 329 | #define OVERLOAD_LEVEL1 1 | 
|---|
| 330 | #define OVERLOAD_LEVEL2 2 | 
|---|
| 331 | #define OVERLOAD_LEVEL3 3 | 
|---|
| 332 | class CParameter{ | 
|---|
| 333 | char *Parms[255]; | 
|---|
| 334 | TYPEINFO types[255]; | 
|---|
| 335 | int ParmsNum; | 
|---|
| 336 |  | 
|---|
| 337 | TYPEINFO ReturnTypeInfo; | 
|---|
| 338 |  | 
|---|
| 339 | public: | 
|---|
| 340 | CParameter(char *buffer); | 
|---|
| 341 | CParameter(PARAMETER_INFO *pParamInfo,int ParmNum); | 
|---|
| 342 | ~CParameter(); | 
|---|
| 343 | void SetReturnType(TYPEINFO *pTypeInfo); | 
|---|
| 344 |  | 
|---|
| 345 | private: | 
|---|
| 346 | BOOL _overload_check(PARAMETER_INFO *ppi,int pi_num,TYPEINFO *pReturnTypeInfo,int overload_level); | 
|---|
| 347 | SUBINFO *OverloadSolutionWithReturnType(char *name,SUBINFO **ppsi,int num); | 
|---|
| 348 | public: | 
|---|
| 349 | SUBINFO *OverloadSolution(char *name,SUBINFO **ppsi,int num); | 
|---|
| 350 |  | 
|---|
| 351 | BOOL ErrorCheck(char *FuncName,PARAMETER_INFO *ppi,int pi_num,int SecondParmNum); | 
|---|
| 352 | void MacroParameterSupport(PARAMETER_INFO *ppi); | 
|---|
| 353 | void SetObjectParameter(int reg,CClass *pobj_Class,LPSTR Parameter); | 
|---|
| 354 | void SetParameter(char *FuncName,PARAMETER_INFO *ppi,int pi_num,int SecondParmNum); | 
|---|
| 355 | void BackupParameter(int pi_num); | 
|---|
| 356 | void RestoreParameter(int pi_num); | 
|---|
| 357 | }; | 
|---|
| 358 |  | 
|---|
| 359 | //CLockParameter.cpp | 
|---|
| 360 | #define MAX_LOCKPARMS 255 | 
|---|
| 361 | class CDBLockParms{ | 
|---|
| 362 | public: | 
|---|
| 363 | int array_LevelCount[MAX_LOCKPARMS]; | 
|---|
| 364 | CDBLockParms(); | 
|---|
| 365 | ~CDBLockParms(); | 
|---|
| 366 |  | 
|---|
| 367 | void lock(int level); | 
|---|
| 368 | void unlock(int level); | 
|---|
| 369 | }; | 
|---|
| 370 |  | 
|---|
| 371 | //Compile_CallProc.cpp | 
|---|
| 372 | void AddLocalVarAddrSchedule(); | 
|---|
| 373 | int CallProc(int idProc,void *pInfo,char *name,char *Parameter,LONG_PTR *plpRetIndex); | 
|---|
| 374 | BOOL CallPropertyMethod(char *variable,char *RightSide,TYPEINFO *pRetTypeInfo); | 
|---|
| 375 | #define PROCFLAG_NEW    1 | 
|---|
| 376 | int Opcode_CallProcPtr(char *variable,char *Parameter,PROCPTRINFO *pi,LONG_PTR *plpIndex); | 
|---|
| 377 | int Opcode_CallProc(char *Parameter,SUBINFO *psi,LONG_PTR *plpIndex,DWORD dwFlags,char *ObjectName,int RefType); | 
|---|
| 378 | int Opcode_CallDllProc(char *Parameter,DECLAREINFO *pdi,LONG_PTR *plpIndex); | 
|---|
| 379 |  | 
|---|
| 380 | //Compile_ProcOp.cpp | 
|---|
| 381 | void CompileLocal(); | 
|---|
| 382 |  | 
|---|
| 383 | //Compile_Func.cpp | 
|---|
| 384 | int GetFunctionType(int FuncNum); | 
|---|
| 385 | int GetFunctionFromName(char *FuncName); | 
|---|
| 386 | int Opcode_CallFunc(char *Parameter,int FuncNum); | 
|---|
| 387 |  | 
|---|
| 388 | //OperatorProc.cpp | 
|---|
| 389 | void FreeTempObject(int reg,CClass *pobj_c); | 
|---|
| 390 | int CallOperatorProc(int idCalc,TYPEINFO *pBaseTypeInfo,int *type,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp); | 
|---|
| 391 | void CallCastOperatorProc(int reg,int &CalcType,LONG_PTR &lpCalcIndex,BOOL bCalcUseHeap,int ToType,LONG_PTR lpToIndex); | 
|---|
| 392 | void CallArrayOperatorProc(int reg,CClass *pobj_Class,char *ObjectName,char *Parameter,TYPEINFO &RetTypeInfo); | 
|---|
| 393 |  | 
|---|
| 394 | //Compile_Statement.cpp | 
|---|
| 395 | void OpcodeOthers(char *Command); | 
|---|
| 396 | void OpcodeIf(char *Parameter); | 
|---|
| 397 | void OpcodeGoto(char *Parameter); | 
|---|
| 398 | void OpcodeWhile(char *Parameter); | 
|---|
| 399 | void OpcodeExitWhile(void); | 
|---|
| 400 | void OpcodeFor(char *Parameter); | 
|---|
| 401 | void OpcodeExitFor(void); | 
|---|
| 402 | void OpcodeDo(char *Parameter); | 
|---|
| 403 | void OpcodeExitDo(void); | 
|---|
| 404 | void OpcodeContinue(void); | 
|---|
| 405 | void OpcodeExitSub(void); | 
|---|
| 406 | void OpcodeSelect(char *Parameter); | 
|---|
| 407 | void OpcodeCase(char *Parameter); | 
|---|
| 408 | void OpcodeGosub(char *Parameter); | 
|---|
| 409 | void OpcodeReturn(char *Parameter); | 
|---|
| 410 | void Opcode_Input(char *Parameter); | 
|---|
| 411 | void Opcode_Print(char *Parameter,BOOL bWrite); | 
|---|
| 412 | void OpcodeCallPtr(char *Parameter); | 
|---|
| 413 | void OpcodeSetPtrData(char *Parameter,int type); | 
|---|
| 414 |  | 
|---|
| 415 |  | 
|---|
| 416 | //InsertOpcode.cpp | 
|---|
| 417 | void InsertDimStatement_ToProcHead(char *lpszCommand); | 
|---|
| 418 |  | 
|---|
| 419 |  | 
|---|
| 420 |  | 
|---|
| 421 | //////////////////////////////// | 
|---|
| 422 | // AMD64機械語生成に利用する関数郡 | 
|---|
| 423 | //////////////////////////////// | 
|---|
| 424 |  | 
|---|
| 425 | //Mod(モード) | 
|---|
| 426 | #define MOD_BASE        (char)0x00 | 
|---|
| 427 | #define MOD_DISP32      (char)0xFF | 
|---|
| 428 | #define MOD_BASE_DISP8  (char)0x40 | 
|---|
| 429 | #define MOD_BASE_DISP32 (char)0x80 | 
|---|
| 430 | #define MOD_REG             (char)0xC0 | 
|---|
| 431 |  | 
|---|
| 432 | #define USE_OFFSET 1 | 
|---|
| 433 | #define NON_OFFSET 0 | 
|---|
| 434 |  | 
|---|
| 435 | //amd64_main.cpp | 
|---|
| 436 | BOOL IsSafeReg(int reg); | 
|---|
| 437 | void op_push(int reg); | 
|---|
| 438 | void op_push_value(long data); | 
|---|
| 439 | void op_pop(int reg); | 
|---|
| 440 | void op_mov_RV                  (int op_size,int reg,int i32data); | 
|---|
| 441 | void op_mov_RV64                (int reg,_int64 i64data); | 
|---|
| 442 | void op_mov_RM                  (int op_size,int reg,int base_reg,int offset,char mod); | 
|---|
| 443 | void op_mov_RM_ex               (int op_size,int reg,int base_reg1,int base_reg2,int offset,BOOL bUseOffset); | 
|---|
| 444 | void op_mov_MR                  (int op_size,int reg,int base_reg,int offset,char mod); | 
|---|
| 445 | void op_mov_MR_ex               (int op_size,int reg,int base_reg1,int base_reg2,int offset,BOOL bUseOffset); | 
|---|
| 446 | void op_mov_MV                  (int op_size,int base_reg,int offset,BOOL bUseOffset,int i32data); | 
|---|
| 447 | void op_mov_RR                  (int reg1,int reg2); | 
|---|
| 448 | void op_mov64_ToReg             (int reg,_int64 i64data); | 
|---|
| 449 | void op_mov64_ToReg             (int reg,int i32data); | 
|---|
| 450 | void op_mov64_ToReg_FromReg     (int reg1,int reg2); | 
|---|
| 451 | void op_movsxd                  (int reg64,int reg32); | 
|---|
| 452 | void op_movsx64_FromReg16       (int reg64,int reg16); | 
|---|
| 453 | void op_movsx64_FromReg8        (int reg64,int reg8); | 
|---|
| 454 | void op_movsx32_FromReg16       (int reg32,int reg16); | 
|---|
| 455 | void op_movsx32_FromReg8        (int reg32,int reg8); | 
|---|
| 456 | void op_movsx16_FromReg8        (int reg32,int reg8); | 
|---|
| 457 | void op_inc                     (int reg); | 
|---|
| 458 | void op_dec                     (int reg); | 
|---|
| 459 | void op_add_RM                  (int op_size,int reg,int base_reg,int offset,char mod); | 
|---|
| 460 | void op_add64_value             (int reg,int offset); | 
|---|
| 461 | void op_add64_reg               (int reg1,int reg2); | 
|---|
| 462 | void op_add32_reg               (int reg1,int reg2); | 
|---|
| 463 | void op_sub_RV                  (int op_size,int reg,int i32data); | 
|---|
| 464 | void op_sub64_reg               (int reg1,int reg2); | 
|---|
| 465 | void op_sub32_reg               (int reg1,int reg2); | 
|---|
| 466 | void op_imul_reg                (int op_size,int reg1,int reg2); | 
|---|
| 467 | void op_imul_value              (int op_size,int reg,int i32data); | 
|---|
| 468 | void op_div64_reg               (int reg); | 
|---|
| 469 | void op_idiv64_reg              (int reg); | 
|---|
| 470 | void op_shl_reg                 (int op_size,int reg); | 
|---|
| 471 | void op_sar_reg                 (int op_size,int reg); | 
|---|
| 472 | void op_shr_reg                 (int op_size,int reg); | 
|---|
| 473 | void op_and_reg                 (int op_size,int reg1,int reg2); | 
|---|
| 474 | void op_and64_value             (int reg,int offset); | 
|---|
| 475 | void op_and32_value             (int reg,int offset); | 
|---|
| 476 | void op_or_reg                  (int op_size,int reg1,int reg2); | 
|---|
| 477 | void op_xor_reg                 (int op_size,int reg1,int reg2); | 
|---|
| 478 | void op_not_reg                 (int op_size,int reg); | 
|---|
| 479 | void op_test                    (int reg1,int reg2); | 
|---|
| 480 | void op_cmp_reg                 (int op_size,int reg1,int reg2); | 
|---|
| 481 | void op_cmp_value               (int op_size,int reg,char byte_data); | 
|---|
| 482 | void op_movlpd_MR               (int xmm_reg,int base_reg,int offset,char mod); | 
|---|
| 483 | void op_movlpd_RM               (int xmm_reg,int base_reg,int offset,char mod); | 
|---|
| 484 | void op_movsd_RR                (int xmm_reg1,int xmm_reg2); | 
|---|
| 485 | void op_movsd_MR                (int xmm_reg,int base_reg,int offset,char mod); | 
|---|
| 486 | void op_movss_RR                (int xmm_reg1,int xmm_reg2); | 
|---|
| 487 | void op_movss_RM                (int xmm_reg,int base_reg,int offset,char mod); | 
|---|
| 488 | void op_movss_MR                (int xmm_reg,int base_reg,int offset,char mod); | 
|---|
| 489 | void op_movd_RX                 (int reg,int xmm_reg); | 
|---|
| 490 | void op_cvtsd2ss                (int xmm_reg1,int xmm_reg2); | 
|---|
| 491 | void op_cvtss2sd                (int xmm_reg1,int xmm_reg2); | 
|---|
| 492 | void op_cvttsd2si_xmm           (int op_size,int reg,int xmm_reg); | 
|---|
| 493 | void op_cvttss2si_xmm           (int op_size,int reg,int xmm_reg); | 
|---|
| 494 | void op_cvtsi2sd_reg            (int op_size,int xmm_reg,int reg); | 
|---|
| 495 | void op_cvtsi2ss_reg            (int op_size,int xmm_reg,int reg); | 
|---|
| 496 | void op_comisd                  (int xmm_reg1,int xmm_reg2); | 
|---|
| 497 | void op_comiss                  (int xmm_reg1,int xmm_reg2); | 
|---|
| 498 | void op_rep_movs                (int op_size); | 
|---|
| 499 | void op_add_rsp(int num); | 
|---|
| 500 | void op_sub_rsp(int num); | 
|---|
| 501 | void op_add_esp(int num); | 
|---|
| 502 | void op_sub_esp(int num); | 
|---|
| 503 | void op_fld_ptr_esp(int type); | 
|---|
| 504 | void op_zero_reg(int reg); | 
|---|
| 505 | void op_call(SUBINFO *psi); | 
|---|