Index: /trunk/abdev/BasicCompiler32/MachineFixed.h
===================================================================
--- /trunk/abdev/BasicCompiler32/MachineFixed.h	(revision 226)
+++ /trunk/abdev/BasicCompiler32/MachineFixed.h	(revision 226)
@@ -0,0 +1,39 @@
+#pragma once
+
+
+//未定義の定数情報
+#define IMAGE_FILE_MACHINE_AMD64 0x8664
+
+
+//レジスタを示す定数
+#define REG_NON -1
+#define REG_EAX 0x00	//reg:000
+#define REG_ECX 0x01	//reg:001
+#define REG_EDX 0x02	//reg:010
+#define REG_EBX 0x03	//reg:011
+#define REG_ESP 0x04	//reg:100
+#define REG_EBP 0x05	//reg:101
+#define REG_ESI 0x06	//reg:110
+#define REG_EDI 0x07	//reg:111
+
+#define REG_RAX REG_EAX
+#define REG_RCX REG_ECX
+#define REG_RDX REG_EDX
+#define REG_RBX REG_EBX
+#define REG_RSP REG_ESP
+#define REG_RBP REG_EBP
+#define REG_RSI REG_ESI
+#define REG_RDI REG_EDI
+
+#define REGISTER_OPERAND(reg) (reg&0x07)
+
+
+//Mod（モード）
+#define MOD_BASE		(char)0x00
+#define MOD_DISP32		(char)0xFF
+#define MOD_BASE_DISP8	(char)0x40
+#define MOD_BASE_DISP32	(char)0x80
+#define MOD_REG				(char)0xC0
+
+#define USE_OFFSET 1
+#define NON_OFFSET 0
Index: /trunk/abdev/BasicCompiler64/BasicCompiler.vcproj
===================================================================
--- /trunk/abdev/BasicCompiler64/BasicCompiler.vcproj	(revision 225)
+++ /trunk/abdev/BasicCompiler64/BasicCompiler.vcproj	(revision 226)
@@ -254,4 +254,8 @@
 			</File>
 			<File
+				RelativePath=".\MachineFixed.h"
+				>
+			</File>
+			<File
 				RelativePath="Opcode.h"
 				>
@@ -784,4 +788,26 @@
 					</File>
 					<File
+						RelativePath=".\CodeGenerator.cpp"
+						>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								ObjectFile="$(IntDir)\$(InputName)1.obj"
+								XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								ObjectFile="$(IntDir)\$(InputName)1.obj"
+								XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
+							/>
+						</FileConfiguration>
+					</File>
+					<File
 						RelativePath=".\stack_frame.cpp"
 						>
Index: /trunk/abdev/BasicCompiler64/CParameter.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/CParameter.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/CParameter.cpp	(revision 226)
@@ -1,3 +1,5 @@
 #include "stdafx.h"
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -113,5 +115,5 @@
 				//call free
 				extern const UserProc *pSub_free;
-				op_call(pSub_free);
+				compiler.codeGenerator.op_call(pSub_free);
 			}
 			else{
@@ -132,12 +134,12 @@
 
 		//mov rcx,object_size
-		op_mov_RV(sizeof(_int64),REG_RCX,object_size);
+		compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RCX,object_size);
 
 		//call calloc
 		extern const UserProc *pSub_calloc;
-		op_call(pSub_calloc);
+		compiler.codeGenerator.op_call(pSub_calloc);
 
 		//mov r11,rax
-		op_mov_RR(REG_R11,REG_RAX);
+		compiler.codeGenerator.op_mov_RR(REG_R11,REG_RAX);
 
 		//mov qword ptr[rsp+offset],r11     ※スタックフレームを利用
@@ -179,5 +181,5 @@
 
 	//mov reg,r11
-	op_mov_RR(reg,REG_R11);
+	compiler.codeGenerator.op_mov_RR(reg,REG_R11);
 }
 
@@ -317,5 +319,5 @@
 
 						//movd reg,temp_reg
-						op_movd_RX(reg,temp_reg);
+						compiler.codeGenerator.op_movd_RX(reg,temp_reg);
 					}
 				}
@@ -430,5 +432,5 @@
 			//スタックフレームへコピー
 			//mov qword ptr[rsp+offset],rax
-			op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,i2*sizeof(_int64),MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,i2*sizeof(_int64),MOD_BASE_DISP32);
 		}
 		else if(xmm_temp_sw){
@@ -436,5 +438,5 @@
 
 			//movlpd qword ptr[rsp+offset],xmm0
-			op_movlpd_MR(REG_XMM0,REG_RSP,i2*sizeof(_int64),MOD_BASE_DISP32);
+			compiler.codeGenerator.op_movlpd_MR(REG_XMM0,REG_RSP,i2*sizeof(_int64),MOD_BASE_DISP32);
 		}
 
@@ -467,5 +469,5 @@
 		if(obj_DBLockParms.array_LevelCount[i2]){
 			//mov r14,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_R14,REG_RSP,i2*sizeof(_int64),MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R14,REG_RSP,i2*sizeof(_int64),MOD_BASE_DISP32);
 
 			//mov qword ptr[rsp+offset],r14     ※スタックフレームを利用
@@ -503,5 +505,5 @@
 
 			//mov qword ptr[rsp+offset],r14
-			op_mov_MR(sizeof(_int64),REG_R14,REG_RSP,i2*sizeof(_int64),MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_R14,REG_RSP,i2*sizeof(_int64),MOD_BASE_DISP32);
 		}
 	}
Index: /trunk/abdev/BasicCompiler64/CodeGenerator.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/CodeGenerator.cpp	(revision 226)
+++ /trunk/abdev/BasicCompiler64/CodeGenerator.cpp	(revision 226)
@@ -0,0 +1,1726 @@
+#include "stdafx.h"
+
+#include <Procedure.h>
+#include <CodeGenerator.h>
+
+
+//////////////////////
+// rexプリフィックス
+//////////////////////
+void CodeGenerator::set_rex(int op_size,int reg,int index_reg,int base_reg){
+	char RexByte;
+
+	if(reg==REG_NON&&index_reg==REG_NON){
+		/////////////////////////////////////
+		// レジスタをr/mのみに指定するとき
+		/////////////////////////////////////
+
+		if((base_reg&0x08)==0){
+			if(op_size==sizeof(char)&&(base_reg&0x04)){
+				// r/m に spl,bpl,sil,dilを指定するとき
+				RexByte=0x40;
+			}
+			else RexByte=0;
+		}
+		else RexByte=(char)0x41;
+	}
+	else{
+		/////////////////
+		// 通常
+		/////////////////
+
+		if((reg&0x08)==0){
+			//reg … rax～rdi
+
+			if((index_reg&0x08)==0){
+				if((base_reg&0x08)==0) RexByte=0;
+				else RexByte=(char)0x41;
+			}
+			else{
+				if((base_reg&0x08)==0) RexByte=(char)0x42;
+				else RexByte=(char)0x43;
+			}
+		}
+		else{
+			//reg … r8～r15
+
+			if((index_reg&0x08)==0){
+				if((base_reg&0x08)==0) RexByte=(char)0x44;
+				else RexByte=(char)0x45;
+			}
+			else{
+				if((base_reg&0x08)==0) RexByte=(char)0x46;
+				else RexByte=(char)0x47;
+			}
+		}
+	}
+
+	if(op_size==sizeof(_int64)){
+		//64ビットオペランド
+		RexByte|=0x48;
+	}
+
+	if(RexByte) pNativeCode->Put( RexByte );
+}
+
+
+
+/////////////////////////////////////////////////
+// ModR/Mバイト、SIBバイト、ディスプレースメント
+/////////////////////////////////////////////////
+
+//スケール
+#define SCALE_NON	(char)0x00
+#define SCALE_2		(char)0x40
+#define SCALE_4		(char)0x80
+#define SCALE_8		(char)0xC0
+
+//インデックスなし
+#define INDEX_NON	0x04
+
+void CodeGenerator::set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp){
+	if(mod==MOD_DISP32){
+		//ModR/Mバイト
+		pNativeCode->Put( (char)(      REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(0x04)) );
+
+		base_reg=0x05;
+		index_reg=INDEX_NON;
+	}
+	else{
+		//ModR/Mバイト
+		pNativeCode->Put( (char)(mod | REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(base_reg)) );
+	}
+
+
+	//レジスタモードの場合は、ここで終了
+	if(mod==MOD_REG) return;
+
+
+	if(REGISTER_OPERAND(base_reg)==0x04||mod==MOD_DISP32){
+		//////////////////////
+		// SIBバイトを使う
+		//////////////////////
+
+		pNativeCode->Put( (char)(scale| REGISTER_OPERAND(index_reg)<<3 | REGISTER_OPERAND(base_reg)) );
+	}
+
+	//ディスプレースメントを必要としない場合は、ここで終了
+	if(mod==MOD_BASE) return;
+
+
+	//////////////////////////
+	// ディスプレースメント
+	//////////////////////////
+
+	if(mod==MOD_BASE_DISP8) pNativeCode->Put( (char)disp );
+	else{
+		pNativeCode->Put( disp );
+	}
+}
+
+
+
+void CodeGenerator::__op_format(int op_size,char op_prefix,char opcode1,char opcode2,int reg,int base_reg,long offset,char mod){
+	//命令プリフィックス
+	if(op_prefix) pNativeCode->Put( op_prefix );
+
+	//rexプリフィックス
+	set_rex(op_size,reg,0,base_reg);
+
+	//オペコード
+	pNativeCode->Put( opcode1 );
+	if(opcode2) pNativeCode->Put( opcode2 );
+
+	//ModR/M, SIB, disp
+	set_mod_rm_sib_disp(mod,reg,SCALE_NON,INDEX_NON,base_reg,offset);
+}
+
+
+
+///////////////////
+// mov関連
+///////////////////
+
+void CodeGenerator::op_mov_RV(int op_size,int reg,long i32data){
+	//mov reg,i32data
+
+	//rexプリフィックス
+	set_rex(op_size,REG_NON,REG_NON,reg);
+
+	if(op_size==sizeof(_int64)){
+		//オペコード
+		pNativeCode->Put( (char)0xC7 );
+
+		//レジスタ
+		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg) ) );
+	}
+	else{
+		//レジスタ
+		pNativeCode->Put( (char)(0xB8| REGISTER_OPERAND(reg) ) );
+	}
+
+	//即値
+	pNativeCode->Put( i32data );
+}
+void CodeGenerator::op_mov_RV64(int reg,_int64 i64data){
+	//mov reg,i64data
+
+	//rexプリフィックス
+	set_rex(sizeof(_int64),REG_NON,REG_NON,reg);
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xB8| REGISTER_OPERAND(reg) ) );
+
+	//即値
+	pNativeCode->Put( i64data );
+}
+void CodeGenerator::op_mov_RM(int op_size,int reg,int base_reg,long offset,char mod){
+	//mov reg64,qword ptr[base_reg+offset]
+	//mov reg32,dword ptr[base_reg+offset]
+	//mov reg16,word ptr[base_reg+offset]
+	//mov reg8,byte ptr[base_reg+offset]
+
+	//16ビット演算の命令プリフィックス
+	char op_prefix=0;
+	if(op_size==sizeof(short)) op_prefix=(char)0x66;
+
+	//オペコード
+	char opcode;
+	if(op_size==sizeof(char)) opcode=(char)0x8A;
+	else opcode=(char)0x8B;
+
+	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod);
+}
+void CodeGenerator::op_mov_RM_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset){
+	//mov reg64,qword ptr[base_reg1+base_reg2+offset]
+	//mov reg32,dword ptr[base_reg1+base_reg2+offset]
+	//mov reg16,word ptr[base_reg1+base_reg2+offset]
+	//mov reg8,byte ptr[base_reg1+base_reg2+offset]
+
+	if(base_reg1==REG_RSP){
+		//SIBバイトのindex部にrspは指定できない
+		base_reg1=base_reg2;
+		base_reg2=REG_RSP;
+	}
+
+	//16ビット演算のプリフィックス
+	if(op_size==sizeof(short)) pNativeCode->Put( (char)0x66 );
+
+	//rexプリフィックス
+	set_rex(op_size,reg,base_reg1,base_reg2);
+
+	//オペコード
+	if(op_size==sizeof(char)) pNativeCode->Put( (char)0x8A );
+	else pNativeCode->Put( (char)0x8B );
+
+	if(bUseOffset){
+		///////////////////////////
+		// オフセット値を使う
+		///////////////////////////
+
+		//レジスタ
+		pNativeCode->Put( (char)(0x84| REGISTER_OPERAND(reg)<<3) );
+
+		//ベースレジスタ
+		pNativeCode->Put( (char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2)) );
+
+		//オフセット値
+		pNativeCode->Put( offset );
+	}
+	else{
+		///////////////////////////
+		// オフセット値を使わない
+		///////////////////////////
+
+		//レジスタ
+		pNativeCode->Put( (char)(0x04| REGISTER_OPERAND(reg)<<3) );
+
+		//ベースレジスタ
+		pNativeCode->Put( (char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2)) );
+	}
+}
+void CodeGenerator::op_mov_MR(int op_size,int reg,int base_reg,long offset,char mod){
+	//mov qword ptr[base_reg+offset],reg64
+	//mov dword ptr[base_reg+offset],reg32
+	//mov word ptr[base_reg+offset],reg16
+	//mov byte ptr[base_reg+offset],reg8
+
+	//16ビット演算の命令プリフィックス
+	char op_prefix=0;
+	if(op_size==sizeof(short)) op_prefix=(char)0x66;
+
+	//オペコード
+	char opcode;
+	if(op_size==sizeof(char)) opcode=(char)0x88;
+	else opcode=(char)0x89;
+
+	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod);
+}
+void CodeGenerator::op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset){
+	//mov qword ptr[base_reg1+base_reg2+offset],reg64
+	//mov dword ptr[base_reg1+base_reg2+offset],reg32
+	//mov word ptr[base_reg1+base_reg2+offset],reg16
+	//mov byte ptr[base_reg1+base_reg2+offset],reg8
+
+	if(base_reg1==REG_RSP){
+		//SIBバイトのindex部にrspは指定できない
+		base_reg1=base_reg2;
+		base_reg2=REG_RSP;
+	}
+
+	//16ビット演算のプリフィックス
+	if(op_size==sizeof(short)) pNativeCode->Put( (char)0x66 );
+
+	//rexプリフィックス
+	set_rex(op_size,reg,base_reg1,base_reg2);
+
+	//オペコード
+	if(op_size==sizeof(char)) pNativeCode->Put( (char)0x88 );
+	else pNativeCode->Put( (char)0x89 );
+
+	if(bUseOffset==USE_OFFSET){
+		//////////////////////////
+		//オフセット値を使う
+		//////////////////////////
+
+		//レジスタ
+		pNativeCode->Put( (char)(0x84| REGISTER_OPERAND(reg)<<3) );
+
+		//ベースレジスタ
+		pNativeCode->Put( (char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2)) );
+
+		//オフセット値
+		pNativeCode->Put( offset );
+	}
+	else{
+		//////////////////////////
+		//オフセット値を使わない
+		//////////////////////////
+
+		//レジスタ
+		pNativeCode->Put( (char)(0x04| REGISTER_OPERAND(reg)<<3) );
+
+		//ベースレジスタ
+		pNativeCode->Put( (char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2)) );
+	}
+}
+
+void CodeGenerator::op_mov_MV(int op_size,int base_reg,int offset,BOOL bUseOffset,long i32data){
+	//mov ptr[base_reg+offset],i32data
+	//mov ptr[base_reg       ],i32data
+
+	//16ビット演算のプリフィックス
+	if(op_size==sizeof(short)) pNativeCode->Put( (char)0x66 );
+
+	//rexプリフィックス
+	set_rex(op_size,0,0,base_reg);
+
+	//オペコード
+	if(op_size==sizeof(char)) pNativeCode->Put( (char)0xC6 );
+	else pNativeCode->Put( (char)0xC7 );
+
+	if(bUseOffset==USE_OFFSET){
+		//////////////////////////
+		//オフセット値を使う
+		//////////////////////////
+
+		//ModR/M, SIB, disp
+		set_mod_rm_sib_disp(MOD_BASE_DISP32,0,SCALE_NON,INDEX_NON,base_reg,offset);
+	}
+	else{
+		//ModR/M, SIB, disp
+		set_mod_rm_sib_disp(MOD_BASE,0,SCALE_NON,INDEX_NON,base_reg,0);
+	}
+
+	//即値
+	if(op_size==sizeof(_int64)||op_size==sizeof(long)){
+		//32/64ビット
+		pNativeCode->Put( i32data );
+	}
+	else if(op_size==sizeof(short)){
+		//16ビット
+		pNativeCode->Put( (short)i32data );
+	}
+	else if(op_size==sizeof(char)){
+		//16ビット
+		pNativeCode->Put( (char)i32data );
+	}
+}
+
+void CodeGenerator::op_mov_RR(int reg1,int reg2){
+	//mov reg1,reg2
+	char RexByte=-1;
+
+	if(reg1==reg2) return;
+
+	if(REG_RAX<=reg1&&reg1<=REG_RDI){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+	}
+	if(REG_R8<=reg1&&reg1<=REG_R15){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	// [8bit rex] 1000 1011 11xx xbbb
+	pNativeCode->Put( RexByte );
+	pNativeCode->Put( (char)0x8B );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+
+
+
+///////////////////
+// mov64関連
+///////////////////
+
+void CodeGenerator::op_mov64_ToReg(int reg,_int64 i64data){
+	//mov reg,i64data
+
+	if(REG_RAX<=reg&&reg<=REG_RDI){
+		/*	rax～rdi
+			0100 1000 1011 1xxx [64bit data]	*/
+		pNativeCode->Put( (char)0x48 );
+		pNativeCode->Put( (char)(0xB8| REGISTER_OPERAND(reg) ) );
+		pNativeCode->Put( i64data );
+	}
+	if(REG_R8<=reg&&reg<=REG_R15){
+		/*	r8～r15
+			0100 1001 1011 1xxx [64bit data]	*/
+		pNativeCode->Put( (char)0x49 );
+		pNativeCode->Put( (char)(0xB8| REGISTER_OPERAND(reg) ) );
+		pNativeCode->Put( i64data );
+	}
+}
+void CodeGenerator::op_mov64_ToReg(int reg,long i32data){
+	//mov reg,i32data
+
+	if(REG_RAX<=reg&&reg<=REG_RDI){
+		/*	rax～rdi
+			0100 1000 1100 0111 1100 0xxx [32bit data]	*/
+		pNativeCode->Put( (char)0x48 );
+		pNativeCode->Put( (char)0xC7 );
+		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg) ) );
+		pNativeCode->Put( i32data );
+	}
+	if(REG_R8<=reg&&reg<=REG_R15){
+		/*	r8～r15
+			0100 1001 1100 0111 1100 0xxx [32bit data]	*/
+		pNativeCode->Put( (char)0x49 );
+		pNativeCode->Put( (char)0xC7 );
+		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg) ) );
+		pNativeCode->Put( i32data );
+	}
+}
+void CodeGenerator::op_movsxd(int reg64,int reg32){
+	//movsxd reg64,reg32
+	char RexByte=-1;
+
+	if(REG_RAX<=reg64&&reg64<=REG_RDI){
+		if(REG_RAX<=reg32&&reg32<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg32&&reg32<=REG_R15) RexByte=(char)0x49;
+	}
+	if(REG_R8<=reg64&&reg64<=REG_R15){
+		if(REG_RAX<=reg32&&reg32<=REG_RDI) RexByte=(char)0x4C;
+		if(REG_R8<=reg32&&reg32<=REG_R15) RexByte=(char)0x4D;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0110 0011 11rr rbbb
+	pNativeCode->Put( RexByte );
+	pNativeCode->Put( (char)0x63 );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg64)<<3 | REGISTER_OPERAND(reg32)) );
+}
+void CodeGenerator::op_movsx64_FromReg16(int reg64,int reg16){
+	//movsx reg64,reg16
+	char RexByte=-1;
+
+	if(REG_RAX<=reg64&&reg64<=REG_RDI){
+		if(REG_RAX<=reg16&&reg16<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg16&&reg16<=REG_R15) RexByte=(char)0x49;
+	}
+	if(REG_R8<=reg64&&reg64<=REG_R15){
+		if(REG_RAX<=reg16&&reg16<=REG_RDI) RexByte=(char)0x4C;
+		if(REG_R8<=reg16&&reg16<=REG_R15) RexByte=(char)0x4D;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0000 1111 1011 1111 11rr rbbb
+	pNativeCode->Put( RexByte );
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0xBF );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg64)<<3 | REGISTER_OPERAND(reg16)) );
+}
+void CodeGenerator::op_movsx64_FromReg8(int reg64,int reg8){
+	//movsx reg64,reg8
+	char RexByte=-1;
+
+	if(REG_RAX<=reg64&&reg64<=REG_RDI){
+		if(REG_RAX<=reg8&&reg8<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x49;
+	}
+	if(REG_R8<=reg64&&reg64<=REG_R15){
+		if(REG_RAX<=reg8&&reg8<=REG_RDI) RexByte=(char)0x4C;
+		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x4D;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0000 1111 1011 1110 11rr rbbb
+	pNativeCode->Put( RexByte );
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0xBE );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg64)<<3 | REGISTER_OPERAND(reg8)) );
+}
+
+
+
+//////////////////
+// mov32関連
+//////////////////
+
+void CodeGenerator::op_movsx32_FromReg16(int reg32,int reg16){
+	//movsx reg32,reg16
+	char RexByte=-1;
+
+	if(REG_RAX<=reg32&&reg32<=REG_RDI){
+		if(REG_RAX<=reg16&&reg16<=REG_RDI) RexByte=0;
+		if(REG_R8<=reg16&&reg16<=REG_R15) RexByte=(char)0x41;
+	}
+	if(REG_R8<=reg32&&reg32<=REG_R15){
+		if(REG_RAX<=reg16&&reg16<=REG_RDI) RexByte=(char)0x44;
+		if(REG_R8<=reg16&&reg16<=REG_R15) RexByte=(char)0x45;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0000 1111 1011 1111 11rr rbbb
+	if(RexByte) pNativeCode->Put( RexByte );
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0xBF );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg32)<<3 | REGISTER_OPERAND(reg16)) );
+}
+void CodeGenerator::op_movsx32_FromReg8(int reg32,int reg8){
+	//movsx reg32,reg8
+	char RexByte=-1;
+
+	if(REG_RAX<=reg32&&reg32<=REG_RDI){
+		if(REG_RAX<=reg8&&reg8<=REG_RBX) RexByte=0;
+		if(REG_RSP<=reg8&&reg8<=REG_RDI) RexByte=(char)0x40;
+		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x41;
+	}
+	if(REG_R8<=reg32&&reg32<=REG_R15){
+		if(REG_RAX<=reg8&&reg8<=REG_RDI) RexByte=(char)0x44;
+		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x45;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0000 1111 1011 1110 11rr rbbb
+	if(RexByte) pNativeCode->Put( RexByte );
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0xBE );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg32)<<3 | REGISTER_OPERAND(reg8)) );
+}
+
+
+
+/////////////////////
+// mov16関連
+/////////////////////
+
+void CodeGenerator::op_movsx16_FromReg8(int reg32,int reg8){
+	//movsx reg16,reg8
+	char RexByte=-1;
+
+	if(REG_RAX<=reg32&&reg32<=REG_RDI){
+		if(REG_RAX<=reg8&&reg8<=REG_RBX) RexByte=0;
+		if(REG_RSP<=reg8&&reg8<=REG_RDI) RexByte=(char)0x40;
+		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x41;
+	}
+	if(REG_R8<=reg32&&reg32<=REG_R15){
+		if(REG_RAX<=reg8&&reg8<=REG_RDI) RexByte=(char)0x44;
+		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x45;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//0110 0110 [8bit rex] 0000 1111 1011 1110 11rr rbbb
+	pNativeCode->Put( (char)0x66 );
+	if(RexByte) pNativeCode->Put( RexByte );
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0xBE );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg32)<<3 | REGISTER_OPERAND(reg8)) );
+}
+
+
+
+//////////////////////////////////
+// インクリメント・デクリメント
+//////////////////////////////////
+
+void CodeGenerator::op_inc(int reg){
+	//inc reg
+
+	//16ビット演算の命令プリフィックス
+	char op_prefix=0;
+
+	//オペコード
+	char opcode=(char)0xFF;
+
+	__op_format(sizeof(_int64),op_prefix,opcode,0,0,reg,0,MOD_REG);
+}
+void CodeGenerator::op_dec(int reg){
+	//dec reg
+
+	//16ビット演算の命令プリフィックス
+	char op_prefix=0;
+
+	//オペコード
+	char opcode=(char)0xFF;
+
+	__op_format(sizeof(_int64),op_prefix,opcode,0,0x01,reg,0,MOD_REG);
+}
+
+
+
+/////////////////////
+// add関連
+/////////////////////
+
+void CodeGenerator::op_add_RM(int op_size,int reg,int base_reg,int offset,char mod){
+	//add reg64,qword ptr[base_reg+offset]
+	//add reg32,dword ptr[base_reg+offset]
+	//add reg16,word ptr[base_reg+offset]
+	//add reg8,byte ptr[base_reg+offset]
+
+	//16ビット演算の命令プリフィックス
+	char op_prefix=0;
+	if(op_size==sizeof(short)) op_prefix=(char)0x66;
+
+	//オペコード
+	char opcode;
+	if(op_size==sizeof(char)) opcode=(char)0x02;
+	else opcode=(char)0x03;
+
+	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod);
+}
+
+void CodeGenerator::op_add_RV(int reg,long offset){
+	//add reg,offset
+	char RexByte=-1;
+
+	if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0x48;
+	if(REG_R8<=reg&&reg<=REG_R15) RexByte=0x49;
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	if(reg==REG_RAX){
+		//raxのみ特殊
+
+		// [8bit rex] 0000 0101 [32bit offset]
+		pNativeCode->Put( (char)RexByte );
+		pNativeCode->Put( (char)0x05 );
+		pNativeCode->Put( offset );
+	}
+	else{
+		//rax以外
+
+		//[8bit rex] 1000 0001 1100 0xxx [32bit offset]
+		pNativeCode->Put( (char)RexByte );
+		pNativeCode->Put( (char)0x81 );
+		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)) );
+		pNativeCode->Put( offset );
+	}
+}
+void CodeGenerator::op_add64_reg(int reg1,int reg2){
+	//add reg1,reg2
+	char RexByte=-1;
+
+	if(REG_RAX<=reg1&&reg1<=REG_RDI){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+	}
+	if(REG_R8<=reg1&&reg1<=REG_R15){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0000 0011 11rr rbbb
+	pNativeCode->Put( (char)RexByte );
+	pNativeCode->Put( (char)0x03 );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+void CodeGenerator::op_add32_reg(int reg1,int reg2){
+	//add reg1,reg2
+	char RexByte=-1;
+
+	if(REG_RAX<=reg1&&reg1<=REG_RDI){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
+	}
+	if(REG_R8<=reg1&&reg1<=REG_R15){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0000 0011 11rr rbbb
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+	pNativeCode->Put( (char)0x03 );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+
+
+
+////////////////////////
+// sub関連
+////////////////////////
+
+void CodeGenerator::op_sub_RV(int op_size,int reg,long i32data){
+	//sub reg,i32data
+
+	//rexプリフィックス
+	set_rex(op_size,REG_NON,REG_NON,reg);
+
+	if(reg==REG_RAX){
+		//raxのみ特殊
+		pNativeCode->Put( (char)0x2D );
+	}
+	else{
+		//オペコード
+		pNativeCode->Put( (char)0x81 );
+
+		//レジスタ
+		pNativeCode->Put( (char)(0xE8| REGISTER_OPERAND(reg) ) );
+	}
+
+	//即値
+	pNativeCode->Put( i32data );
+}
+void CodeGenerator::op_sub64_reg(int reg1,int reg2){
+	//sub reg1,reg2
+	char RexByte=-1;
+
+	if(REG_RAX<=reg1&&reg1<=REG_RDI){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+	}
+	if(REG_R8<=reg1&&reg1<=REG_R15){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0010 1011 11rr rbbb
+	pNativeCode->Put( (char)RexByte );
+	pNativeCode->Put( (char)0x2B );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+void CodeGenerator::op_sub32_reg(int reg1,int reg2){
+	//sub reg1,reg2
+	char RexByte=-1;
+
+	if(REG_RAX<=reg1&&reg1<=REG_RDI){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
+	}
+	if(REG_R8<=reg1&&reg1<=REG_R15){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 0010 1011 11rr rbbb
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+	pNativeCode->Put( (char)0x2B );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+void CodeGenerator::op_sbb_RR( int op_size, int reg1, int reg2 ){
+	//sbb reg1,reg2
+
+	//rexプリフィックス
+	set_rex(0,reg1,0,reg2);
+
+	//オペコード
+	pNativeCode->Put( (char)0x1B );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+
+
+
+////////////////////////
+// imul関連
+////////////////////////
+
+void CodeGenerator::op_imul_RR(int op_size,int reg1,int reg2){
+	//imul reg1,reg2
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+		}
+	}
+	else{
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
+		}
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0xAF );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+void CodeGenerator::op_imul_RV(int op_size,int reg,long i32data){
+	//imul reg,i32data
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x4D;
+	}
+	else{
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x45;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	if(-128<=i32data&&i32data<=127){
+		//オペコード
+		pNativeCode->Put( (char)0x6B );
+
+		//レジスタ
+		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(reg)) );
+
+		//値
+		pNativeCode->Put( (char)i32data );
+	}
+	else{
+		//オペコード
+		pNativeCode->Put( (char)0x69 );
+
+		//レジスタ
+		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(reg)) );
+
+		//値
+		pNativeCode->Put( i32data );
+	}
+}
+
+
+
+////////////////////////
+// div、idiv関連
+////////////////////////
+
+void CodeGenerator::op_div64_reg(int reg){
+	//div reg
+	char RexByte=-1;
+
+	if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+	if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//rexプリフィックス
+	pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0xF7 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xF0| REGISTER_OPERAND(reg)) );
+}
+void CodeGenerator::op_idiv64_reg(int reg){
+	//idiv reg
+	char RexByte=-1;
+
+	if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+	if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//rexプリフィックス
+	pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0xF7 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xF8| REGISTER_OPERAND(reg)) );
+}
+
+
+
+////////////////////
+// ビットシフト関連
+////////////////////
+
+void CodeGenerator::op_shl_reg(int op_size,int reg){
+	//shl reg,cl
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
+	}
+	else if(op_size==sizeof(char)){
+		if(REG_RAX<=reg&&reg<=REG_RBX) RexByte=0;
+		if(REG_RSP<=reg&&reg<=REG_RDI) RexByte=(char)0x40;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+	}
+	else{
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//16ビット演算のプリフィックス
+	if(op_size==sizeof(short)) pNativeCode->Put( (char)0x66 );
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	if(op_size==sizeof(char)) pNativeCode->Put( (char)0xD2 );
+	else pNativeCode->Put( (char)0xD3 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xE0| REGISTER_OPERAND(reg)) );
+}
+void CodeGenerator::op_sar_reg(int op_size,int reg){
+	//sar reg,cl
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
+	}
+	else if(op_size==sizeof(char)){
+		if(REG_RAX<=reg&&reg<=REG_RBX) RexByte=0;
+		if(REG_RSP<=reg&&reg<=REG_RDI) RexByte=(char)0x40;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+	}
+	else{
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//16ビット演算のプリフィックス
+	if(op_size==sizeof(short)) pNativeCode->Put( (char)0x66 );
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	if(op_size==sizeof(char)) pNativeCode->Put( (char)0xD2 );
+	else pNativeCode->Put( (char)0xD3 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xF8| REGISTER_OPERAND(reg)) );
+}
+void CodeGenerator::op_shr_reg(int op_size,int reg){
+	//shr reg,cl
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
+	}
+	else if(op_size==sizeof(char)){
+		if(REG_RAX<=reg&&reg<=REG_RBX) RexByte=0;
+		if(REG_RSP<=reg&&reg<=REG_RDI) RexByte=(char)0x40;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+	}
+	else{
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//16ビット演算のプリフィックス
+	if(op_size==sizeof(short)) pNativeCode->Put( (char)0x66 );
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	if(op_size==sizeof(char)) pNativeCode->Put( (char)0xD2 );
+	else pNativeCode->Put( (char)0xD3 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xE8| REGISTER_OPERAND(reg)) );
+}
+
+
+
+////////////////////
+// and 関連
+////////////////////
+
+void CodeGenerator::op_and_reg(int op_size,int reg1,int reg2){
+	//and reg1,reg2
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+		}
+	}
+	else{
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
+		}
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0x23 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+void CodeGenerator::op_and64_value(int reg,long offset){
+	//and reg,offset
+	char RexByte=-1;
+
+	if(REG_RAX<=reg&&reg<=REG_RDI) (char)RexByte=0x48;
+	if(REG_R8<=reg&&reg<=REG_R15) (char)RexByte=0x49;
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	if(reg==REG_RAX){
+		//raxのみ特殊
+
+		// [8bit rex] 0010 0101 [32bit offset]
+		pNativeCode->Put( (char)RexByte );
+		pNativeCode->Put( (char)0x25 );
+		pNativeCode->Put( offset );
+	}
+	else{
+		//rax以外
+
+		//[8bit rex] 1000 0001 1100 0xxx [32bit offset]
+		pNativeCode->Put( (char)RexByte );
+		pNativeCode->Put( (char)0x81 );
+		pNativeCode->Put( (char)(0xE0| REGISTER_OPERAND(reg)) );
+		pNativeCode->Put( offset );
+	}
+}
+void CodeGenerator::op_and32_value(int reg,long offset){
+	//and reg,offset
+	char RexByte=-1;
+
+	if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
+	if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	if(reg==REG_RAX){
+		//eaxのみ特殊
+
+		// [8bit rex] 0010 0101 [32bit offset]
+		pNativeCode->Put( (char)0x25 );
+		pNativeCode->Put( offset );
+	}
+	else{
+		//eax以外
+
+		//[8bit rex] 1000 0001 1100 0xxx [32bit offset]
+		if(RexByte) pNativeCode->Put( (char)RexByte );
+		pNativeCode->Put( (char)0x81 );
+		pNativeCode->Put( (char)(0xE0| REGISTER_OPERAND(reg)) );
+		pNativeCode->Put( offset );
+	}
+}
+
+
+
+////////////////////////
+// or 関連
+////////////////////////
+
+void CodeGenerator::op_or_reg(int op_size,int reg1,int reg2){
+	//or reg1,reg2
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+		}
+	}
+	else{
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
+		}
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0x0B );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+
+
+
+////////////////////////
+// xor 関連
+////////////////////////
+
+void CodeGenerator::op_xor_reg(int op_size,int reg1,int reg2){
+	//xor reg1,reg2
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+		}
+	}
+	else{
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
+		}
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0x33 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+
+
+
+///////////////////////
+// not 関連
+///////////////////////
+
+void CodeGenerator::op_not_reg(int op_size,int reg){
+	//not reg
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
+	}
+	else{
+		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
+		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0xF7 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xD0| REGISTER_OPERAND(reg)) );
+}
+void CodeGenerator::op_neg( int reg ){
+	//neg reg
+
+	//オペコード
+	pNativeCode->Put( (char)0xF7 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xD8| REGISTER_OPERAND(reg)) );
+}
+
+
+
+////////////////////
+// test関連
+////////////////////
+
+void CodeGenerator::op_test(int reg1,int reg2){
+	//test reg1,reg2
+	char RexByte=-1;
+
+	if(REG_RAX<=reg1&&reg1<=REG_RDI){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+	}
+	if(REG_R8<=reg1&&reg1<=REG_R15){
+		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+	//[8bit rex] 1000 0101 11rr rbbb
+	pNativeCode->Put( (char)RexByte );
+	pNativeCode->Put( (char)0x85 );
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+
+
+
+/////////////////////
+// cmp 関連
+/////////////////////
+
+void CodeGenerator::op_cmp_reg(int op_size,int reg1,int reg2){
+	//cmp reg1,reg2
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
+		}
+	}
+	else{
+		if(REG_RAX<=reg1&&reg1<=REG_RDI){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
+		}
+		if(REG_R8<=reg1&&reg1<=REG_R15){
+			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
+			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
+		}
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0x3B );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2)) );
+}
+void CodeGenerator::op_cmp_value(int op_size,int reg,char byte_data){
+	//cmp reg,byte_data
+
+	if(op_size==sizeof(char)&&reg==REG_RAX){
+		//alレジスタの場合は特殊
+		pNativeCode->Put( (char)0x3C );
+
+		//8ビット値
+		pNativeCode->Put( byte_data );
+
+		return;
+	}
+
+	//16ビット演算のプリフィックス
+	if(op_size==sizeof(short)) pNativeCode->Put( (char)0x66 );
+
+	//rexプリフィックス
+	set_rex(op_size,REG_NON,REG_NON,reg);
+
+	//オペコード
+	if(op_size==sizeof(char)) pNativeCode->Put( (char)0x80 );
+	else pNativeCode->Put( (char)0x83 );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xF8| REGISTER_OPERAND(reg)) );
+
+	//8ビット値
+	pNativeCode->Put( byte_data );
+}
+void CodeGenerator::op_setne( int reg ){
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x95 );
+
+	//レジスタ
+	pNativeCode->Put( (char)( 0xC0 | REGISTER_OPERAND(reg) ) );
+}
+
+
+////////////////////
+// SSE2関連
+////////////////////
+
+void CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod){
+	//movlpd qword ptr[base_reg+offset],xmm_reg
+	__op_format(0,(char)0x66,(char)0x0F,(char)0x13,xmm_reg,base_reg,offset,mod);
+}
+void CodeGenerator::op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod){
+	//movlpd xmm_reg,qword ptr[base_reg+offset]
+	__op_format(0,(char)0x66,(char)0x0F,(char)0x12,xmm_reg,base_reg,offset,mod);
+}
+void CodeGenerator::op_movsd_RR(int xmm_reg1,int xmm_reg2){
+	if(xmm_reg1==xmm_reg2) return;
+
+	//movsd xmm_reg1,xmm_reg2
+	__op_format(0,(char)0xF2,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG);
+}
+void CodeGenerator::op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod){
+	//movsd qword ptr[reg+offset],xmm_reg
+	//movsd qword ptr[reg],xmm_reg
+	__op_format(0,(char)0xF2,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod);
+}
+void CodeGenerator::op_movss_RR(int xmm_reg1,int xmm_reg2){
+	if(xmm_reg1==xmm_reg2) return;
+
+	//movss xmm_reg1,xmm_reg2
+	__op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG);
+}
+void CodeGenerator::op_movss_RM(int xmm_reg,int base_reg,int offset,char mod){
+	//movss xmm_reg,dword ptr[base_reg+offset]
+	__op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg,base_reg,offset,mod);
+}
+void CodeGenerator::op_movss_MR(int xmm_reg,int base_reg,int offset,char mod){
+	//movss dword ptr[reg+offset],xmm_reg
+	//movss dword ptr[reg],xmm_reg
+	__op_format(0,(char)0xF3,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod);
+}
+
+void CodeGenerator::op_movd_RX(int reg,int xmm_reg){
+	__op_format(sizeof(_int64),(char)0x66,(char)0x0F,(char)0x7E,xmm_reg,reg,0,MOD_REG);
+}
+
+void CodeGenerator::op_cvtsd2ss(int xmm_reg1,int xmm_reg2){
+	//cvtsd2ss xmm_reg1,xmm_reg2
+
+	//オペコード
+	pNativeCode->Put( (char)0xF2 );
+
+	//rexプリフィックス
+	set_rex(sizeof(long),xmm_reg1,0,xmm_reg2);
+
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x5A );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(xmm_reg1)<<3 | REGISTER_OPERAND(xmm_reg2)) );
+}
+void CodeGenerator::op_cvtss2sd(int xmm_reg1,int xmm_reg2){
+	//cvtss2sd xmm_reg1,xmm_reg2
+
+	//オペコード
+	pNativeCode->Put( (char)0xF3 );
+
+	//rexプリフィックス
+	set_rex(0,xmm_reg1,0,xmm_reg2);
+
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x5A );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(xmm_reg1)<<3 | REGISTER_OPERAND(xmm_reg2)) );
+}
+void CodeGenerator::op_cvttsd2si_xmm(int op_size,int reg,int xmm_reg){
+	//cvttsd2si reg,xmm_reg
+
+	//オペコード
+	pNativeCode->Put( (char)0xF2 );
+
+	//rexプリフィックス
+	set_rex(op_size,reg,0,xmm_reg);
+
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x2C );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(xmm_reg)) );
+}
+void CodeGenerator::op_cvttss2si_xmm(int op_size,int reg,int xmm_reg){
+	//cvttss2si reg,xmm_reg
+
+	//オペコード
+	pNativeCode->Put( (char)0xF3 );
+
+	//rexプリフィックス
+	set_rex(op_size,reg,0,xmm_reg);
+
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x2C );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(xmm_reg)) );
+}
+void CodeGenerator::op_cvtsi2sd_reg(int op_size,int xmm_reg,int reg){
+	//cvtsi2sd xmm_reg,reg
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_XMM0<=xmm_reg&&xmm_reg<=REG_XMM7){
+			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
+		}
+		if(REG_XMM8<=xmm_reg&&xmm_reg<=REG_XMM15){
+			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x4C;
+			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x4D;
+		}
+	}
+	else{
+		if(REG_XMM0<=xmm_reg&&xmm_reg<=REG_XMM7){
+			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
+			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+		}
+		if(REG_XMM8<=xmm_reg&&xmm_reg<=REG_XMM15){
+			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x44;
+			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x45;
+		}
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//オペコード
+	pNativeCode->Put( (char)0xF2 );
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x2A );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(xmm_reg)<<3 | REGISTER_OPERAND(reg)) );
+}
+void CodeGenerator::op_cvtsi2ss_reg(int op_size,int xmm_reg,int reg){
+	//cvtsi2ss xmm_reg,reg
+	char RexByte=-1;
+
+	if(op_size==sizeof(_int64)){
+		if(REG_XMM0<=xmm_reg&&xmm_reg<=REG_XMM7){
+			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
+			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
+		}
+		if(REG_XMM8<=xmm_reg&&xmm_reg<=REG_XMM15){
+			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x4C;
+			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x4D;
+		}
+	}
+	else{
+		if(REG_XMM0<=xmm_reg&&xmm_reg<=REG_XMM7){
+			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
+			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
+		}
+		if(REG_XMM8<=xmm_reg&&xmm_reg<=REG_XMM15){
+			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x44;
+			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x45;
+		}
+	}
+
+	if(RexByte==-1) SetError(300,NULL,cp);
+
+
+	//オペコード
+	pNativeCode->Put( (char)0xF3 );
+
+	//rexプリフィックス
+	if(RexByte) pNativeCode->Put( (char)RexByte );
+
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x2A );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(xmm_reg)<<3 | REGISTER_OPERAND(reg)) );
+}
+void CodeGenerator::op_comisd(int xmm_reg1,int xmm_reg2){
+	//comisd xmm_reg1,xmm_reg2
+
+	//オペコード
+	pNativeCode->Put( (char)0x66 );
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x2F );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(xmm_reg1)<<3 | REGISTER_OPERAND(xmm_reg2)) );
+}
+void CodeGenerator::op_comiss(int xmm_reg1,int xmm_reg2){
+	//comiss xmm_reg1,xmm_reg2
+
+	//オペコード
+	pNativeCode->Put( (char)0x0F );
+	pNativeCode->Put( (char)0x2F );
+
+	//レジスタ
+	pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(xmm_reg1)<<3 | REGISTER_OPERAND(xmm_reg2)) );
+}
+
+
+
+/////////////////////
+// ストリング関係
+/////////////////////
+
+void CodeGenerator::op_rep_movs(int op_size){
+	if(op_size==sizeof(BYTE)){
+		//rep movs byte ptr[edi],byte ptr[esi]
+		pNativeCode->Put( (char)0xF3 );
+		pNativeCode->Put( (char)0xA4 );
+	}
+	else if(op_size==sizeof(short)){
+		//rep movs word ptr[edi],word ptr[esi]
+		pNativeCode->Put( (char)0xF3 );
+		pNativeCode->Put( (char)0x66 );
+		pNativeCode->Put( (char)0xA5 );
+	}
+	else if(op_size==sizeof(long)){
+		//rep movs dword ptr[edi],dword ptr[esi]
+		pNativeCode->Put( (char)0xF3 );
+		pNativeCode->Put( (char)0xA5 );
+	}
+}
+
+
+
+
+void CodeGenerator::op_add_rsp(long num){
+	//スタックポインタの加算（pop方向）
+
+	//add rsp,num
+	if(0xFFFFFF80&num){
+		pNativeCode->Put( (char)0x48 );
+		pNativeCode->Put( (char)0x81 );
+		pNativeCode->Put( (char)0xC4 );
+		pNativeCode->Put( num );
+	}
+	else{
+		//「-128 < num < 127」の場合
+		pNativeCode->Put( (char)0x48 );
+		pNativeCode->Put( (char)0x83 );
+		pNativeCode->Put( (char)0xC4 );
+		pNativeCode->Put( (char)num );
+	}
+}
+void CodeGenerator::op_sub_rsp(long num){
+	//スタックポインタの減算（push方向）
+
+	//sub rsp,num
+	if(0xFFFFFF80&num){
+		pNativeCode->Put( (char)0x48 );
+		pNativeCode->Put( (char)0x81 );
+		pNativeCode->Put( (char)0xEC );
+		pNativeCode->Put( num );
+	}
+	else{
+		//「-128 < num < 127」の場合
+		pNativeCode->Put( (char)0x48 );
+		pNativeCode->Put( (char)0x83 );
+		pNativeCode->Put( (char)0xEC );
+		pNativeCode->Put( (char)num );
+	}
+}
+
+
+void CodeGenerator::op_add_esp(long num){
+	//スタックポインタの加算（pop方向）
+
+	//add esp,num
+	if(0xFFFFFF80&num){
+		pNativeCode->Put( (char)0x81 );
+		pNativeCode->Put( (char)0xC4 );
+		pNativeCode->Put( num );
+	}
+	else{
+		//「-128 < num < 127」の場合
+		pNativeCode->Put( (char)0x83 );
+		pNativeCode->Put( (char)0xC4 );
+		pNativeCode->Put( (char)num );
+	}
+}
+void CodeGenerator::op_sub_esp(long num){
+	//スタックポインタの減算（push方向）
+
+	//sub esp,num
+	if(0xFFFFFF80&num){
+		pNativeCode->Put( (char)0x81 );
+		pNativeCode->Put( (char)0xEC );
+		pNativeCode->Put( num );
+	}
+	else{
+		//「-128 < num < 127」の場合
+		pNativeCode->Put( (char)0x83 );
+		pNativeCode->Put( (char)0xEC );
+		pNativeCode->Put( (char)num );
+	}
+}
+
+
+
+//////////////////////////////
+// 浮動小数点関連
+//////////////////////////////
+
+void CodeGenerator::op_fld_ptr_esp(int type){
+	//スタックポインタが示すバッファのデータを浮動小数点レジスタへロード
+
+	if(type==DEF_DOUBLE){
+		//fld qword ptr[esp]
+		pNativeCode->Put( (char)0xDD );
+		pNativeCode->Put( (char)0x04 );
+		pNativeCode->Put( (char)0x24 );
+	}
+	else if(type==DEF_SINGLE){
+		//fld dword ptr[esp]
+		pNativeCode->Put( (char)0xD9 );
+		pNativeCode->Put( (char)0x04 );
+		pNativeCode->Put( (char)0x24 );
+	}
+	else if(type==DEF_INT64){
+		//fild qword ptr[esp]
+		pNativeCode->Put( (char)0xDF );
+		pNativeCode->Put( (char)0x2C );
+		pNativeCode->Put( (char)0x24 );
+	}
+	else if(type==DEF_LONG){
+		//fild dword ptr[esp]
+		pNativeCode->Put( (char)0xDB );
+		pNativeCode->Put( (char)0x04 );
+		pNativeCode->Put( (char)0x24 );
+	}
+}
+
+
+
+//////////////////////////////
+// レジスタ関連
+//////////////////////////////
+
+void CodeGenerator::op_zero_reg(int reg){
+	//レジスタに0をセット
+
+	if(REG_RAX<=reg&&reg<=REG_RDI){
+		/*	rax～rdi
+			0100 1000 0011 0011 11 xxx xxx	*/
+		pNativeCode->Put( (char)0x48 );
+		pNativeCode->Put( (char)0x33 );
+		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(reg)) );
+	}
+	if(REG_R8<=reg&&reg<=REG_R15){
+		/*	r8～r15
+			0100 1101 0011 0011 11 xxx xxx	*/
+		pNativeCode->Put( (char)0x4D );
+		pNativeCode->Put( (char)0x33 );
+		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(reg)) );
+	}
+}
+
+
+
+/////////////////////////////
+// 関数呼び出し
+/////////////////////////////
+
+void CodeGenerator::op_call( const UserProc *pUserProc ){
+	pUserProc->Using();
+
+	pNativeCode->Put(  (char)0xE8 );
+	pobj_SubAddrSchedule->add( pUserProc, 1 );
+	pNativeCode->Put( (long)0 );
+}
+void CodeGenerator::op_call( const DllProc *pDllProc ){
+	pDllProc->Using();
+
+	pNativeCode->Put(  (char)0xFF );
+	pNativeCode->Put(  (char)0x15 );
+	pobj_ImportAddrSchedule->add(pDllProc);
+	pNativeCode->Put( (long)0 );
+}
+void CodeGenerator::op_ret(){
+	pNativeCode->Put( (char)0xC3 );
+}
Index: /trunk/abdev/BasicCompiler64/Compile_Calc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Calc.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_Calc.cpp	(revision 226)
@@ -247,8 +247,8 @@
 
 		// mov rcx, rax
-		op_mov_RR( REG_RCX, REG_RAX );
+		compiler.codeGenerator.op_mov_RR( REG_RCX, REG_RAX );
 
 		// call System.[TypeClass]._Create
-		op_call( pUserProc );
+		compiler.codeGenerator.op_call( pUserProc );
 
 		calcType = pUserProc->ReturnType();
Index: /trunk/abdev/BasicCompiler64/Compile_Calc_PushVar.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Calc_PushVar.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_Calc_PushVar.cpp	(revision 226)
@@ -1,3 +1,5 @@
 #include "stdafx.h"
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -71,5 +73,5 @@
 		else{
 			//mov r11,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -155,5 +157,5 @@
 		else{
 			//mov r11,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -183,5 +185,5 @@
 		if(pRelativeVar->bOffsetOffset){
 			//mov reg, ptr[r11+offset]
-			op_mov_RM(varSize,reg,REG_R11,(int)pRelativeVar->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(varSize,reg,REG_R11,(int)pRelativeVar->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -190,5 +192,5 @@
 		else{
 			//mov reg, ptr[offset]
-			op_mov_RM(varSize,reg,0,(int)pRelativeVar->offset,MOD_DISP32);
+			compiler.codeGenerator.op_mov_RM(varSize,reg,0,(int)pRelativeVar->offset,MOD_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -199,5 +201,5 @@
 		if(pRelativeVar->bOffsetOffset){
 			//add r11,qword ptr[offset]
-			op_add_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);
+			compiler.codeGenerator.op_add_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -206,5 +208,5 @@
 		else{
 			//mov r11,qword ptr[offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -217,5 +219,5 @@
 		if(pRelativeVar->bOffsetOffset){
 			//mov reg, ptr[rsp+r11+offset]
-			op_mov_RM_ex(varSize,reg,REG_RSP,REG_R11,(int)pRelativeVar->offset,USE_OFFSET);
+			compiler.codeGenerator.op_mov_RM_ex(varSize,reg,REG_RSP,REG_R11,(int)pRelativeVar->offset,USE_OFFSET);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -224,5 +226,5 @@
 		else{
 			//mov reg, ptr[rsp+offset]
-			op_mov_RM(varSize,reg,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(varSize,reg,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -233,5 +235,5 @@
 		if(pRelativeVar->bOffsetOffset){
 			//add r11,qword ptr[rsp+offset]
-			op_add_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_add_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -240,5 +242,5 @@
 		else{
 			//mov r11,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -251,5 +253,5 @@
 directmem:
 		//mov reg, ptr[r11]
-		op_mov_RM(varSize,reg,REG_R11,0,MOD_BASE);
+		compiler.codeGenerator.op_mov_RM(varSize,reg,REG_R11,0,MOD_BASE);
 	}
 }
Index: /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp	(revision 226)
@@ -15,15 +15,15 @@
 	//call _System_GetEip
 	extern const UserProc *pSub_System_GetEip;
-	op_call(pSub_System_GetEip);
+	compiler.codeGenerator.op_call(pSub_System_GetEip);
 
 	//mov rdx,rax
-	op_mov_RR(REG_RDX,REG_RAX);
+	compiler.codeGenerator.op_mov_RR(REG_RDX,REG_RAX);
 
 	//mov rcx,rsp
-	op_mov_RR(REG_RCX,REG_RSP);
+	compiler.codeGenerator.op_mov_RR(REG_RCX,REG_RSP);
 
 	//call _DebugSys_SaveContext
 	extern const UserProc *pSub_DebugSys_SaveContext;
-	op_call(pSub_DebugSys_SaveContext);
+	compiler.codeGenerator.op_call(pSub_DebugSys_SaveContext);
 }
 
@@ -79,5 +79,5 @@
 
 	//mov rax,qword ptr[rax]
-	op_mov_RM(sizeof(_int64),REG_RAX,REG_RAX,0,MOD_BASE);
+	compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RAX,REG_RAX,0,MOD_BASE);
 
 	//call rax
@@ -278,12 +278,12 @@
 
 			//mov rcx,object_size
-			op_mov_RV(sizeof(_int64),REG_RCX,object_size);
+			compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RCX,object_size);
 
 			//call calloc
 			extern const UserProc *pSub_calloc;
-			op_call(pSub_calloc);
+			compiler.codeGenerator.op_call(pSub_calloc);
 
 			//mov r13,rax
-			op_mov_RR(REG_R13,REG_RAX);
+			compiler.codeGenerator.op_mov_RR(REG_R13,REG_RAX);
 
 		/////////////////////////////////////////////
@@ -294,9 +294,9 @@
 		if( pUserProc->GetParentClassPtr() && isStatic == false ){
 			//mov rdx,r13
-			op_mov_RR(REG_RDX,REG_R13);
+			compiler.codeGenerator.op_mov_RR(REG_RDX,REG_R13);
 		}
 		else{
 			//mov rcx,r13
-			op_mov_RR(REG_RCX,REG_R13);
+			compiler.codeGenerator.op_mov_RR(REG_RCX,REG_R13);
 		}
 	}
@@ -330,5 +330,5 @@
 				// 参照を実体ポインタにする
 				//mov rcx,qword ptr[rcx]
-				op_mov_RM(sizeof(_int64),REG_RCX,REG_RCX,0,MOD_BASE);
+				compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RCX,REG_RCX,0,MOD_BASE);
 			}
 		}
@@ -355,5 +355,5 @@
 
 		//mov r11,qword ptr[rcx]
-		op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
+		compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
 
 		i2 = pobj_c->GetFuncNumInVtbl( pUserProc );
@@ -378,5 +378,5 @@
 
 		//call ProcAddr
-		op_call(pUserProc);
+		compiler.codeGenerator.op_call(pUserProc);
 	}
 
@@ -445,5 +445,5 @@
 
 	//call dword ptr[ImportTable]
-	op_call( pDllProc );
+	compiler.codeGenerator.op_call( pDllProc );
 
 	/* 64コンパイラでは不要
Index: /trunk/abdev/BasicCompiler64/Compile_Func.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Func.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_Func.cpp	(revision 226)
@@ -64,5 +64,5 @@
 
 	//mov rax,TypeSize
-	op_mov_RV(sizeof(_int64),REG_RAX,typeSize);
+	compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,typeSize);
 
 	return;
@@ -124,5 +124,5 @@
 				if(type.IsObjectPtr()){
 					//mov rcx,qword ptr[rcx]
-					op_mov_RM(sizeof(_int64),REG_RCX,REG_RCX,0,MOD_BASE);
+					compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RCX,REG_RCX,0,MOD_BASE);
 				}
 			}
@@ -143,5 +143,5 @@
 
 		//mov r11,qword ptr[rcx]
-		op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
+		compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RCX,0,MOD_BASE);
 
 		int i2 = pobj_c->GetFuncNumInVtbl( pUserProc );
@@ -149,8 +149,8 @@
 		//mov rax,qword ptr[r11+func_index]
 		if(i2*PTR_SIZE<=0x7F){
-			op_mov_RM(sizeof(_int64),REG_RAX,REG_R11,i2*PTR_SIZE,MOD_BASE_DISP8);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RAX,REG_R11,i2*PTR_SIZE,MOD_BASE_DISP8);
 		}
 		else{
-			op_mov_RM(sizeof(_int64),REG_RAX,REG_R11,i2*PTR_SIZE,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RAX,REG_R11,i2*PTR_SIZE,MOD_BASE_DISP32);
 		}
 	}
@@ -159,5 +159,5 @@
 
 		//mov rax,ProcAddr
-		op_mov_RV(sizeof(_int64),REG_RAX,0);
+		compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,0);
 		obp-=sizeof(long);
 		pobj_SubAddrSchedule->add(pUserProc,0);
@@ -178,5 +178,5 @@
 
 	//mov rax,size
-	op_mov_RV(sizeof(_int64),REG_RAX,typeSize);
+	compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,typeSize);
 }
 void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){
@@ -209,5 +209,5 @@
 
 		//mov rax,qword ptr[rax]
-		op_mov_RM( sizeof(_int64), REG_RAX, REG_RAX, 0, MOD_BASE );
+		compiler.codeGenerator.op_mov_RM( sizeof(_int64), REG_RAX, REG_RAX, 0, MOD_BASE );
 
 		SetError(-120,NULL,cp);
@@ -244,5 +244,5 @@
 
 		//mov rax,qword ptr[rax]
-		op_mov_RM( sizeof(_int64), REG_RAX, REG_RAX, 0, MOD_BASE );
+		compiler.codeGenerator.op_mov_RM( sizeof(_int64), REG_RAX, REG_RAX, 0, MOD_BASE );
 	}
 	else{
@@ -263,13 +263,13 @@
 	if(type==DEF_DOUBLE){
 		//movlpd xmm0,qword ptr[rax]
-		op_movlpd_RM(REG_XMM0,REG_RAX,0,MOD_BASE);
+		compiler.codeGenerator.op_movlpd_RM(REG_XMM0,REG_RAX,0,MOD_BASE);
 	}
 	else if(type==DEF_SINGLE){
 		//movss xmm0,dword ptr[rax]
-		op_movss_RM(REG_XMM0,REG_RAX,0,MOD_BASE);
+		compiler.codeGenerator.op_movss_RM(REG_XMM0,REG_RAX,0,MOD_BASE);
 	}
 	else{
 		//mov rax,ptr[rax]
-		op_mov_RM(GetTypeSize(type,-1),REG_RAX,REG_RAX,0,MOD_BASE);
+		compiler.codeGenerator.op_mov_RM(GetTypeSize(type,-1),REG_RAX,REG_RAX,0,MOD_BASE);
 	}
 }
Index: /trunk/abdev/BasicCompiler64/Compile_Object.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Object.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_Object.cpp	(revision 226)
@@ -1,3 +1,5 @@
 #include "stdafx.h"
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -113,19 +115,19 @@
 		//※添え字上限値であることを考慮
 		//add rax,1
-		op_add_RV(REG_RAX,1);
+		compiler.codeGenerator.op_add_RV(REG_RAX,1);
 
 		//オブジェクトの個数をrbxに一時保持
 		//※rbxは関数が呼ばれても不変
 		//mov rbx,rax
-		op_mov_RR(REG_RBX,REG_RAX);
+		compiler.codeGenerator.op_mov_RR(REG_RBX,REG_RAX);
 
 		//imul rax,size
-		op_imul_RV(sizeof(_int64),REG_RAX,typeSize);
+		compiler.codeGenerator.op_imul_RV(sizeof(_int64),REG_RAX,typeSize);
 
 		//add rax,OBJECT_HEAD_SIZE
-		op_add_RV(REG_RAX,OBJECT_HEAD_SIZE);
+		compiler.codeGenerator.op_add_RV(REG_RAX,OBJECT_HEAD_SIZE);
 
 		//mov rcx,rax
-		op_mov_RR(REG_RCX,REG_RAX);
+		compiler.codeGenerator.op_mov_RR(REG_RCX,REG_RAX);
 	}
 	else{
@@ -133,8 +135,8 @@
 		//※rbxは関数が呼ばれても不変
 		//mov rbx,1
-		op_mov_RV(sizeof(_int64),REG_RBX,1);
+		compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RBX,1);
 
 		//mov rcx,typeSize+OBJECT_HEAD_SIZE
-		op_mov_RV(sizeof(_int64),REG_RCX,typeSize+OBJECT_HEAD_SIZE);
+		compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RCX,typeSize+OBJECT_HEAD_SIZE);
 	}
 
@@ -145,5 +147,5 @@
 		//call _System_GC_malloc_ForObject
 		extern const UserProc *pSub_System_GC_malloc_ForObject;
-		op_call(pSub_System_GC_malloc_ForObject);
+		compiler.codeGenerator.op_call(pSub_System_GC_malloc_ForObject);
 	}
 	else{
@@ -153,5 +155,5 @@
 		//call _System_GC_malloc_ForObjectPtr
 		extern const UserProc *pSub_System_GC_malloc_ForObjectPtr;
-		op_call(pSub_System_GC_malloc_ForObjectPtr);
+		compiler.codeGenerator.op_call(pSub_System_GC_malloc_ForObjectPtr);
 	}
 
@@ -168,15 +170,15 @@
 
 	//mov qword ptr[rax],rbx（オブジェクトの個数）
-	op_mov_MR(sizeof(_int64),REG_RBX,REG_RAX,0,MOD_BASE);
-
-	//add rax,PTR_SIZE
-	op_add_RV(REG_RAX,PTR_SIZE);
+	compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RBX,REG_RAX,0,MOD_BASE);
+
+	//add rax,PTR_SIZE
+	compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 
 	//mov qword ptr[rax],typeSize（オブジェクトのサイズ）
-	op_mov_MV(sizeof(_int64),REG_RAX,0,NON_OFFSET,typeSize);
-
-	//add rax,PTR_SIZE
-	op_add_RV(REG_RAX,PTR_SIZE);
+	compiler.codeGenerator.op_mov_MV(sizeof(_int64),REG_RAX,0,NON_OFFSET,typeSize);
+
+	//add rax,PTR_SIZE
+	compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 
@@ -185,5 +187,5 @@
 
 	//mov rcx,DestructorProcAddr（デストラクタの関数ポインタ）
-	op_mov_RV(sizeof(_int64),REG_RCX,0);
+	compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RCX,0);
 	obp-=sizeof(long);
 	pobj_SubAddrSchedule->add(&method->GetUserProc(),0);
@@ -192,13 +194,13 @@
 
 	//mov qword ptr[rax],rcx
-	op_mov_MR(sizeof(_int64),REG_RCX,REG_RAX,0,MOD_BASE);
-
-	//add rax,PTR_SIZE
-	op_add_RV(REG_RAX,PTR_SIZE);
+	compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RCX,REG_RAX,0,MOD_BASE);
+
+	//add rax,PTR_SIZE
+	compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 
 	// リザーブ領域
 	//add rax,PTR_SIZE
-	op_add_RV(REG_RAX,PTR_SIZE);
+	compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 
@@ -229,5 +231,5 @@
 
 	//sub rax,OBJECT_HEAD_SIZE
-	op_sub_RV(sizeof(_int64),REG_RAX,OBJECT_HEAD_SIZE);
+	compiler.codeGenerator.op_sub_RV(sizeof(_int64),REG_RAX,OBJECT_HEAD_SIZE);
 
 	//mov qword ptr[rsp+offset],rax     ※スタックフレームを利用
@@ -236,31 +238,31 @@
 
 	//mov rbx,qword ptr[rax]（オブジェクトの個数）
-	op_mov_RM(sizeof(_int64),REG_RBX,REG_RAX,0,MOD_BASE);
-
-	//add rax,PTR_SIZE
-	op_add_RV(REG_RAX,PTR_SIZE);
+	compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RBX,REG_RAX,0,MOD_BASE);
+
+	//add rax,PTR_SIZE
+	compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 
 	//mov rsi,qword ptr[rax]（オブジェクトのサイズ）
-	op_mov_RM(sizeof(_int64),REG_RSI,REG_RAX,0,MOD_BASE);
-
-	//add rax,PTR_SIZE
-	op_add_RV(REG_RAX,PTR_SIZE);
+	compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RSI,REG_RAX,0,MOD_BASE);
+
+	//add rax,PTR_SIZE
+	compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 
 	//mov rdi,qword ptr[rax]（デストラクタの関数ポインタ）
-	op_mov_RM(sizeof(_int64),REG_RDI,REG_RAX,0,MOD_BASE);
-
-	//add rax,PTR_SIZE
-	op_add_RV(REG_RAX,PTR_SIZE);
+	compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RDI,REG_RAX,0,MOD_BASE);
+
+	//add rax,PTR_SIZE
+	compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 
 	// リザーブ領域
 	//add rax,PTR_SIZE
-	op_add_RV(REG_RAX,PTR_SIZE);
+	compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 
 	//mov rcx,rax
-	op_mov_RR(REG_RCX,REG_RAX);
+	compiler.codeGenerator.op_mov_RR(REG_RCX,REG_RAX);
 
 
@@ -280,8 +282,8 @@
 
 	//add rcx,rsi
-	op_add64_reg(REG_RCX,REG_RSI);
+	compiler.codeGenerator.op_add64_reg(REG_RCX,REG_RSI);
 
 	//sub rbx,1
-	op_sub_RV(sizeof(_int64),REG_RBX,1);
+	compiler.codeGenerator.op_sub_RV(sizeof(_int64),REG_RBX,1);
 
 	//jnz ↑
@@ -302,10 +304,10 @@
 		//call _System_GC_free_for_SweepingDelete
 		extern const UserProc *pSub_System_GC_free_for_SweepingDelete;
-		op_call(pSub_System_GC_free_for_SweepingDelete);
+		compiler.codeGenerator.op_call(pSub_System_GC_free_for_SweepingDelete);
 	}
 	else{
 		//call free
 		extern const UserProc *pSub_free;
-		op_call(pSub_free);
+		compiler.codeGenerator.op_call(pSub_free);
 	}
 }
Index: /trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp	(revision 226)
@@ -15,8 +15,8 @@
 	if( userProc.GetName() == "_System_GetEip" ){
 		//mov rax,qword ptr[rsp]
-		op_mov_RM(sizeof(_int64),REG_RAX,REG_RSP,0,MOD_BASE);
+		compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RAX,REG_RSP,0,MOD_BASE);
 
 		//ret
-		op_ret();
+		compiler.codeGenerator.op_ret();
 	}
 	else if( userProc.GetName() == "_System_InitDllGlobalVariables" ){
@@ -27,5 +27,5 @@
 		if(!bDll){
 			//ret
-			op_ret();
+			compiler.codeGenerator.op_ret();
 
 			return;
@@ -41,5 +41,5 @@
 		//sub rsp,スタックフレームサイズ
 		int StackFrameSchedule;
-		op_sub_rsp(0xFFFFFFFF);
+		compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF);
 		StackFrameSchedule=obp-sizeof(long);
 
@@ -55,5 +55,5 @@
 		//_System_StartupProgramの呼び出し
 		extern const UserProc *pSub_System_StartupProgram;
-		op_call(pSub_System_StartupProgram);
+		compiler.codeGenerator.op_call(pSub_System_StartupProgram);
 
 		//クラスに属する静的メンバを定義
@@ -63,5 +63,5 @@
 
 		//add rsp,スタックフレームサイズ
-		op_add_RV(REG_RSP,pobj_sf->GetFrameSize(0));
+		compiler.codeGenerator.op_add_RV(REG_RSP,pobj_sf->GetFrameSize(0));
 
 		//スタックフレームスケジュール（subコマンドに渡す値）
@@ -72,5 +72,5 @@
 
 		//ret
-		op_ret();
+		compiler.codeGenerator.op_ret();
 	}
 	else if( userProc.GetName() == "_System_InitStaticLocalVariables" ){
@@ -79,5 +79,5 @@
 		//sub rsp,スタックフレームサイズ
 		int StackFrameSchedule;
-		op_sub_rsp(0xFFFFFFFF);
+		compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF);
 		StackFrameSchedule=obp-sizeof(long);
 
@@ -100,5 +100,5 @@
 
 		//add rsp,スタックフレームサイズ
-		op_add_RV(REG_RSP,pobj_sf->GetFrameSize(0));
+		compiler.codeGenerator.op_add_RV(REG_RSP,pobj_sf->GetFrameSize(0));
 
 		//スタックフレームスケジュール（subコマンドに渡す値）
@@ -106,9 +106,9 @@
 
 		//ret
-		op_ret();
+		compiler.codeGenerator.op_ret();
 	}
 	else if( userProc.GetName() == "_System_Call_Destructor_of_GlobalObject" ){
 		//sub rsp,8（※RSPを16バイト境界にあわせるため）
-		op_sub_rsp(0x8);
+		compiler.codeGenerator.op_sub_rsp(0x8);
 
 
@@ -122,18 +122,18 @@
 
 		//add rsp,8
-		op_add_RV(REG_RSP,0x8);
+		compiler.codeGenerator.op_add_RV(REG_RSP,0x8);
 
 		//ret
-		op_ret();
+		compiler.codeGenerator.op_ret();
 	}
 	else if( userProc.GetName() == "_System_GetSp" ){
 		//mov rax,rsp
-		op_mov_RR(REG_RAX,REG_RSP);
+		compiler.codeGenerator.op_mov_RR(REG_RAX,REG_RSP);
 
 		//add rax,PTR_SIZE
-		op_add_RV(REG_RAX,PTR_SIZE);
+		compiler.codeGenerator.op_add_RV(REG_RAX,PTR_SIZE);
 
 		//ret
-		op_ret();
+		compiler.codeGenerator.op_ret();
 	}
 	else if( userProc.GetName() == "_allrem" ){
@@ -276,4 +276,7 @@
 	compiler.GetNamespaceSupporter().SetImportedNamespaces( pUserProc->GetImportedNamespaces() );
 
+	// コード生成対象を選択
+	compiler.codeGenerator.Select( (const_cast<UserProc *>(pUserProc))->GetNativeCode() );
+
 	if(pUserProc->IsSystem()){
 		////////////////////
@@ -408,9 +411,9 @@
 			if(param.IsReal()&&param.IsRef() == false){
 				//movsd qword ptr[rsp+0x20],xmm3
-				op_movsd_MR(REG_XMM3,REG_RSP,0x20,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_movsd_MR(REG_XMM3,REG_RSP,0x20,MOD_BASE_DISP32);
 			}
 			else{
 				//mov qword ptr[rsp+0x20],r9
-				op_mov_MR(sizeof(_int64),REG_R9,REG_RSP,0x20,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_R9,REG_RSP,0x20,MOD_BASE_DISP32);
 			}
 		}
@@ -418,9 +421,9 @@
 			if(param.IsReal()&&param.IsRef() == false){
 				//movsd qword ptr[rsp+0x18],xmm2
-				op_movsd_MR(REG_XMM2,REG_RSP,0x18,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_movsd_MR(REG_XMM2,REG_RSP,0x18,MOD_BASE_DISP32);
 			}
 			else{
 				//mov qword ptr[rsp+0x18],r8
-				op_mov_MR(sizeof(_int64),REG_R8,REG_RSP,0x18,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_R8,REG_RSP,0x18,MOD_BASE_DISP32);
 			}
 		}
@@ -428,9 +431,9 @@
 			if(param.IsReal()&&param.IsRef() == false){
 				//movsd qword ptr[rsp+0x10],xmm1
-				op_movsd_MR(REG_XMM1,REG_RSP,0x10,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_movsd_MR(REG_XMM1,REG_RSP,0x10,MOD_BASE_DISP32);
 			}
 			else{
 				//mov qword ptr[rsp+0x10],rdx
-				op_mov_MR(sizeof(_int64),REG_RDX,REG_RSP,0x10,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RDX,REG_RSP,0x10,MOD_BASE_DISP32);
 			}
 		}
@@ -438,9 +441,9 @@
 			if(param.IsReal()&&param.IsRef() == false){
 				//movsd qword ptr[rsp+0x8],xmm0
-				op_movsd_MR(REG_XMM0,REG_RSP,0x8,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_movsd_MR(REG_XMM0,REG_RSP,0x8,MOD_BASE_DISP32);
 			}
 			else{
 				//mov qword ptr[rsp+0x8],rcx
-				op_mov_MR(sizeof(_int64),REG_RCX,REG_RSP,0x8,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RCX,REG_RSP,0x8,MOD_BASE_DISP32);
 			}
 		}
@@ -452,5 +455,5 @@
 	//sub rsp,スタックフレームサイズ
 	int StackFrameSchedule;
-	op_sub_rsp(0xFFFFFFFF);
+	compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF);
 	StackFrameSchedule=obp-sizeof(long);
 
@@ -496,17 +499,17 @@
 	if(bDebugCompile&&bDebugSupportProc==0){
 		//mov rdx, qword ptr[rsp+スタックフレームサイズ]
-		op_mov_RM(sizeof(_int64),REG_RDX,REG_RSP,0,MOD_BASE_DISP32);
+		compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RDX,REG_RSP,0,MOD_BASE_DISP32);
 		RspOffsetSchedule=obp-sizeof(long);
 
 		//mov rcx,rsp
-		op_mov_RR(REG_RCX,REG_RSP);
+		compiler.codeGenerator.op_mov_RR(REG_RCX,REG_RSP);
 
 		//add rcx,スタックフレームサイズ+sizeof(_int64) ※ret用のサイズを考慮
-		op_add_RV(REG_RCX,0);
+		compiler.codeGenerator.op_add_RV(REG_RCX,0);
 		RspOffsetSchedule2=obp-sizeof(long);
 
 		//call _DebugSys_StartProc
 		extern const UserProc *pSub_DebugSys_StartProc;
-		op_call(pSub_DebugSys_StartProc);
+		compiler.codeGenerator.op_call(pSub_DebugSys_StartProc);
 	}
 
@@ -582,5 +585,5 @@
 
 					//mov rax,offset
-					op_mov_RV(sizeof(_int64),REG_RAX,offset);
+					compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,offset);
 					obp-=sizeof(long);
 					pobj_DataTableSchedule->add();
@@ -591,5 +594,5 @@
 
 					//mov qword ptr[rcx],rax
-					op_mov_MR(sizeof(_int64),REG_RAX,REG_RCX,0,MOD_BASE);
+					compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RCX,0,MOD_BASE);
 			}
 		}
@@ -695,5 +698,5 @@
 		//call _DebugSys_EndProc
 		extern const UserProc *pSub_DebugSys_EndProc;
-		op_call(pSub_DebugSys_EndProc);
+		compiler.codeGenerator.op_call(pSub_DebugSys_EndProc);
 	}
 
@@ -717,5 +720,5 @@
 			if( i3==DEF_OBJECT ){
 				//mov rax,qword ptr[rax]
-				op_mov_RM( sizeof(_int64), REG_RAX, REG_RAX, 0, MOD_BASE );
+				compiler.codeGenerator.op_mov_RM( sizeof(_int64), REG_RAX, REG_RAX, 0, MOD_BASE );
 			}
 		}
@@ -763,8 +766,8 @@
 
 	//add rsp,スタックフレームサイズ
-	op_add_rsp(stackFrameAndLocalParamSize);
+	compiler.codeGenerator.op_add_rsp(stackFrameAndLocalParamSize);
 
 	//ret
-	op_ret();
+	compiler.codeGenerator.op_ret();
 
 
Index: /trunk/abdev/BasicCompiler64/Compile_Set_Var.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Set_Var.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_Set_Var.cpp	(revision 226)
@@ -1,3 +1,5 @@
 #include "stdafx.h"
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -24,9 +26,9 @@
 		if( calcType.IsDouble() ){
 			//movlsd RightTermReg,xmm0
-			op_movsd_RR(RightTermReg,REG_XMM0);
+			compiler.codeGenerator.op_movsd_RR(RightTermReg,REG_XMM0);
 		}
 		else if( calcType.IsSingle() ){
 			//movlss RightTermReg,xmm0
-			op_movss_RR(RightTermReg,REG_XMM0);
+			compiler.codeGenerator.op_movss_RR(RightTermReg,REG_XMM0);
 		}
 	}
@@ -35,5 +37,5 @@
 
 		//mov RightTermReg,rax
-		op_mov_RR(RightTermReg,REG_RAX);
+		compiler.codeGenerator.op_mov_RR(RightTermReg,REG_RAX);
 	}
 
@@ -57,29 +59,29 @@
 
 				//mov rsi,RightTermReg
-				op_mov_RR(REG_RSI,RightTermReg);
+				compiler.codeGenerator.op_mov_RR(REG_RSI,RightTermReg);
 
 				//mov rdi,VarReg
-				op_mov_RR(REG_RDI,VarReg);
+				compiler.codeGenerator.op_mov_RR(REG_RDI,VarReg);
 
 				int object_size = varType.GetClass().GetSize();
 
 				//mov rcx,object_size
-				op_mov_RV(sizeof(_int64),REG_RCX,object_size);
+				compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RCX,object_size);
 
 				if(bUseHeap){
 					//mov rax,rsi
-					op_mov_RR(REG_RAX,REG_RSI);
+					compiler.codeGenerator.op_mov_RR(REG_RAX,REG_RSI);
 				}
 
 				//rep movs byte ptr[rdi],byte ptr[rsi]
-				op_rep_movs(sizeof(BYTE));
+				compiler.codeGenerator.op_rep_movs(sizeof(BYTE));
 
 				if(bUseHeap){
 					//mov rcx,rax
-					op_mov_RR(REG_RCX,REG_RAX);
+					compiler.codeGenerator.op_mov_RR(REG_RCX,REG_RAX);
 
 					//call free
 					extern const UserProc *pSub_free;
-					op_call(pSub_free);
+					compiler.codeGenerator.op_call(pSub_free);
 				}
 
@@ -165,5 +167,5 @@
 		else{
 			//mov r11,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -256,5 +258,5 @@
 		else{
 			//mov r11,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -289,5 +291,5 @@
 
 		//cvttsd2si rax,xmm0
-		op_cvttsd2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);
+		compiler.codeGenerator.op_cvttsd2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);
 	}
 	else if(type==DEF_SINGLE){
@@ -295,12 +297,12 @@
 
 		//cvttss2si rax,xmm0
-		op_cvttss2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);
+		compiler.codeGenerator.op_cvttss2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);
 	}
 
 	//cmp rax,0
-	op_cmp_value(GetTypeSize(type,-1),REG_RAX,0);
+	compiler.codeGenerator.op_cmp_value(GetTypeSize(type,-1),REG_RAX,0);
 
 	//setne al
-	op_setne( REG_RAX );
+	compiler.codeGenerator.op_setne( REG_RAX );
 
 	SetWholeVariable( sizeof(char), DEF_BYTE, pRelative);
@@ -311,5 +313,5 @@
 
 		//cvttsd2si rax,xmm0
-		op_cvttsd2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);
+		compiler.codeGenerator.op_cvttsd2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);
 	}
 	else if(type==DEF_SINGLE){
@@ -317,5 +319,5 @@
 
 		//cvttss2si rax,xmm0
-		op_cvttss2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);
+		compiler.codeGenerator.op_cvttss2si_xmm(sizeof(_int64),REG_RAX,REG_XMM0);
 	}
 	else{
@@ -340,5 +342,5 @@
 		if(pRelative->bOffsetOffset){
 			//mov ptr[r11+offset],rax/eax/ax/al
-			op_mov_MR(varSize,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_R11,(int)pRelative->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -347,5 +349,5 @@
 		else{
 			//mov ptr[offset],rax/eax/ax/al
-			op_mov_MR(varSize,REG_RAX,0,(int)pRelative->offset,MOD_DISP32);
+			compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,0,(int)pRelative->offset,MOD_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -356,5 +358,5 @@
 		if(pRelative->bOffsetOffset){
 			//add r11,qword ptr[offset]
-			op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelative->offset, MOD_DISP32 );
+			compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelative->offset, MOD_DISP32 );
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -363,5 +365,5 @@
 		else{
 			//mov r11,qword ptr[offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelative->offset,MOD_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelative->offset,MOD_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -374,5 +376,5 @@
 		if(pRelative->bOffsetOffset){
 			//mov ptr[rsp+r11+offset],rax/eax/ax/al
-			op_mov_MR_ex(varSize,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET);
+			compiler.codeGenerator.op_mov_MR_ex(varSize,REG_RAX,REG_RSP,REG_R11,(int)pRelative->offset,USE_OFFSET);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -381,5 +383,5 @@
 		else{
 			//mov ptr[rsp+offset],rax/eax/ax/al
-			op_mov_MR(varSize,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -390,5 +392,5 @@
 		if(pRelative->bOffsetOffset){
 			//add r11,qword ptr[rsp+offset]
-			op_add_RM( sizeof(_int64), REG_R11, REG_RSP, (int)pRelative->offset, MOD_BASE_DISP32 );
+			compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_RSP, (int)pRelative->offset, MOD_BASE_DISP32 );
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -397,5 +399,5 @@
 		else{
 			//mov r11,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelative->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -409,5 +411,5 @@
 
 		//mov ptr[r11],rax/eax/ax/al
-		op_mov_MR(varSize,REG_RAX,REG_R11,0,MOD_BASE);
-	}
-}
+		compiler.codeGenerator.op_mov_MR(varSize,REG_RAX,REG_R11,0,MOD_BASE);
+	}
+}
Index: /trunk/abdev/BasicCompiler64/Compile_Statement.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Statement.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_Statement.cpp	(revision 226)
@@ -113,5 +113,5 @@
 		if( resultType.IsStruct() ){
 			//mov r14,rax
-			op_mov_RR(REG_R14,REG_RAX);
+			compiler.codeGenerator.op_mov_RR(REG_R14,REG_RAX);
 
 			FreeTempObject(REG_R14,&resultType.GetClass());
@@ -166,5 +166,5 @@
 
 		//cmp rax,0
-		op_cmp_value(resultType.GetSize(),REG_RAX,0);
+		compiler.codeGenerator.op_cmp_value(resultType.GetSize(),REG_RAX,0);
 	}
 }
@@ -421,5 +421,5 @@
 
 	//cmp rax,0
-	op_cmp_value(resultType.GetSize(),REG_RAX,0);
+	compiler.codeGenerator.op_cmp_value(resultType.GetSize(),REG_RAX,0);
 
 	//je [カウンタ減少の場合の判定]
@@ -451,5 +451,5 @@
 
 	//cmp rax,0
-	op_cmp_value(resultType.GetSize(),REG_RAX,0);
+	compiler.codeGenerator.op_cmp_value(resultType.GetSize(),REG_RAX,0);
 
 ErrorStep:
@@ -761,5 +761,5 @@
 					if(reg2!=REG_RDX){
 						//mov rdx,reg2
-						op_mov_RR(REG_RDX,reg2);
+						compiler.codeGenerator.op_mov_RR(REG_RDX,reg2);
 					}
 
@@ -768,8 +768,8 @@
 
 					//call operator_proc	※ ==演算子
-					op_call(pUserProc);
+					compiler.codeGenerator.op_call(pUserProc);
 
 					//test rax,rax
-					op_test(REG_RAX,REG_RAX);
+					compiler.codeGenerator.op_test(REG_RAX,REG_RAX);
 
 					//jne ...
@@ -788,5 +788,5 @@
 
 						//comiss xmm_reg1,xmm_reg2
-						op_comisd(xmm_reg,REG_XMM4);
+						compiler.codeGenerator.op_comisd(xmm_reg,REG_XMM4);
 					}
 					else if(type1.IsSingle()){
@@ -800,5 +800,5 @@
 
 						//comiss xmm_reg1,xmm_reg2
-						op_comiss(xmm_reg,REG_XMM4);
+						compiler.codeGenerator.op_comiss(xmm_reg,REG_XMM4);
 					}
 					else{
@@ -811,5 +811,5 @@
 
 						//cmp reg2,r14
-						op_cmp_reg(GetTypeSize(i2,-1),reg2,REG_R14);
+						compiler.codeGenerator.op_cmp_reg(GetTypeSize(i2,-1),reg2,REG_R14);
 					}
 
@@ -893,9 +893,9 @@
 	//call _System_GetEip
 	extern const UserProc *pSub_System_GetEip;
-	op_call(pSub_System_GetEip);
+	compiler.codeGenerator.op_call(pSub_System_GetEip);
 
 	//add rax,offset（Gosubステートメントの最終ポイント）
 	int schedule=obp,schedule2;
-	op_add_RV(REG_RAX,0);
+	compiler.codeGenerator.op_add_RV(REG_RAX,0);
 	schedule2=obp-sizeof(long);
 
@@ -1032,5 +1032,5 @@
 
 		//movsd qword ptr[reg_ptr],xmm0
-		op_movsd_MR(REG_XMM0,reg_ptr,0,MOD_BASE);
+		compiler.codeGenerator.op_movsd_MR(REG_XMM0,reg_ptr,0,MOD_BASE);
 	}
 	else if(type==DEF_SINGLE){
@@ -1038,5 +1038,5 @@
 
 		//movss dword ptr[reg_ptr],xmm0
-		op_movss_MR(REG_XMM0,reg_ptr,0,MOD_BASE);
+		compiler.codeGenerator.op_movss_MR(REG_XMM0,reg_ptr,0,MOD_BASE);
 	}
 	else{
@@ -1044,5 +1044,5 @@
 
 		//mov ptr[reg_ptr],rcx
-		op_mov_MR(GetTypeSize(type,-1),REG_RCX,reg_ptr,0,MOD_BASE);
-	}
-}
+		compiler.codeGenerator.op_mov_MR(GetTypeSize(type,-1),REG_RCX,reg_ptr,0,MOD_BASE);
+	}
+}
Index: /trunk/abdev/BasicCompiler64/Compile_Var.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Var.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Compile_Var.cpp	(revision 226)
@@ -54,5 +54,5 @@
 		if(typeSize>=2){
 			//imul reg,i2
-			op_imul_RV(sizeof(_int64),reg,typeSize);
+			compiler.codeGenerator.op_imul_RV(sizeof(_int64),reg,typeSize);
 		}
 	}
@@ -72,10 +72,10 @@
 
 	//add r11,reg
-	op_add64_reg(REG_R11,reg);
+	compiler.codeGenerator.op_add64_reg(REG_R11,reg);
 }
 void SetRelativeOffset( RELATIVE_VAR &relativeVar ){
 	if(relativeVar.dwKind==VAR_DIRECTMEM){
 		//mov r11,qword ptr[r11]
-		op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE);
+		compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE);
 	}
 	else{
@@ -85,5 +85,5 @@
 
 		//mov r11,qword ptr[r12]
-		op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
+		compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
 	}
 }
@@ -139,5 +139,5 @@
 
 	//xor r12,r12
-	op_zero_reg(REG_R12);
+	compiler.codeGenerator.op_zero_reg(REG_R12);
 
 	for(i=i3-1;i>=0;i--){
@@ -173,8 +173,8 @@
 
 		//imul reg,i4
-		op_imul_RV(sizeof(_int64),reg,i4);
+		compiler.codeGenerator.op_imul_RV(sizeof(_int64),reg,i4);
 
 		//add r12,reg
-		op_add64_reg(REG_R12,reg);
+		compiler.codeGenerator.op_add64_reg(REG_R12,reg);
 
 		HeapDefaultFree(pParm[i]);
@@ -352,5 +352,5 @@
 
 				//mov r11,qword ptr[r11]
-				op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE);
+				compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R11,0,MOD_BASE);
 			}
 			else{
@@ -652,5 +652,5 @@
 		//xor r11,r11（r11を0に初期化する）
 		//※r11は変数ベースアドレスからの相対オフセットを示す
-		op_zero_reg(REG_R11);
+		compiler.codeGenerator.op_zero_reg(REG_R11);
 
 		pRelativeVar->bOffsetOffset=1;
@@ -701,5 +701,5 @@
 
 				//mov r11,qword ptr[r12]
-				op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
+				compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
 			}
 		}
@@ -721,5 +721,5 @@
 
 				//mov r11,qword ptr[r12]
-				op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
+				compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_R12,0,MOD_BASE);
 			}
 			else{
@@ -872,5 +872,5 @@
 
 			//mov rax,DataPos
-			op_mov_RV(sizeof(_int64),REG_RAX,i2);
+			compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,i2);
 			obp-=sizeof(long);
 			pobj_DataTableSchedule->add();
@@ -878,5 +878,5 @@
 
 			//mov qword ptr[offset],rax
-			op_mov_MR(sizeof(_int64),REG_RAX,0,offset,MOD_DISP32);
+			compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,0,offset,MOD_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -1002,8 +1002,8 @@
 
 		//mov rax,i64data
-		op_mov64_ToReg(REG_RAX,i64data);
+		compiler.codeGenerator.op_mov64_ToReg(REG_RAX,i64data);
 
 		//mov qword ptr[rsp+offset],rax
-		op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);
+		compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);
 		obp-=sizeof(long);
 		AddLocalVarAddrSchedule();
@@ -1015,5 +1015,5 @@
 
 		//mov dword ptr[rsp+offset],value
-		op_mov_MV(sizeof(long),REG_RSP,offset,USE_OFFSET,*(int *)&flt);
+		compiler.codeGenerator.op_mov_MV(sizeof(long),REG_RSP,offset,USE_OFFSET,*(int *)&flt);
 		obp-=sizeof(long)+sizeof(long);
 		AddLocalVarAddrSchedule();
@@ -1030,5 +1030,5 @@
 
 			//mov rax,i2
-			op_mov_RV(sizeof(_int64),REG_RAX,i2);
+			compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RAX,i2);
 			obp-=sizeof(long);
 			pobj_DataTableSchedule->add();
@@ -1036,5 +1036,5 @@
 
 			//mov qword ptr[rsp+offset],rax
-			op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -1044,8 +1044,8 @@
 			if(i64data&0xFFFFFFFF00000000){
 				//mov rax,i64data
-				op_mov64_ToReg(REG_RAX,i64data);
+				compiler.codeGenerator.op_mov64_ToReg(REG_RAX,i64data);
 
 				//mov qword ptr[rsp+offset],rax
-				op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);
+				compiler.codeGenerator.op_mov_MR(sizeof(_int64),REG_RAX,REG_RSP,offset,MOD_BASE_DISP32);
 				obp-=sizeof(long);
 				AddLocalVarAddrSchedule();
@@ -1054,5 +1054,5 @@
 			else{
 				//mov qword ptr[rsp+offset],value
-				op_mov_MV(sizeof(_int64),REG_RSP,offset,USE_OFFSET,(int)i64data);
+				compiler.codeGenerator.op_mov_MV(sizeof(_int64),REG_RSP,offset,USE_OFFSET,(int)i64data);
 				obp-=sizeof(long)+sizeof(long);
 				AddLocalVarAddrSchedule();
@@ -1063,5 +1063,5 @@
 	else if( type.IsDWord() || type.IsLong() ){
 		//mov dword ptr[rsp+offset],value
-		op_mov_MV(sizeof(long),REG_RSP,offset,USE_OFFSET,(int)i64data);
+		compiler.codeGenerator.op_mov_MV(sizeof(long),REG_RSP,offset,USE_OFFSET,(int)i64data);
 		obp-=sizeof(long)+sizeof(long);
 		AddLocalVarAddrSchedule();
@@ -1070,5 +1070,5 @@
 	else if( type.IsWord() || type.IsInteger() ){
 		//mov word ptr[rsp+offset],value
-		op_mov_MV(sizeof(short),REG_RSP,offset,USE_OFFSET,(int)i64data);
+		compiler.codeGenerator.op_mov_MV(sizeof(short),REG_RSP,offset,USE_OFFSET,(int)i64data);
 		obp-=sizeof(long)+sizeof(short);
 		AddLocalVarAddrSchedule();
@@ -1077,5 +1077,5 @@
 	else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){
 		//mov byte ptr[rsp+offset],value
-		op_mov_MV(sizeof(char),REG_RSP,offset,USE_OFFSET,(int)i64data);
+		compiler.codeGenerator.op_mov_MV(sizeof(char),REG_RSP,offset,USE_OFFSET,(int)i64data);
 		obp-=sizeof(long)+sizeof(char);
 		AddLocalVarAddrSchedule();
@@ -1182,14 +1182,14 @@
 
 			//mov r8, 0
-			op_zero_reg( REG_R8 );
+			compiler.codeGenerator.op_zero_reg( REG_R8 );
 
 			//mov rdx, VarSize
-			op_mov_RV( sizeof(_int64), REG_RDX, pVar->GetMemorySize() );
+			compiler.codeGenerator.op_mov_RV( sizeof(_int64), REG_RDX, pVar->GetMemorySize() );
 
 			//mov rcx, rsp
-			op_mov_RR( REG_RCX, REG_RSP );
+			compiler.codeGenerator.op_mov_RR( REG_RCX, REG_RSP );
 
 			//add rcx, offset
-			op_add_RV( REG_RCX, -pVar->GetOffsetAddress() );
+			compiler.codeGenerator.op_add_RV( REG_RCX, -pVar->GetOffsetAddress() );
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -1199,5 +1199,5 @@
 			DllProc *pDllProc;
 			pDllProc=GetDeclareHash("FillMemory");
-			op_call( pDllProc );
+			compiler.codeGenerator.op_call( pDllProc );
 		}
 	}
@@ -1240,9 +1240,9 @@
 
 			//mov reg,r11
-			op_mov_RR(reg,REG_R11);
+			compiler.codeGenerator.op_mov_RR(reg,REG_R11);
 		}
 		else{
 			//mov reg,offset
-			op_mov64_ToReg(reg,(int)pRelativeVar->offset);
+			compiler.codeGenerator.op_mov64_ToReg(reg,(long)pRelativeVar->offset);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -1253,5 +1253,5 @@
 		if(pRelativeVar->bOffsetOffset){
 			//add r11,qword ptr[offset]
-			op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 );
+			compiler.codeGenerator.op_add_RM( sizeof(_int64), REG_R11, REG_NON, (int)pRelativeVar->offset, MOD_DISP32 );
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -1260,5 +1260,5 @@
 		else{
 			//mov r11,qword ptr[offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_NON,(int)pRelativeVar->offset,MOD_DISP32);
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -1279,15 +1279,15 @@
 
 			//add r11,rsp
-			op_add64_reg(REG_R11,REG_RSP);
+			compiler.codeGenerator.op_add64_reg(REG_R11,REG_RSP);
 
 			//mov reg,r11
-			op_mov_RR(reg,REG_R11);
+			compiler.codeGenerator.op_mov_RR(reg,REG_R11);
 		}
 		else{
 			//mov reg,rsp
-			op_mov_RR(reg,REG_RSP);
+			compiler.codeGenerator.op_mov_RR(reg,REG_RSP);
 
 			//add reg,offset
-			op_add_RV(reg,(int)pRelativeVar->offset);
+			compiler.codeGenerator.op_add_RV(reg,(int)pRelativeVar->offset);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -1308,5 +1308,5 @@
 		else{
 			//mov r11,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_R11,REG_RSP,(int)pRelativeVar->offset,MOD_BASE_DISP32);
 			obp-=sizeof(long);
 			AddLocalVarAddrSchedule();
@@ -1319,5 +1319,5 @@
 directmem:
 		//mov reg,r11
-		op_mov_RR(reg,REG_R11);
+		compiler.codeGenerator.op_mov_RR(reg,REG_R11);
 	}
 }
@@ -1337,9 +1337,9 @@
 			// 変数領域に要するLONG_PTR単位の個数を引き渡す
 			//mov r8,count
-			op_mov_RV(sizeof(_int64), REG_R8,pVar->GetMemorySize()/PTR_SIZE);
+			compiler.codeGenerator.op_mov_RV(sizeof(_int64), REG_R8,pVar->GetMemorySize()/PTR_SIZE);
 
 			// ルートポインタを引き渡す
 			//mov rdx,offset
-			op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->GetOffsetAddress());
+			compiler.codeGenerator.op_mov_RV(sizeof(_int64), REG_RDX,(int)pVar->GetOffsetAddress());
 			obp-=sizeof(long);
 			pobj_GlobalVarSchedule->add();
@@ -1350,5 +1350,5 @@
 
 			// call AddGlobalRootPtr
-			op_call( pUserProc_AddGlobalRootPtr );
+			compiler.codeGenerator.op_call( pUserProc_AddGlobalRootPtr );
 
 			ReallocNativeCodeBuffer();
Index: /trunk/abdev/BasicCompiler64/MachineFixed.h
===================================================================
--- /trunk/abdev/BasicCompiler64/MachineFixed.h	(revision 226)
+++ /trunk/abdev/BasicCompiler64/MachineFixed.h	(revision 226)
@@ -0,0 +1,57 @@
+//レジスタを示す定数
+#define REG_EAX 1
+#define REG_EBX 2
+#define REG_ECX 3
+#define REG_EDX 4
+#define REG_ESP 5
+#define REG_EBP 6
+
+#define REGISTER_OPERAND(reg) (reg&0x07)
+
+#define REG_NON		-1
+#define REG_RAX		0x00	//reg:000
+#define REG_RCX		0x01	//reg:001
+#define REG_RDX		0x02	//reg:010
+#define REG_RBX		0x03	//reg:011
+#define REG_RSP		0x04	//reg:100
+#define REG_RBP		0x05	//reg:101
+#define REG_RSI		0x06	//reg:110
+#define REG_RDI		0x07	//reg:111
+#define REG_R8		0x08	//reg:000（REXプリフィックス）
+#define REG_R9		0x09	//reg:001（REXプリフィックス）
+#define REG_R10		0x0A	//reg:010（REXプリフィックス）
+#define REG_R11		0x0B	//reg:011（REXプリフィックス）
+#define REG_R12		0x0C	//reg:100（REXプリフィックス）
+#define REG_R13		0x0D	//reg:101（REXプリフィックス）
+#define REG_R14		0x0E	//reg:110（REXプリフィックス）
+#define REG_R15		0x0F	//reg:111（REXプリフィックス）
+
+#define REG_XMM0	0x10	//reg:000
+#define REG_XMM1	0x11	//reg:001
+#define REG_XMM2	0x12	//reg:010
+#define REG_XMM3	0x13	//reg:011
+#define REG_XMM4	0x14	//reg:100
+#define REG_XMM5	0x15	//reg:101
+#define REG_XMM6	0x16	//reg:110
+#define REG_XMM7	0x17	//reg:111
+#define REG_XMM8	0x18	//reg:000
+#define REG_XMM9	0x19	//reg:001
+#define REG_XMM10	0x1A	//reg:010
+#define REG_XMM11	0x1B	//reg:011
+#define REG_XMM12	0x1C	//reg:100
+#define REG_XMM13	0x1D	//reg:101
+#define REG_XMM14	0x1E	//reg:110
+#define REG_XMM15	0x1F	//reg:111
+
+#define IS_XMM_REG(reg) (reg&0x10)
+
+
+//Mod（モード）
+#define MOD_BASE		(char)0x00
+#define MOD_DISP32		(char)0xFF
+#define MOD_BASE_DISP8	(char)0x40
+#define MOD_BASE_DISP32	(char)0x80
+#define MOD_REG				(char)0xC0
+
+#define USE_OFFSET 1
+#define NON_OFFSET 0
Index: /trunk/abdev/BasicCompiler64/MakePeHdr.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/MakePeHdr.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/MakePeHdr.cpp	(revision 226)
@@ -391,4 +391,7 @@
 		pobj_sf=new CStackFrame();
 
+		// コード生成対象を選択
+		compiler.codeGenerator.Select( compiler.globalNativeCode );
+
 		trace_for_sourcecodestep( "★★★ グローバル領域のコンパイルを開始" );
 
@@ -399,5 +402,5 @@
 		//sub rsp,スタックフレームサイズ
 		int StackFrameSchedule;
-		op_sub_rsp(0xFFFFFFFF);
+		compiler.codeGenerator.op_sub_rsp(0xFFFFFFFF);
 		StackFrameSchedule=obp-sizeof(long);
 
@@ -411,5 +414,5 @@
 
 		//_System_StartupProgramの呼び出し
-		op_call(pSub_System_StartupProgram);
+		compiler.codeGenerator.op_call(pSub_System_StartupProgram);
 
 		//クラスに属する静的メンバを定義
@@ -445,16 +448,16 @@
 		//call _System_Call_Destructor_of_GlobalObject
 		extern const UserProc *pSub_System_Call_Destructor_of_GlobalObject;
-		op_call(pSub_System_Call_Destructor_of_GlobalObject);
+		compiler.codeGenerator.op_call(pSub_System_Call_Destructor_of_GlobalObject);
 
 
 		//add rsp,スタックフレームサイズ
 		int stackFrameSize = pobj_sf->GetFrameSize(0);
-		op_add_RV( REG_RSP, stackFrameSize );
+		compiler.codeGenerator.op_add_RV( REG_RSP, stackFrameSize );
 
 		//xor rax,rax（raxを0に初期化する）
-		op_zero_reg(REG_RAX);
+		compiler.codeGenerator.op_zero_reg(REG_RAX);
 
 		//ret
-		op_ret();
+		compiler.codeGenerator.op_ret();
 
 		//グローバル実行領域のコードサイズ
Index: /trunk/abdev/BasicCompiler64/NumOpe.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/NumOpe.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/NumOpe.cpp	(revision 226)
@@ -30,5 +30,5 @@
 
 		//mov reg,rax
-		op_mov_RR( reg, REG_RAX );
+		compiler.codeGenerator.op_mov_RR( reg, REG_RAX );
 
 	/////////////////////////////////////////////
@@ -54,9 +54,9 @@
 			if(type==DEF_DOUBLE){
 				//movsd xmm_reg,xmm0
-				op_movsd_RR(XmmReg,REG_XMM0);
+				compiler.codeGenerator.op_movsd_RR(XmmReg,REG_XMM0);
 			}
 			else if(type==DEF_SINGLE){
 				//movss xmm_reg,xmm0
-				op_movss_RR(XmmReg,REG_XMM0);
+				compiler.codeGenerator.op_movss_RR(XmmReg,REG_XMM0);
 			}
 		}
@@ -70,5 +70,5 @@
 		else{
 			//mov reg,rax
-			op_mov_RR(UseReg,REG_RAX);
+			compiler.codeGenerator.op_mov_RR(UseReg,REG_RAX);
 		}
 	}
@@ -142,5 +142,5 @@
 
 		//オブジェクトポインタをr11にコピー
-		op_mov_RR( REG_R11, UseReg );
+		compiler.codeGenerator.op_mov_RR( REG_R11, UseReg );
 
 		RELATIVE_VAR relativeVar;
@@ -555,5 +555,5 @@
 
 		//mov reg,rax
-		op_mov_RR( *pReg, REG_RAX );
+		compiler.codeGenerator.op_mov_RR( *pReg, REG_RAX );
 
 		return true;
@@ -603,5 +603,5 @@
 
 		//mov reg,i2
-		op_mov_RV(sizeof(_int64),*pReg,i2);
+		compiler.codeGenerator.op_mov_RV(sizeof(_int64),*pReg,i2);
 		obp-=sizeof(long);
 		pobj_DataTableSchedule->add();
@@ -796,5 +796,5 @@
 
 					//mov reg,i2
-					op_mov_RV(sizeof(_int64),UseReg,i2);
+					compiler.codeGenerator.op_mov_RV(sizeof(_int64),UseReg,i2);
 					obp-=sizeof(long);
 					pobj_DataTableSchedule->add();
@@ -895,5 +895,5 @@
 
 						//xor reg,reg
-						op_zero_reg( UseReg );
+						compiler.codeGenerator.op_zero_reg( UseReg );
 
 						if(UseReg==REG_R14){
@@ -971,5 +971,5 @@
 						if(XmmReg==REG_XMM4){
 							//mov r14,i64data
-							op_mov64_ToReg(REG_R14,i64data);
+							compiler.codeGenerator.op_mov64_ToReg(REG_R14,i64data);
 
 
@@ -1004,5 +1004,5 @@
 							SetError();		// TODO: 未実装
 							//push term
-							op_push_value(i32data);
+							//compiler.codeGenerator.op_push_value(i32data);
 						}
 						else{
@@ -1026,5 +1026,5 @@
 
 						//mov reg,i64data
-						op_mov64_ToReg(UseReg,i64data);
+						compiler.codeGenerator.op_mov64_ToReg(UseReg,i64data);
 
 						if(UseReg==REG_R14){
@@ -1194,5 +1194,5 @@
 
 			//mov reg,i64data
-			op_mov64_ToReg(UseReg,i64data);
+			compiler.codeGenerator.op_mov64_ToReg(UseReg,i64data);
 		}
 
Index: /trunk/abdev/BasicCompiler64/NumOpe_Arithmetic.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/NumOpe_Arithmetic.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/NumOpe_Arithmetic.cpp	(revision 226)
@@ -104,13 +104,13 @@
 		if(idCalc==CALC_ADDITION){
 			//add reg1,reg2
-			op_add64_reg(reg1,reg2);
+			compiler.codeGenerator.op_add64_reg(reg1,reg2);
 		}
 		else if(idCalc==CALC_SUBTRACTION){
 			//sub reg1,reg2
-			op_sub64_reg(reg1,reg2);
+			compiler.codeGenerator.op_sub64_reg(reg1,reg2);
 		}
 		else if(idCalc==CALC_PRODUCT){
 			//mul reg1,reg2
-			op_imul_RR(sizeof(_int64),reg1,reg2);
+			compiler.codeGenerator.op_imul_RR(sizeof(_int64),reg1,reg2);
 		}
 
@@ -127,13 +127,13 @@
 		if(idCalc==CALC_ADDITION){
 			//add reg1,reg2
-			op_add32_reg(reg1,reg2);
+			compiler.codeGenerator.op_add32_reg(reg1,reg2);
 		}
 		else if(idCalc==CALC_SUBTRACTION){
 			//sub reg1,reg2
-			op_sub32_reg(reg1,reg2);
+			compiler.codeGenerator.op_sub32_reg(reg1,reg2);
 		}
 		else if(idCalc==CALC_PRODUCT){
 			//mul reg1,reg2
-			op_imul_RR(sizeof(long),reg1,reg2);
+			compiler.codeGenerator.op_imul_RR(sizeof(long),reg1,reg2);
 		}
 
@@ -181,5 +181,5 @@
 	if(reg2==REG_RAX||reg2==REG_RDX){
 		//mov r15,reg2
-		op_mov_RR(REG_R15,reg2);
+		compiler.codeGenerator.op_mov_RR(REG_R15,reg2);
 
 		reg2=REG_R15;
@@ -207,5 +207,5 @@
 
 		//mov rax,reg1
-		op_mov_RR(REG_RAX,reg1);
+		compiler.codeGenerator.op_mov_RR(REG_RAX,reg1);
 
 		if(IsSignedType(type[sp-2])){
@@ -222,18 +222,18 @@
 
 			//xor rdx,rdx
-			op_zero_reg(REG_RDX);
+			compiler.codeGenerator.op_zero_reg(REG_RDX);
 		}
 
 		if(IsSignedType(AnswerType)){
 			//idiv reg2
-			op_idiv64_reg(reg2);
+			compiler.codeGenerator.op_idiv64_reg(reg2);
 		}
 		else{
 			//div reg2
-			op_div64_reg(reg2);
+			compiler.codeGenerator.op_div64_reg(reg2);
 		}
 
 		//mov reg1,rdx
-		op_mov_RR(reg1,REG_RDX);
+		compiler.codeGenerator.op_mov_RR(reg1,REG_RDX);
 
 	}
@@ -357,5 +357,5 @@
 	if(reg2==REG_RAX||reg2==REG_RDX){
 		//mov r15,reg2
-		op_mov_RR(REG_R15,reg2);
+		compiler.codeGenerator.op_mov_RR(REG_R15,reg2);
 
 		reg2=REG_R15;
@@ -383,5 +383,5 @@
 
 		//mov rax,reg1
-		op_mov_RR(REG_RAX,reg1);
+		compiler.codeGenerator.op_mov_RR(REG_RAX,reg1);
 
 		if(IsSignedType(type[sp-2])){
@@ -398,18 +398,18 @@
 
 			//xor rdx,rdx
-			op_zero_reg(REG_RDX);
+			compiler.codeGenerator.op_zero_reg(REG_RDX);
 		}
 
 		if(IsSignedType(AnswerType)){
 			//idiv reg2
-			op_idiv64_reg(reg2);
+			compiler.codeGenerator.op_idiv64_reg(reg2);
 		}
 		else{
 			//div reg2
-			op_div64_reg(reg2);
+			compiler.codeGenerator.op_div64_reg(reg2);
 		}
 
 		//mov reg1,rax
-		op_mov_RR(reg1,REG_RAX);
+		compiler.codeGenerator.op_mov_RR(reg1,REG_RAX);
 
 	}
@@ -499,5 +499,5 @@
 
 		//imul reg,-1
-		op_imul_RV(sizeof(_int64),reg,-1);
+		compiler.codeGenerator.op_imul_RV(sizeof(_int64),reg,-1);
 
 		if(reg==REG_R14){
@@ -512,5 +512,5 @@
 
 		//imul reg,-1
-		op_imul_RV(sizeof(long),reg,-1);
+		compiler.codeGenerator.op_imul_RV(sizeof(long),reg,-1);
 
 		if(reg==REG_R14){
@@ -549,23 +549,23 @@
 		if(xmm_reg1==REG_XMM1){
 			//movsd xmm0,xmm_reg1
-			op_movsd_RR(REG_XMM0,xmm_reg1);
+			compiler.codeGenerator.op_movsd_RR(REG_XMM0,xmm_reg1);
 
 			//movsd xmm1,xmm_reg2
-			op_movsd_RR(REG_XMM1,xmm_reg2);
+			compiler.codeGenerator.op_movsd_RR(REG_XMM1,xmm_reg2);
 		}
 		else{
 			//movsd xmm1,xmm_reg2
-			op_movsd_RR(REG_XMM1,xmm_reg2);
+			compiler.codeGenerator.op_movsd_RR(REG_XMM1,xmm_reg2);
 
 			//movsd xmm0,xmm_reg1
-			op_movsd_RR(REG_XMM0,xmm_reg1);
+			compiler.codeGenerator.op_movsd_RR(REG_XMM0,xmm_reg1);
 		}
 
 		//call pow
 		extern const UserProc *pSub_pow;
-		op_call(pSub_pow);
+		compiler.codeGenerator.op_call(pSub_pow);
 
 		//movsd xmm4,xmm0
-		op_movsd_RR(REG_XMM4,REG_XMM0);
+		compiler.codeGenerator.op_movsd_RR(REG_XMM4,REG_XMM0);
 
 
@@ -586,5 +586,5 @@
 	else{
 		//movsd xmm_reg1,xmm4
-		op_movsd_RR(xmm_reg1,REG_XMM4);
+		compiler.codeGenerator.op_movsd_RR(xmm_reg1,REG_XMM4);
 	}
 
@@ -621,5 +621,5 @@
 	if(reg1==REG_RCX){
 		//mov r15,rcx
-		op_mov_RR(REG_R15,REG_RCX);
+		compiler.codeGenerator.op_mov_RR(REG_R15,REG_RCX);
 
 		reg1=REG_R15;
@@ -633,5 +633,5 @@
 
 	//mov rcx,reg2
-	op_mov_RR(REG_RCX,reg2);
+	compiler.codeGenerator.op_mov_RR(REG_RCX,reg2);
 
 	if(idCalc==CALC_SHL){
@@ -647,5 +647,5 @@
 
 		//shl reg1,cl
-		op_shl_reg(GetTypeSize(type[sp-2],-1),reg1);
+		compiler.codeGenerator.op_shl_reg(GetTypeSize(type[sp-2],-1),reg1);
 	}
 	else if(idCalc==CALC_SHR){
@@ -654,5 +654,5 @@
 
 			//sar
-			op_sar_reg(GetTypeSize(type[sp-2],-1),reg1);
+			compiler.codeGenerator.op_sar_reg(GetTypeSize(type[sp-2],-1),reg1);
 		}
 		else{
@@ -660,5 +660,5 @@
 
 			//shr
-			op_shr_reg(GetTypeSize(type[sp-2],-1),reg1);
+			compiler.codeGenerator.op_shr_reg(GetTypeSize(type[sp-2],-1),reg1);
 		}
 	}
@@ -666,5 +666,5 @@
 	if(sw==0){
 		//mov rcx,r15
-		op_mov_RR(REG_RCX,REG_R15);
+		compiler.codeGenerator.op_mov_RR(REG_RCX,REG_R15);
 	}
 	else{
Index: /trunk/abdev/BasicCompiler64/NumOpe_Logical.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/NumOpe_Logical.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/NumOpe_Logical.cpp	(revision 226)
@@ -1,3 +1,5 @@
 #include "stdafx.h"
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -28,13 +30,13 @@
 		if(idCalc==CALC_XOR){
 			//xor reg1,reg2
-			op_xor_reg(sizeof(_int64),reg1,reg2);
+			compiler.codeGenerator.op_xor_reg(sizeof(_int64),reg1,reg2);
 		}
 		else if(idCalc==CALC_OR){
 			//or reg1,reg2
-			op_or_reg(sizeof(_int64),reg1,reg2);
+			compiler.codeGenerator.op_or_reg(sizeof(_int64),reg1,reg2);
 		}
 		else if(idCalc==CALC_AND){
 			//and reg1,reg2
-			op_and_reg(sizeof(_int64),reg1,reg2);
+			compiler.codeGenerator.op_and_reg(sizeof(_int64),reg1,reg2);
 		}
 
@@ -54,13 +56,13 @@
 		if(idCalc==CALC_ADDITION){
 			//add reg1,reg2
-			op_xor_reg(sizeof(long),reg1,reg2);
+			compiler.codeGenerator.op_xor_reg(sizeof(long),reg1,reg2);
 		}
 		else if(idCalc==CALC_OR){
 			//or reg1,reg2
-			op_or_reg(sizeof(long),reg1,reg2);
+			compiler.codeGenerator.op_or_reg(sizeof(long),reg1,reg2);
 		}
 		else if(idCalc==CALC_AND){
 			//and reg1,reg2
-			op_and_reg(sizeof(long),reg1,reg2);
+			compiler.codeGenerator.op_and_reg(sizeof(long),reg1,reg2);
 		}
 
@@ -99,24 +101,24 @@
 
 		//cmp reg,0
-		op_cmp_value(GetTypeSize(type[sp-1],-1),reg,0);
+		compiler.codeGenerator.op_cmp_value(GetTypeSize(type[sp-1],-1),reg,0);
 
 		//setne al
-		op_setne( REG_RAX );
+		compiler.codeGenerator.op_setne( REG_RAX );
 
 		//and rax,000000FFh
-		op_and64_value(REG_RAX,(int)0xFF);
+		compiler.codeGenerator.op_and64_value(REG_RAX,(int)0xFF);
 
 		//neg
-		op_neg( REG_RAX );
+		compiler.codeGenerator.op_neg( REG_RAX );
 
 		//sbb rax, rax
-		op_sbb_RR( sizeof(_int64), REG_RAX, REG_RAX );
+		compiler.codeGenerator.op_sbb_RR( sizeof(_int64), REG_RAX, REG_RAX );
 
 		//add rax, 1
-		op_add_RV( REG_RAX, 1 );
+		compiler.codeGenerator.op_add_RV( REG_RAX, 1 );
 
 		if( reg != REG_RAX ){
 			//mov reg,rax
-			op_mov_RR( reg, REG_RAX );
+			compiler.codeGenerator.op_mov_RR( reg, REG_RAX );
 
 			//mov qword ptr[rsp+offset],rax     ※スタックフレームを利用
@@ -133,5 +135,5 @@
 
 		//not reg
-		op_not_reg(sizeof(_int64),reg);
+		compiler.codeGenerator.op_not_reg(sizeof(_int64),reg);
 
 		if(reg==REG_R14){
@@ -144,5 +146,5 @@
 
 		//not reg
-		op_not_reg(sizeof(long),reg);
+		compiler.codeGenerator.op_not_reg(sizeof(long),reg);
 
 		if(reg==REG_R14){
Index: /trunk/abdev/BasicCompiler64/NumOpe_Relation.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/NumOpe_Relation.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/NumOpe_Relation.cpp	(revision 226)
@@ -1,3 +1,5 @@
 #include "stdafx.h"
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -24,9 +26,9 @@
 		if(AnswerType==DEF_DOUBLE){
 			//comisd xmm_reg1,xmm_reg2
-			op_comisd(xmm_reg1,xmm_reg2);
+			compiler.codeGenerator.op_comisd(xmm_reg1,xmm_reg2);
 		}
 		else if(AnswerType==DEF_SINGLE){
 			//comiss xmm_reg1,xmm_reg2
-			op_comiss(xmm_reg1,xmm_reg2);
+			compiler.codeGenerator.op_comiss(xmm_reg1,xmm_reg2);
 		}
 
@@ -46,5 +48,5 @@
 
 		//cmp reg1,reg2
-		op_cmp_reg(sizeof(_int64),reg1,reg2);
+		compiler.codeGenerator.op_cmp_reg(sizeof(_int64),reg1,reg2);
 	}
 	else{
@@ -57,5 +59,5 @@
 
 		//cmp reg1,reg2
-		op_cmp_reg(sizeof(long),reg1,reg2);
+		compiler.codeGenerator.op_cmp_reg(sizeof(long),reg1,reg2);
 	}
 
@@ -137,5 +139,5 @@
 
 	//xor reg1,reg1
-	op_zero_reg(reg1);
+	compiler.codeGenerator.op_zero_reg(reg1);
 
 	//jmp 7（次のmovを飛び越す）
@@ -149,5 +151,5 @@
 
 	//mov reg1,1
-	op_mov_RV(sizeof(_int64),reg1,1);
+	compiler.codeGenerator.op_mov_RV(sizeof(_int64),reg1,1);
 
 
Index: /trunk/abdev/BasicCompiler64/NumOpe_TypeOperation.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/NumOpe_TypeOperation.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/NumOpe_TypeOperation.cpp	(revision 226)
@@ -11,5 +11,5 @@
 	if(type==DEF_LONG){
 		//movsxd reg64,reg32
-		op_movsxd(reg,reg);
+		compiler.codeGenerator.op_movsxd(reg,reg);
 	}
 	else if(type==DEF_DWORD){
@@ -18,17 +18,17 @@
 	else if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){
 		//movsx reg64,reg16
-		op_movsx64_FromReg16(reg,reg);
+		compiler.codeGenerator.op_movsx64_FromReg16(reg,reg);
 	}
 	else if(type==DEF_WORD){
 		//and reg,000000000000FFFFh
-		op_and64_value(reg,(int)0xFFFF);
+		compiler.codeGenerator.op_and64_value(reg,(int)0xFFFF);
 	}
 	else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){
 		//movsx reg64,reg8
-		op_movsx64_FromReg8(reg,reg);
+		compiler.codeGenerator.op_movsx64_FromReg8(reg,reg);
 	}
 	else if(type==DEF_BYTE || type==DEF_BOOLEAN){
 		//and reg,00000000000000FFh
-		op_and64_value(reg,(int)0x00FF);
+		compiler.codeGenerator.op_and64_value(reg,(int)0x00FF);
 	}
 }
@@ -36,17 +36,17 @@
 	if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){
 		//movsx reg32,reg16
-		op_movsx32_FromReg16(reg,reg);
+		compiler.codeGenerator.op_movsx32_FromReg16(reg,reg);
 	}
 	else if(type==DEF_WORD){
 		//and reg,0000FFFFh
-		op_and32_value(reg,(int)0xFFFF);
+		compiler.codeGenerator.op_and32_value(reg,(int)0xFFFF);
 	}
 	else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){
 		//movsx reg32,reg8
-		op_movsx32_FromReg8(reg,reg);
+		compiler.codeGenerator.op_movsx32_FromReg8(reg,reg);
 	}
 	else if(type==DEF_BYTE || type==DEF_BOOLEAN){
 		//and reg,000000FFh
-		op_and32_value(reg,(int)0xFF);
+		compiler.codeGenerator.op_and32_value(reg,(int)0xFF);
 	}
 }
@@ -54,9 +54,9 @@
 	if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){
 		//movsx reg16,reg8
-		op_movsx16_FromReg8(reg,reg);
+		compiler.codeGenerator.op_movsx16_FromReg8(reg,reg);
 	}
 	else if(type==DEF_BYTE){
 		//and reg,000000FFh
-		op_and32_value(reg,(int)0xFF);
+		compiler.codeGenerator.op_and32_value(reg,(int)0xFF);
 	}
 }
@@ -70,5 +70,5 @@
 
 		//cvtss2sd
-		op_cvtss2sd(xmm_reg,xmm_reg);
+		compiler.codeGenerator.op_cvtss2sd(xmm_reg,xmm_reg);
 	}
 	else if(Is64Type(type)){
@@ -76,5 +76,5 @@
 
 		//cvtsi2sd xmm_reg,reg
-		op_cvtsi2sd_reg(sizeof(_int64),xmm_reg,general_reg);
+		compiler.codeGenerator.op_cvtsi2sd_reg(sizeof(_int64),xmm_reg,general_reg);
 
 		if(type==DEF_QWORD){
@@ -82,5 +82,5 @@
 
 			//test reg,reg
-			op_test(general_reg,general_reg);
+			compiler.codeGenerator.op_test(general_reg,general_reg);
 
 			//jge 9
@@ -109,5 +109,5 @@
 
 		//cvtsi2sd xmm_reg,reg
-		op_cvtsi2sd_reg(sizeof(_int64),xmm_reg,general_reg);
+		compiler.codeGenerator.op_cvtsi2sd_reg(sizeof(_int64),xmm_reg,general_reg);
 	}
 	else{
@@ -118,5 +118,5 @@
 
 		//cvtsi2sd xmm_reg,reg
-		op_cvtsi2sd_reg(sizeof(long),xmm_reg,general_reg);
+		compiler.codeGenerator.op_cvtsi2sd_reg(sizeof(long),xmm_reg,general_reg);
 	}
 }
@@ -126,5 +126,5 @@
 
 		//cvtsd2ss
-		op_cvtsd2ss(xmm_reg,xmm_reg);
+		compiler.codeGenerator.op_cvtsd2ss(xmm_reg,xmm_reg);
 	}
 	else if(type==DEF_SINGLE){
@@ -135,5 +135,5 @@
 
 		//cvtsi2ss xmm_reg,reg
-		op_cvtsi2ss_reg(sizeof(_int64),xmm_reg,general_reg);
+		compiler.codeGenerator.op_cvtsi2ss_reg(sizeof(_int64),xmm_reg,general_reg);
 
 		if(type==DEF_QWORD){
@@ -141,5 +141,5 @@
 
 			//test reg,reg
-			op_test(general_reg,general_reg);
+			compiler.codeGenerator.op_test(general_reg,general_reg);
 
 			//jge 9
@@ -168,5 +168,5 @@
 
 		//cvtsi2ss xmm_reg,reg
-		op_cvtsi2ss_reg(sizeof(_int64),xmm_reg,general_reg);
+		compiler.codeGenerator.op_cvtsi2ss_reg(sizeof(_int64),xmm_reg,general_reg);
 	}
 	else{
@@ -177,5 +177,5 @@
 
 		//cvtsi2ss xmm_reg,reg
-		op_cvtsi2ss_reg(sizeof(long),xmm_reg,general_reg);
+		compiler.codeGenerator.op_cvtsi2ss_reg(sizeof(long),xmm_reg,general_reg);
 	}
 }
@@ -185,9 +185,9 @@
 		if(Is64Type(NewType)){
 			//cvttsd2si reg,xmm_reg
-			op_cvttsd2si_xmm(sizeof(_int64),reg,xmm_reg);
+			compiler.codeGenerator.op_cvttsd2si_xmm(sizeof(_int64),reg,xmm_reg);
 		}
 		else{
 			//cvttsd2si reg,xmm_reg
-			op_cvttsd2si_xmm(sizeof(long),reg,xmm_reg);
+			compiler.codeGenerator.op_cvttsd2si_xmm(sizeof(long),reg,xmm_reg);
 		}
 	}
@@ -195,9 +195,9 @@
 		if(Is64Type(NewType)){
 			//cvttss2si reg,xmm_reg
-			op_cvttss2si_xmm(sizeof(_int64),reg,xmm_reg);
+			compiler.codeGenerator.op_cvttss2si_xmm(sizeof(_int64),reg,xmm_reg);
 		}
 		else{
 			//cvttss2si reg,xmm_reg
-			op_cvttss2si_xmm(sizeof(long),reg,xmm_reg);
+			compiler.codeGenerator.op_cvttss2si_xmm(sizeof(long),reg,xmm_reg);
 		}
 	}
Index: /trunk/abdev/BasicCompiler64/Opcode.h
===================================================================
--- /trunk/abdev/BasicCompiler64/Opcode.h	(revision 225)
+++ /trunk/abdev/BasicCompiler64/Opcode.h	(revision 226)
@@ -3,53 +3,5 @@
 #include <Type.h>
 #include <Procedure.h>
-
-
-//レジスタを示す定数
-#define REG_EAX 1
-#define REG_EBX 2
-#define REG_ECX 3
-#define REG_EDX 4
-#define REG_ESP 5
-#define REG_EBP 6
-
-#define REGISTER_OPERAND(reg) (reg&0x07)
-
-#define REG_NON		-1
-#define REG_RAX		0x00	//reg:000
-#define REG_RCX		0x01	//reg:001
-#define REG_RDX		0x02	//reg:010
-#define REG_RBX		0x03	//reg:011
-#define REG_RSP		0x04	//reg:100
-#define REG_RBP		0x05	//reg:101
-#define REG_RSI		0x06	//reg:110
-#define REG_RDI		0x07	//reg:111
-#define REG_R8		0x08	//reg:000（REXプリフィックス）
-#define REG_R9		0x09	//reg:001（REXプリフィックス）
-#define REG_R10		0x0A	//reg:010（REXプリフィックス）
-#define REG_R11		0x0B	//reg:011（REXプリフィックス）
-#define REG_R12		0x0C	//reg:100（REXプリフィックス）
-#define REG_R13		0x0D	//reg:101（REXプリフィックス）
-#define REG_R14		0x0E	//reg:110（REXプリフィックス）
-#define REG_R15		0x0F	//reg:111（REXプリフィックス）
-
-#define REG_XMM0	0x10	//reg:000
-#define REG_XMM1	0x11	//reg:001
-#define REG_XMM2	0x12	//reg:010
-#define REG_XMM3	0x13	//reg:011
-#define REG_XMM4	0x14	//reg:100
-#define REG_XMM5	0x15	//reg:101
-#define REG_XMM6	0x16	//reg:110
-#define REG_XMM7	0x17	//reg:111
-#define REG_XMM8	0x18	//reg:000
-#define REG_XMM9	0x19	//reg:001
-#define REG_XMM10	0x1A	//reg:010
-#define REG_XMM11	0x1B	//reg:011
-#define REG_XMM12	0x1C	//reg:100
-#define REG_XMM13	0x1D	//reg:101
-#define REG_XMM14	0x1E	//reg:110
-#define REG_XMM15	0x1F	//reg:111
-
-#define IS_XMM_REG(reg) (reg&0x10)
-
+#include "MachineFixed.h"
 
 
@@ -426,92 +378,3 @@
 
 
-
-////////////////////////////////
-// AMD64機械語生成に利用する関数郡
-////////////////////////////////
-
-//Mod（モード）
-#define MOD_BASE		(char)0x00
-#define MOD_DISP32		(char)0xFF
-#define MOD_BASE_DISP8	(char)0x40
-#define MOD_BASE_DISP32	(char)0x80
-#define MOD_REG				(char)0xC0
-
-#define USE_OFFSET 1
-#define NON_OFFSET 0
-
-//amd64_main.cpp
 BOOL IsSafeReg(int reg);
-void op_push(int reg);
-void op_push_value(long data);
-void op_pop(int reg);
-void op_mov_RV					(int op_size,int reg,int i32data);
-void op_mov_RV64				(int reg,_int64 i64data);
-void op_mov_RM					(int op_size,int reg,int base_reg,int offset,char mod);
-void op_mov_RM_ex				(int op_size,int reg,int base_reg1,int base_reg2,int offset,BOOL bUseOffset);
-void op_mov_MR					(int op_size,int reg,int base_reg,int offset,char mod);
-void op_mov_MR_ex				(int op_size,int reg,int base_reg1,int base_reg2,int offset,BOOL bUseOffset);
-void op_mov_MV					(int op_size,int base_reg,int offset,BOOL bUseOffset,int i32data);
-void op_mov_RR					(int reg1,int reg2);
-void op_mov64_ToReg				(int reg,_int64 i64data);
-void op_mov64_ToReg				(int reg,int i32data);
-void op_movsxd					(int reg64,int reg32);
-void op_movsx64_FromReg16		(int reg64,int reg16);
-void op_movsx64_FromReg8		(int reg64,int reg8);
-void op_movsx32_FromReg16		(int reg32,int reg16);
-void op_movsx32_FromReg8		(int reg32,int reg8);
-void op_movsx16_FromReg8		(int reg32,int reg8);
-void op_inc						(int reg);
-void op_dec						(int reg);
-void op_add_RM					(int op_size,int reg,int base_reg,int offset,char mod);
-void op_add_RV				(int reg,int offset);
-void op_add64_reg				(int reg1,int reg2);
-void op_add32_reg				(int reg1,int reg2);
-void op_sub_RV					(int op_size,int reg,int i32data);
-void op_sub64_reg				(int reg1,int reg2);
-void op_sub32_reg				(int reg1,int reg2);
-void op_sbb_RR					( int op_size, int reg1, int reg2 );
-void op_imul_RR				(int op_size,int reg1,int reg2);
-void op_imul_RV				(int op_size,int reg,int i32data);
-void op_div64_reg				(int reg);
-void op_idiv64_reg				(int reg);
-void op_shl_reg					(int op_size,int reg);
-void op_sar_reg					(int op_size,int reg);
-void op_shr_reg					(int op_size,int reg);
-void op_and_reg					(int op_size,int reg1,int reg2);
-void op_and64_value				(int reg,int offset);
-void op_and32_value				(int reg,int offset);
-void op_or_reg					(int op_size,int reg1,int reg2);
-void op_xor_reg					(int op_size,int reg1,int reg2);
-void op_not_reg					(int op_size,int reg);
-void op_neg						( int reg );
-void op_test					(int reg1,int reg2);
-void op_cmp_reg					(int op_size,int reg1,int reg2);
-void op_cmp_value				(int op_size,int reg,char byte_data);
-void op_setne					(int reg);
-void op_movlpd_MR				(int xmm_reg,int base_reg,int offset,char mod);
-void op_movlpd_RM				(int xmm_reg,int base_reg,int offset,char mod);
-void op_movsd_RR				(int xmm_reg1,int xmm_reg2);
-void op_movsd_MR				(int xmm_reg,int base_reg,int offset,char mod);
-void op_movss_RR				(int xmm_reg1,int xmm_reg2);
-void op_movss_RM				(int xmm_reg,int base_reg,int offset,char mod);
-void op_movss_MR				(int xmm_reg,int base_reg,int offset,char mod);
-void op_movd_RX					(int reg,int xmm_reg);
-void op_cvtsd2ss				(int xmm_reg1,int xmm_reg2);
-void op_cvtss2sd				(int xmm_reg1,int xmm_reg2);
-void op_cvttsd2si_xmm			(int op_size,int reg,int xmm_reg);
-void op_cvttss2si_xmm			(int op_size,int reg,int xmm_reg);
-void op_cvtsi2sd_reg			(int op_size,int xmm_reg,int reg);
-void op_cvtsi2ss_reg			(int op_size,int xmm_reg,int reg);
-void op_comisd					(int xmm_reg1,int xmm_reg2);
-void op_comiss					(int xmm_reg1,int xmm_reg2);
-void op_rep_movs				(int op_size);
-void op_add_rsp(int num);
-void op_sub_rsp(int num);
-void op_add_esp(int num);
-void op_sub_esp(int num);
-void op_fld_ptr_esp(int type);
-void op_zero_reg(int reg);
-void op_call( const UserProc *pUserProc );
-void op_call( const DllProc *pDllProc );
-void op_ret();
Index: /trunk/abdev/BasicCompiler64/OperatorProc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/OperatorProc.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/OperatorProc.cpp	(revision 226)
@@ -2,4 +2,6 @@
 
 #include <jenga/include/smoothie/LexicalAnalysis.h>
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -17,16 +19,16 @@
 	if( method ){
 		//mov rcx,reg
-		op_mov_RR(REG_RCX,reg);
+		compiler.codeGenerator.op_mov_RR(REG_RCX,reg);
 
 		//call DestructorProcAddr
-		op_call( &method->GetUserProc() );
+		compiler.codeGenerator.op_call( &method->GetUserProc() );
 	}
 
 	//mov rcx,reg
-	op_mov_RR(REG_RCX,reg);
+	compiler.codeGenerator.op_mov_RR(REG_RCX,reg);
 
 	//call free
 	extern const UserProc *pSub_free;
-	op_call(pSub_free);
+	compiler.codeGenerator.op_call(pSub_free);
 }
 
@@ -119,12 +121,12 @@
 
 			//mov rcx,object_size
-			op_mov_RV(sizeof(_int64),REG_RCX,object_size);
+			compiler.codeGenerator.op_mov_RV(sizeof(_int64),REG_RCX,object_size);
 
 			//call calloc
 			extern const UserProc *pSub_calloc;
-			op_call(pSub_calloc);
+			compiler.codeGenerator.op_call(pSub_calloc);
 
 			//mov r13,rax
-			op_mov_RR(REG_R13,REG_RAX);
+			compiler.codeGenerator.op_mov_RR(REG_R13,REG_RAX);
 
 		/////////////////////////////////////////////
@@ -169,5 +171,5 @@
 		if(reg1==REG_RDX||reg1==REG_R8){
 			//mov r14,reg1
-			op_mov_RR(REG_R14,reg1);
+			compiler.codeGenerator.op_mov_RR(REG_R14,reg1);
 			reg1=REG_R14;
 		}
@@ -177,9 +179,9 @@
 			if( pUserProc->ReturnType().IsStruct() ){
 				//mov r8,reg2
-				op_mov_RR(REG_R8,reg2);
+				compiler.codeGenerator.op_mov_RR(REG_R8,reg2);
 			}
 			else{
 				//mov rdx,reg2
-				op_mov_RR(REG_RDX,reg2);
+				compiler.codeGenerator.op_mov_RR(REG_RDX,reg2);
 			}
 		}
@@ -187,12 +189,12 @@
 		if( pUserProc->ReturnType().IsStruct() ){
 			//mov rdx,r13
-			op_mov_RR(REG_RDX,REG_R13);
+			compiler.codeGenerator.op_mov_RR(REG_RDX,REG_R13);
 		}
 
 		//mov rcx,reg1
-		op_mov_RR(REG_RCX,reg1);
+		compiler.codeGenerator.op_mov_RR(REG_RCX,reg1);
 
 		//call operator_proc
-		op_call(pUserProc);
+		compiler.codeGenerator.op_call(pUserProc);
 
 		if( !pUserProc->ReturnType().IsNull() ){
@@ -200,5 +202,5 @@
 
 			//mov r13,rax
-			op_mov_RR(REG_R13,REG_RAX);
+			compiler.codeGenerator.op_mov_RR(REG_R13,REG_RAX);
 		}
 
@@ -249,5 +251,5 @@
 
 		//mov reg1,r13
-		op_mov_RR(reg1,REG_R13);
+		compiler.codeGenerator.op_mov_RR(reg1,REG_R13);
 	}
 
@@ -338,5 +340,5 @@
 
 		//mov reg,rax
-		op_mov_RR(reg,REG_RAX);
+		compiler.codeGenerator.op_mov_RR(reg,REG_RAX);
 
 	/////////////////////////////////////////////
Index: /trunk/abdev/BasicCompiler64/amd64_main.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/amd64_main.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/amd64_main.cpp	(revision 226)
@@ -20,1792 +20,2 @@
 	return 0;
 }
-
-
-
-//////////////////////
-// rexプリフィックス
-//////////////////////
-void set_rex(int op_size,int reg,int index_reg,int base_reg){
-	char RexByte;
-
-	if(reg==REG_NON&&index_reg==REG_NON){
-		/////////////////////////////////////
-		// レジスタをr/mのみに指定するとき
-		/////////////////////////////////////
-
-		if((base_reg&0x08)==0){
-			if(op_size==sizeof(char)&&(base_reg&0x04)){
-				// r/m に spl,bpl,sil,dilを指定するとき
-				RexByte=0x40;
-			}
-			else RexByte=0;
-		}
-		else RexByte=(char)0x41;
-	}
-	else{
-		/////////////////
-		// 通常
-		/////////////////
-
-		if((reg&0x08)==0){
-			//reg … rax～rdi
-
-			if((index_reg&0x08)==0){
-				if((base_reg&0x08)==0) RexByte=0;
-				else RexByte=(char)0x41;
-			}
-			else{
-				if((base_reg&0x08)==0) RexByte=(char)0x42;
-				else RexByte=(char)0x43;
-			}
-		}
-		else{
-			//reg … r8～r15
-
-			if((index_reg&0x08)==0){
-				if((base_reg&0x08)==0) RexByte=(char)0x44;
-				else RexByte=(char)0x45;
-			}
-			else{
-				if((base_reg&0x08)==0) RexByte=(char)0x46;
-				else RexByte=(char)0x47;
-			}
-		}
-	}
-
-	if(op_size==sizeof(_int64)){
-		//64ビットオペランド
-		RexByte|=0x48;
-	}
-
-	if(RexByte) OpBuffer[obp++]=RexByte;
-}
-
-
-
-/////////////////////////////////////////////////
-// ModR/Mバイト、SIBバイト、ディスプレースメント
-/////////////////////////////////////////////////
-
-//スケール
-#define SCALE_NON	(char)0x00
-#define SCALE_2		(char)0x40
-#define SCALE_4		(char)0x80
-#define SCALE_8		(char)0xC0
-
-//インデックスなし
-#define INDEX_NON	0x04
-
-void set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,int disp){
-	if(mod==MOD_DISP32){
-		//ModR/Mバイト
-		OpBuffer[obp++]=(char)(      REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(0x04));
-
-		base_reg=0x05;
-		index_reg=INDEX_NON;
-	}
-	else{
-		//ModR/Mバイト
-		OpBuffer[obp++]=(char)(mod | REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(base_reg));
-	}
-
-
-	//レジスタモードの場合は、ここで終了
-	if(mod==MOD_REG) return;
-
-
-	if(REGISTER_OPERAND(base_reg)==0x04||mod==MOD_DISP32){
-		//////////////////////
-		// SIBバイトを使う
-		//////////////////////
-
-		OpBuffer[obp++]=(char)(scale| REGISTER_OPERAND(index_reg)<<3 | REGISTER_OPERAND(base_reg));
-	}
-
-	//ディスプレースメントを必要としない場合は、ここで終了
-	if(mod==MOD_BASE) return;
-
-
-	//////////////////////////
-	// ディスプレースメント
-	//////////////////////////
-
-	if(mod==MOD_BASE_DISP8) OpBuffer[obp++]=(char)disp;
-	else{
-		*((long *)(OpBuffer+obp))=disp;
-		obp+=sizeof(long);
-	}
-}
-
-
-
-void __op_format(int op_size,char op_prefix,char opcode1,char opcode2,int reg,int base_reg,int offset,char mod){
-	//命令プリフィックス
-	if(op_prefix) OpBuffer[obp++]=op_prefix;
-
-	//rexプリフィックス
-	set_rex(op_size,reg,0,base_reg);
-
-	//オペコード
-	OpBuffer[obp++]=opcode1;
-	if(opcode2) OpBuffer[obp++]=opcode2;
-
-	//ModR/M, SIB, disp
-	set_mod_rm_sib_disp(mod,reg,SCALE_NON,INDEX_NON,base_reg,offset);
-}
-
-
-
-
-//////////////////////////
-// スタック関連
-//////////////////////////
-
-void op_push(int reg){
-	//スタックにレジスタの値をプッシュ
-
-	if(REG_RAX<=reg&&reg<=REG_RDI){
-		/*	rax～rdi
-			0101 0xxx	*/
-		OpBuffer[obp++]=(char)(0x50| REGISTER_OPERAND(reg) );
-	}
-	if(REG_R8<=reg&&reg<=REG_R15){
-		/*	r8～r15
-			0100 0001 0101 0xxx	*/
-		OpBuffer[obp++]=(char)0x41;
-		OpBuffer[obp++]=(char)(0x50| REGISTER_OPERAND(reg) );
-	}
-}
-void op_push_value(long data){
-	//スタックにリテラル値をプッシュ
-	if(-128<=data&&data<=127){
-		//push 8ビット値
-		OpBuffer[obp++]=(char)0x6A;
-		OpBuffer[obp++]=(char)data;
-	}
-	else{
-		//push 32ビット値
-		OpBuffer[obp++]=(char)0x68;
-		*((long *)(OpBuffer+obp))=data;
-		obp+=sizeof(long);
-	}
-}
-void op_pop(int reg){
-	//スタックの内容をレジスタにポップ
-	if(REG_RAX<=reg&&reg<=REG_RDI){
-		/*	rax～rdi
-			0101 1xxx	*/
-		OpBuffer[obp++]=(char)(0x58| REGISTER_OPERAND(reg) );
-	}
-	if(REG_R8<=reg&&reg<=REG_R15){
-		/*	r8～r15
-			0100 0001 0101 1xxx	*/
-		OpBuffer[obp++]=(char)0x41;
-		OpBuffer[obp++]=(char)(0x58| REGISTER_OPERAND(reg) );
-	}
-}
-
-
-
-///////////////////
-// mov関連
-///////////////////
-
-void op_mov_RV(int op_size,int reg,int i32data){
-	//mov reg,i32data
-
-	//rexプリフィックス
-	set_rex(op_size,REG_NON,REG_NON,reg);
-
-	if(op_size==sizeof(_int64)){
-		//オペコード
-		OpBuffer[obp++]=(char)0xC7;
-
-		//レジスタ
-		OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg) );
-	}
-	else{
-		//レジスタ
-		OpBuffer[obp++]=(char)(0xB8| REGISTER_OPERAND(reg) );
-	}
-
-	//即値
-	*((long *)(OpBuffer+obp))=i32data;
-	obp+=sizeof(long);
-}
-void op_mov_RV64(int reg,_int64 i64data){
-	//mov reg,i64data
-
-	//rexプリフィックス
-	set_rex(sizeof(_int64),REG_NON,REG_NON,reg);
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xB8| REGISTER_OPERAND(reg) );
-
-	//即値
-	*((_int64 *)(OpBuffer+obp))=i64data;
-	obp+=sizeof(_int64);
-}
-void op_mov_RM(int op_size,int reg,int base_reg,int offset,char mod){
-	//mov reg64,qword ptr[base_reg+offset]
-	//mov reg32,dword ptr[base_reg+offset]
-	//mov reg16,word ptr[base_reg+offset]
-	//mov reg8,byte ptr[base_reg+offset]
-
-	//16ビット演算の命令プリフィックス
-	char op_prefix=0;
-	if(op_size==sizeof(short)) op_prefix=(char)0x66;
-
-	//オペコード
-	char opcode;
-	if(op_size==sizeof(char)) opcode=(char)0x8A;
-	else opcode=(char)0x8B;
-
-	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod);
-}
-void op_mov_RM_ex(int op_size,int reg,int base_reg1,int base_reg2,int offset,BOOL bUseOffset){
-	//mov reg64,qword ptr[base_reg1+base_reg2+offset]
-	//mov reg32,dword ptr[base_reg1+base_reg2+offset]
-	//mov reg16,word ptr[base_reg1+base_reg2+offset]
-	//mov reg8,byte ptr[base_reg1+base_reg2+offset]
-
-	if(base_reg1==REG_RSP){
-		//SIBバイトのindex部にrspは指定できない
-		base_reg1=base_reg2;
-		base_reg2=REG_RSP;
-	}
-
-	//16ビット演算のプリフィックス
-	if(op_size==sizeof(short)) OpBuffer[obp++]=(char)0x66;
-
-	//rexプリフィックス
-	set_rex(op_size,reg,base_reg1,base_reg2);
-
-	//オペコード
-	if(op_size==sizeof(char)) OpBuffer[obp++]=(char)0x8A;
-	else OpBuffer[obp++]=(char)0x8B;
-
-	if(bUseOffset){
-		///////////////////////////
-		// オフセット値を使う
-		///////////////////////////
-
-		//レジスタ
-		OpBuffer[obp++]=(char)(0x84| REGISTER_OPERAND(reg)<<3);
-
-		//ベースレジスタ
-		OpBuffer[obp++]=(char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2));
-
-		//オフセット値
-		*((long *)(OpBuffer+obp))=offset;
-		obp+=sizeof(long);
-	}
-	else{
-		///////////////////////////
-		// オフセット値を使わない
-		///////////////////////////
-
-		//レジスタ
-		OpBuffer[obp++]=(char)(0x04| REGISTER_OPERAND(reg)<<3);
-
-		//ベースレジスタ
-		OpBuffer[obp++]=(char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2));
-	}
-}
-void op_mov_MR(int op_size,int reg,int base_reg,int offset,char mod){
-	//mov qword ptr[base_reg+offset],reg64
-	//mov dword ptr[base_reg+offset],reg32
-	//mov word ptr[base_reg+offset],reg16
-	//mov byte ptr[base_reg+offset],reg8
-
-	//16ビット演算の命令プリフィックス
-	char op_prefix=0;
-	if(op_size==sizeof(short)) op_prefix=(char)0x66;
-
-	//オペコード
-	char opcode;
-	if(op_size==sizeof(char)) opcode=(char)0x88;
-	else opcode=(char)0x89;
-
-	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod);
-}
-void op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,int offset,BOOL bUseOffset){
-	//mov qword ptr[base_reg1+base_reg2+offset],reg64
-	//mov dword ptr[base_reg1+base_reg2+offset],reg32
-	//mov word ptr[base_reg1+base_reg2+offset],reg16
-	//mov byte ptr[base_reg1+base_reg2+offset],reg8
-
-	if(base_reg1==REG_RSP){
-		//SIBバイトのindex部にrspは指定できない
-		base_reg1=base_reg2;
-		base_reg2=REG_RSP;
-	}
-
-	//16ビット演算のプリフィックス
-	if(op_size==sizeof(short)) OpBuffer[obp++]=(char)0x66;
-
-	//rexプリフィックス
-	set_rex(op_size,reg,base_reg1,base_reg2);
-
-	//オペコード
-	if(op_size==sizeof(char)) OpBuffer[obp++]=(char)0x88;
-	else OpBuffer[obp++]=(char)0x89;
-
-	if(bUseOffset==USE_OFFSET){
-		//////////////////////////
-		//オフセット値を使う
-		//////////////////////////
-
-		//レジスタ
-		OpBuffer[obp++]=(char)(0x84| REGISTER_OPERAND(reg)<<3);
-
-		//ベースレジスタ
-		OpBuffer[obp++]=(char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2));
-
-		//オフセット値
-		*((long *)(OpBuffer+obp))=offset;
-		obp+=sizeof(long);
-	}
-	else{
-		//////////////////////////
-		//オフセット値を使わない
-		//////////////////////////
-
-		//レジスタ
-		OpBuffer[obp++]=(char)(0x04| REGISTER_OPERAND(reg)<<3);
-
-		//ベースレジスタ
-		OpBuffer[obp++]=(char)(REGISTER_OPERAND(base_reg1)<<3 | REGISTER_OPERAND(base_reg2));
-	}
-}
-
-void op_mov_MV(int op_size,int base_reg,int offset,BOOL bUseOffset,int i32data){
-	//mov ptr[base_reg+offset],i32data
-	//mov ptr[base_reg       ],i32data
-
-	//16ビット演算のプリフィックス
-	if(op_size==sizeof(short)) OpBuffer[obp++]=(char)0x66;
-
-	//rexプリフィックス
-	set_rex(op_size,0,0,base_reg);
-
-	//オペコード
-	if(op_size==sizeof(char)) OpBuffer[obp++]=(char)0xC6;
-	else OpBuffer[obp++]=(char)0xC7;
-
-	if(bUseOffset==USE_OFFSET){
-		//////////////////////////
-		//オフセット値を使う
-		//////////////////////////
-
-		//ModR/M, SIB, disp
-		set_mod_rm_sib_disp(MOD_BASE_DISP32,0,SCALE_NON,INDEX_NON,base_reg,offset);
-	}
-	else{
-		//ModR/M, SIB, disp
-		set_mod_rm_sib_disp(MOD_BASE,0,SCALE_NON,INDEX_NON,base_reg,0);
-	}
-
-	//即値
-	if(op_size==sizeof(_int64)||op_size==sizeof(long)){
-		//32/64ビット
-		*((long *)(OpBuffer+obp))=i32data;
-		obp+=sizeof(long);
-	}
-	else if(op_size==sizeof(short)){
-		//16ビット
-		*((short *)(OpBuffer+obp))=(short)i32data;
-		obp+=sizeof(short);
-	}
-	else if(op_size==sizeof(char)){
-		//16ビット
-		*((char *)(OpBuffer+obp))=(char)i32data;
-		obp++;
-	}
-}
-
-void op_mov_RR(int reg1,int reg2){
-	//mov reg1,reg2
-	char RexByte=-1;
-
-	if(reg1==reg2) return;
-
-	if(REG_RAX<=reg1&&reg1<=REG_RDI){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-	}
-	if(REG_R8<=reg1&&reg1<=REG_R15){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	// [8bit rex] 1000 1011 11xx xbbb
-	OpBuffer[obp++]=RexByte;
-	OpBuffer[obp++]=(char)0x8B;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-
-
-
-///////////////////
-// mov64関連
-///////////////////
-
-void op_mov64_ToReg(int reg,_int64 i64data){
-	//mov reg,i64data
-
-	if(REG_RAX<=reg&&reg<=REG_RDI){
-		/*	rax～rdi
-			0100 1000 1011 1xxx [64bit data]	*/
-		OpBuffer[obp++]=(char)0x48;
-		OpBuffer[obp++]=(char)(0xB8| REGISTER_OPERAND(reg) );
-		*((_int64 *)(OpBuffer+obp))=i64data;
-		obp+=sizeof(_int64);
-	}
-	if(REG_R8<=reg&&reg<=REG_R15){
-		/*	r8～r15
-			0100 1001 1011 1xxx [64bit data]	*/
-		OpBuffer[obp++]=(char)0x49;
-		OpBuffer[obp++]=(char)(0xB8| REGISTER_OPERAND(reg) );
-		*((_int64 *)(OpBuffer+obp))=i64data;
-		obp+=sizeof(_int64);
-	}
-}
-void op_mov64_ToReg(int reg,int i32data){
-	//mov reg,i32data
-
-	if(REG_RAX<=reg&&reg<=REG_RDI){
-		/*	rax～rdi
-			0100 1000 1100 0111 1100 0xxx [32bit data]	*/
-		OpBuffer[obp++]=(char)0x48;
-		OpBuffer[obp++]=(char)0xC7;
-		OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg) );
-		*((long *)(OpBuffer+obp))=i32data;
-		obp+=sizeof(long);
-	}
-	if(REG_R8<=reg&&reg<=REG_R15){
-		/*	r8～r15
-			0100 1001 1100 0111 1100 0xxx [32bit data]	*/
-		OpBuffer[obp++]=(char)0x49;
-		OpBuffer[obp++]=(char)0xC7;
-		OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg) );
-		*((long *)(OpBuffer+obp))=i32data;
-		obp+=sizeof(long);
-	}
-}
-void op_movsxd(int reg64,int reg32){
-	//movsxd reg64,reg32
-	char RexByte=-1;
-
-	if(REG_RAX<=reg64&&reg64<=REG_RDI){
-		if(REG_RAX<=reg32&&reg32<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg32&&reg32<=REG_R15) RexByte=(char)0x49;
-	}
-	if(REG_R8<=reg64&&reg64<=REG_R15){
-		if(REG_RAX<=reg32&&reg32<=REG_RDI) RexByte=(char)0x4C;
-		if(REG_R8<=reg32&&reg32<=REG_R15) RexByte=(char)0x4D;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0110 0011 11rr rbbb
-	OpBuffer[obp++]=RexByte;
-	OpBuffer[obp++]=(char)0x63;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg64)<<3 | REGISTER_OPERAND(reg32));
-}
-void op_movsx64_FromReg16(int reg64,int reg16){
-	//movsx reg64,reg16
-	char RexByte=-1;
-
-	if(REG_RAX<=reg64&&reg64<=REG_RDI){
-		if(REG_RAX<=reg16&&reg16<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg16&&reg16<=REG_R15) RexByte=(char)0x49;
-	}
-	if(REG_R8<=reg64&&reg64<=REG_R15){
-		if(REG_RAX<=reg16&&reg16<=REG_RDI) RexByte=(char)0x4C;
-		if(REG_R8<=reg16&&reg16<=REG_R15) RexByte=(char)0x4D;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0000 1111 1011 1111 11rr rbbb
-	OpBuffer[obp++]=RexByte;
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0xBF;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg64)<<3 | REGISTER_OPERAND(reg16));
-}
-void op_movsx64_FromReg8(int reg64,int reg8){
-	//movsx reg64,reg8
-	char RexByte=-1;
-
-	if(REG_RAX<=reg64&&reg64<=REG_RDI){
-		if(REG_RAX<=reg8&&reg8<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x49;
-	}
-	if(REG_R8<=reg64&&reg64<=REG_R15){
-		if(REG_RAX<=reg8&&reg8<=REG_RDI) RexByte=(char)0x4C;
-		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x4D;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0000 1111 1011 1110 11rr rbbb
-	OpBuffer[obp++]=RexByte;
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0xBE;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg64)<<3 | REGISTER_OPERAND(reg8));
-}
-
-
-
-//////////////////
-// mov32関連
-//////////////////
-
-void op_movsx32_FromReg16(int reg32,int reg16){
-	//movsx reg32,reg16
-	char RexByte=-1;
-
-	if(REG_RAX<=reg32&&reg32<=REG_RDI){
-		if(REG_RAX<=reg16&&reg16<=REG_RDI) RexByte=0;
-		if(REG_R8<=reg16&&reg16<=REG_R15) RexByte=(char)0x41;
-	}
-	if(REG_R8<=reg32&&reg32<=REG_R15){
-		if(REG_RAX<=reg16&&reg16<=REG_RDI) RexByte=(char)0x44;
-		if(REG_R8<=reg16&&reg16<=REG_R15) RexByte=(char)0x45;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0000 1111 1011 1111 11rr rbbb
-	if(RexByte) OpBuffer[obp++]=RexByte;
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0xBF;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg32)<<3 | REGISTER_OPERAND(reg16));
-}
-void op_movsx32_FromReg8(int reg32,int reg8){
-	//movsx reg32,reg8
-	char RexByte=-1;
-
-	if(REG_RAX<=reg32&&reg32<=REG_RDI){
-		if(REG_RAX<=reg8&&reg8<=REG_RBX) RexByte=0;
-		if(REG_RSP<=reg8&&reg8<=REG_RDI) RexByte=(char)0x40;
-		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x41;
-	}
-	if(REG_R8<=reg32&&reg32<=REG_R15){
-		if(REG_RAX<=reg8&&reg8<=REG_RDI) RexByte=(char)0x44;
-		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x45;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0000 1111 1011 1110 11rr rbbb
-	if(RexByte) OpBuffer[obp++]=RexByte;
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0xBE;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg32)<<3 | REGISTER_OPERAND(reg8));
-}
-
-
-
-/////////////////////
-// mov16関連
-/////////////////////
-
-void op_movsx16_FromReg8(int reg32,int reg8){
-	//movsx reg16,reg8
-	char RexByte=-1;
-
-	if(REG_RAX<=reg32&&reg32<=REG_RDI){
-		if(REG_RAX<=reg8&&reg8<=REG_RBX) RexByte=0;
-		if(REG_RSP<=reg8&&reg8<=REG_RDI) RexByte=(char)0x40;
-		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x41;
-	}
-	if(REG_R8<=reg32&&reg32<=REG_R15){
-		if(REG_RAX<=reg8&&reg8<=REG_RDI) RexByte=(char)0x44;
-		if(REG_R8<=reg8&&reg8<=REG_R15) RexByte=(char)0x45;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//0110 0110 [8bit rex] 0000 1111 1011 1110 11rr rbbb
-	OpBuffer[obp++]=(char)0x66;
-	if(RexByte) OpBuffer[obp++]=RexByte;
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0xBE;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg32)<<3 | REGISTER_OPERAND(reg8));
-}
-
-
-
-//////////////////////////////////
-// インクリメント・デクリメント
-//////////////////////////////////
-
-void op_inc(int reg){
-	//inc reg
-
-	//16ビット演算の命令プリフィックス
-	char op_prefix=0;
-
-	//オペコード
-	char opcode=(char)0xFF;
-
-	__op_format(sizeof(_int64),op_prefix,opcode,0,0,reg,0,MOD_REG);
-}
-void op_dec(int reg){
-	op_inc(reg);
-	OpBuffer[obp-1]=OpBuffer[obp-1]|0x08;
-}
-
-
-
-/////////////////////
-// add関連
-/////////////////////
-
-void op_add_RM(int op_size,int reg,int base_reg,int offset,char mod){
-	//add reg64,qword ptr[base_reg+offset]
-	//add reg32,dword ptr[base_reg+offset]
-	//add reg16,word ptr[base_reg+offset]
-	//add reg8,byte ptr[base_reg+offset]
-
-	//16ビット演算の命令プリフィックス
-	char op_prefix=0;
-	if(op_size==sizeof(short)) op_prefix=(char)0x66;
-
-	//オペコード
-	char opcode;
-	if(op_size==sizeof(char)) opcode=(char)0x02;
-	else opcode=(char)0x03;
-
-	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod);
-}
-
-void op_add_RV(int reg,int offset){
-	//add reg,offset
-	char RexByte=-1;
-
-	if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0x48;
-	if(REG_R8<=reg&&reg<=REG_R15) RexByte=0x49;
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	if(reg==REG_RAX){
-		//raxのみ特殊
-
-		// [8bit rex] 0000 0101 [32bit offset]
-		OpBuffer[obp++]=(char)RexByte;
-		OpBuffer[obp++]=(char)0x05;
-		*((long *)(OpBuffer+obp))=offset;
-		obp+=sizeof(long);
-	}
-	else{
-		//rax以外
-
-		//[8bit rex] 1000 0001 1100 0xxx [32bit offset]
-		OpBuffer[obp++]=(char)RexByte;
-		OpBuffer[obp++]=(char)0x81;
-		OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg));
-		*((long *)(OpBuffer+obp))=offset;
-		obp+=sizeof(long);
-	}
-}
-void op_add64_reg(int reg1,int reg2){
-	//add reg1,reg2
-	char RexByte=-1;
-
-	if(REG_RAX<=reg1&&reg1<=REG_RDI){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-	}
-	if(REG_R8<=reg1&&reg1<=REG_R15){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0000 0011 11rr rbbb
-	OpBuffer[obp++]=(char)RexByte;
-	OpBuffer[obp++]=(char)0x03;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-void op_add32_reg(int reg1,int reg2){
-	//add reg1,reg2
-	char RexByte=-1;
-
-	if(REG_RAX<=reg1&&reg1<=REG_RDI){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
-	}
-	if(REG_R8<=reg1&&reg1<=REG_R15){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0000 0011 11rr rbbb
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-	OpBuffer[obp++]=(char)0x03;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-
-
-
-////////////////////////
-// sub関連
-////////////////////////
-
-void op_sub_RV(int op_size,int reg,int i32data){
-	//sub reg,i32data
-
-	//rexプリフィックス
-	set_rex(op_size,REG_NON,REG_NON,reg);
-
-	if(reg==REG_RAX){
-		//raxのみ特殊
-		OpBuffer[obp++]=(char)0x2D;
-	}
-	else{
-		//オペコード
-		OpBuffer[obp++]=(char)0x81;
-
-		//レジスタ
-		OpBuffer[obp++]=(char)(0xE8| REGISTER_OPERAND(reg) );
-	}
-
-	//即値
-	*((long *)(OpBuffer+obp))=i32data;
-	obp+=sizeof(long);
-}
-void op_sub64_reg(int reg1,int reg2){
-	//sub reg1,reg2
-	char RexByte=-1;
-
-	if(REG_RAX<=reg1&&reg1<=REG_RDI){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-	}
-	if(REG_R8<=reg1&&reg1<=REG_R15){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0010 1011 11rr rbbb
-	OpBuffer[obp++]=(char)RexByte;
-	OpBuffer[obp++]=(char)0x2B;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-void op_sub32_reg(int reg1,int reg2){
-	//sub reg1,reg2
-	char RexByte=-1;
-
-	if(REG_RAX<=reg1&&reg1<=REG_RDI){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
-	}
-	if(REG_R8<=reg1&&reg1<=REG_R15){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 0010 1011 11rr rbbb
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-	OpBuffer[obp++]=(char)0x2B;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-void op_sbb_RR( int op_size, int reg1, int reg2 ){
-	//sbb reg1,reg2
-
-	//rexプリフィックス
-	set_rex(0,reg1,0,reg2);
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x1B;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-
-
-
-////////////////////////
-// imul関連
-////////////////////////
-
-void op_imul_RR(int op_size,int reg1,int reg2){
-	//imul reg1,reg2
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-		}
-	}
-	else{
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
-		}
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0xAF;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-void op_imul_RV(int op_size,int reg,int i32data){
-	//imul reg,i32data
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x4D;
-	}
-	else{
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x45;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	if(-128<=i32data&&i32data<=127){
-		//オペコード
-		OpBuffer[obp++]=(char)0x6B;
-
-		//レジスタ
-		OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(reg));
-
-		//値
-		OpBuffer[obp++]=(char)i32data;
-	}
-	else{
-		//オペコード
-		OpBuffer[obp++]=(char)0x69;
-
-		//レジスタ
-		OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(reg));
-
-		//値
-		*((long *)(OpBuffer+obp))=i32data;
-		obp+=sizeof(long);
-	}
-}
-
-
-
-////////////////////////
-// div、idiv関連
-////////////////////////
-
-void op_div64_reg(int reg){
-	//div reg
-	char RexByte=-1;
-
-	if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-	if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//rexプリフィックス
-	OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF7;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xF0| REGISTER_OPERAND(reg));
-}
-void op_idiv64_reg(int reg){
-	//idiv reg
-	char RexByte=-1;
-
-	if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-	if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//rexプリフィックス
-	OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF7;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xF8| REGISTER_OPERAND(reg));
-}
-
-
-
-////////////////////
-// ビットシフト関連
-////////////////////
-
-void op_shl_reg(int op_size,int reg){
-	//shl reg,cl
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
-	}
-	else if(op_size==sizeof(char)){
-		if(REG_RAX<=reg&&reg<=REG_RBX) RexByte=0;
-		if(REG_RSP<=reg&&reg<=REG_RDI) RexByte=(char)0x40;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-	}
-	else{
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//16ビット演算のプリフィックス
-	if(op_size==sizeof(short)) OpBuffer[obp++]=(char)0x66;
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	if(op_size==sizeof(char)) OpBuffer[obp++]=(char)0xD2;
-	else OpBuffer[obp++]=(char)0xD3;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xE0| REGISTER_OPERAND(reg));
-}
-void op_sar_reg(int op_size,int reg){
-	//sar reg,cl
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
-	}
-	else if(op_size==sizeof(char)){
-		if(REG_RAX<=reg&&reg<=REG_RBX) RexByte=0;
-		if(REG_RSP<=reg&&reg<=REG_RDI) RexByte=(char)0x40;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-	}
-	else{
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//16ビット演算のプリフィックス
-	if(op_size==sizeof(short)) OpBuffer[obp++]=(char)0x66;
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	if(op_size==sizeof(char)) OpBuffer[obp++]=(char)0xD2;
-	else OpBuffer[obp++]=(char)0xD3;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xF8| REGISTER_OPERAND(reg));
-}
-void op_shr_reg(int op_size,int reg){
-	//shr reg,cl
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
-	}
-	else if(op_size==sizeof(char)){
-		if(REG_RAX<=reg&&reg<=REG_RBX) RexByte=0;
-		if(REG_RSP<=reg&&reg<=REG_RDI) RexByte=(char)0x40;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-	}
-	else{
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//16ビット演算のプリフィックス
-	if(op_size==sizeof(short)) OpBuffer[obp++]=(char)0x66;
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	if(op_size==sizeof(char)) OpBuffer[obp++]=(char)0xD2;
-	else OpBuffer[obp++]=(char)0xD3;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xE8| REGISTER_OPERAND(reg));
-}
-
-
-
-////////////////////
-// and 関連
-////////////////////
-
-void op_and_reg(int op_size,int reg1,int reg2){
-	//and reg1,reg2
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-		}
-	}
-	else{
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
-		}
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x23;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-void op_and64_value(int reg,int offset){
-	//and reg,offset
-	char RexByte=-1;
-
-	if(REG_RAX<=reg&&reg<=REG_RDI) (char)RexByte=0x48;
-	if(REG_R8<=reg&&reg<=REG_R15) (char)RexByte=0x49;
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	if(reg==REG_RAX){
-		//raxのみ特殊
-
-		// [8bit rex] 0010 0101 [32bit offset]
-		OpBuffer[obp++]=(char)RexByte;
-		OpBuffer[obp++]=(char)0x25;
-		*((long *)(OpBuffer+obp))=offset;
-		obp+=sizeof(long);
-	}
-	else{
-		//rax以外
-
-		//[8bit rex] 1000 0001 1100 0xxx [32bit offset]
-		OpBuffer[obp++]=(char)RexByte;
-		OpBuffer[obp++]=(char)0x81;
-		OpBuffer[obp++]=(char)(0xE0| REGISTER_OPERAND(reg));
-		*((long *)(OpBuffer+obp))=offset;
-		obp+=sizeof(long);
-	}
-}
-void op_and32_value(int reg,int offset){
-	//and reg,offset
-	char RexByte=-1;
-
-	if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
-	if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	if(reg==REG_RAX){
-		//eaxのみ特殊
-
-		// [8bit rex] 0010 0101 [32bit offset]
-		OpBuffer[obp++]=(char)0x25;
-		*((long *)(OpBuffer+obp))=offset;
-		obp+=sizeof(long);
-	}
-	else{
-		//eax以外
-
-		//[8bit rex] 1000 0001 1100 0xxx [32bit offset]
-		if(RexByte) OpBuffer[obp++]=(char)RexByte;
-		OpBuffer[obp++]=(char)0x81;
-		OpBuffer[obp++]=(char)(0xE0| REGISTER_OPERAND(reg));
-		*((long *)(OpBuffer+obp))=offset;
-		obp+=sizeof(long);
-	}
-}
-
-
-
-////////////////////////
-// or 関連
-////////////////////////
-
-void op_or_reg(int op_size,int reg1,int reg2){
-	//or reg1,reg2
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-		}
-	}
-	else{
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
-		}
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0B;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-
-
-
-////////////////////////
-// xor 関連
-////////////////////////
-
-void op_xor_reg(int op_size,int reg1,int reg2){
-	//xor reg1,reg2
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-		}
-	}
-	else{
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
-		}
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x33;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-
-
-
-///////////////////////
-// not 関連
-///////////////////////
-
-void op_not_reg(int op_size,int reg){
-	//not reg
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
-	}
-	else{
-		if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
-		if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF7;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xD0| REGISTER_OPERAND(reg));
-}
-void op_neg( int reg ){
-	//neg reg
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF7;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xD8| REGISTER_OPERAND(reg));
-}
-
-
-
-////////////////////
-// test関連
-////////////////////
-
-void op_test(int reg1,int reg2){
-	//test reg1,reg2
-	char RexByte=-1;
-
-	if(REG_RAX<=reg1&&reg1<=REG_RDI){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-	}
-	if(REG_R8<=reg1&&reg1<=REG_R15){
-		if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-		if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-	//[8bit rex] 1000 0101 11rr rbbb
-	OpBuffer[obp++]=(char)RexByte;
-	OpBuffer[obp++]=(char)0x85;
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-
-
-
-/////////////////////
-// cmp 関連
-/////////////////////
-
-void op_cmp_reg(int op_size,int reg1,int reg2){
-	//cmp reg1,reg2
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x48;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x49;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x4C;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x4D;
-		}
-	}
-	else{
-		if(REG_RAX<=reg1&&reg1<=REG_RDI){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=0;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x41;
-		}
-		if(REG_R8<=reg1&&reg1<=REG_R15){
-			if(REG_RAX<=reg2&&reg2<=REG_RDI) RexByte=(char)0x44;
-			if(REG_R8<=reg2&&reg2<=REG_R15) RexByte=(char)0x45;
-		}
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x3B;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg1)<<3 | REGISTER_OPERAND(reg2));
-}
-void op_cmp_value(int op_size,int reg,char byte_data){
-	//cmp reg,byte_data
-
-	if(op_size==sizeof(char)&&reg==REG_RAX){
-		//alレジスタの場合は特殊
-		OpBuffer[obp++]=(char)0x3C;
-
-		//8ビット値
-		OpBuffer[obp++]=byte_data;
-
-		return;
-	}
-
-	//16ビット演算のプリフィックス
-	if(op_size==sizeof(short)) OpBuffer[obp++]=(char)0x66;
-
-	//rexプリフィックス
-	set_rex(op_size,REG_NON,REG_NON,reg);
-
-	//オペコード
-	if(op_size==sizeof(char)) OpBuffer[obp++]=(char)0x80;
-	else OpBuffer[obp++]=(char)0x83;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xF8| REGISTER_OPERAND(reg));
-
-	//8ビット値
-	OpBuffer[obp++]=byte_data;
-}
-void op_setne( int reg ){
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x95;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)( 0xC0 | REGISTER_OPERAND(reg) );
-}
-
-
-////////////////////
-// SSE2関連
-////////////////////
-
-void op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod){
-	//movlpd qword ptr[base_reg+offset],xmm_reg
-	__op_format(0,(char)0x66,(char)0x0F,(char)0x13,xmm_reg,base_reg,offset,mod);
-}
-void op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod){
-	//movlpd xmm_reg,qword ptr[base_reg+offset]
-	__op_format(0,(char)0x66,(char)0x0F,(char)0x12,xmm_reg,base_reg,offset,mod);
-}
-void op_movsd_RR(int xmm_reg1,int xmm_reg2){
-	if(xmm_reg1==xmm_reg2) return;
-
-	//movsd xmm_reg1,xmm_reg2
-	__op_format(0,(char)0xF2,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG);
-}
-void op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod){
-	//movsd qword ptr[reg+offset],xmm_reg
-	//movsd qword ptr[reg],xmm_reg
-	__op_format(0,(char)0xF2,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod);
-}
-void op_movss_RR(int xmm_reg1,int xmm_reg2){
-	if(xmm_reg1==xmm_reg2) return;
-
-	//movss xmm_reg1,xmm_reg2
-	__op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg1,xmm_reg2,0,MOD_REG);
-}
-void op_movss_RM(int xmm_reg,int base_reg,int offset,char mod){
-	//movss xmm_reg,dword ptr[base_reg+offset]
-	__op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg,base_reg,offset,mod);
-}
-void op_movss_MR(int xmm_reg,int base_reg,int offset,char mod){
-	//movss dword ptr[reg+offset],xmm_reg
-	//movss dword ptr[reg],xmm_reg
-	__op_format(0,(char)0xF3,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod);
-}
-
-void op_movd_RX(int reg,int xmm_reg){
-	__op_format(sizeof(_int64),(char)0x66,(char)0x0F,(char)0x7E,xmm_reg,reg,0,MOD_REG);
-}
-
-void op_cvtsd2ss(int xmm_reg1,int xmm_reg2){
-	//cvtsd2ss xmm_reg1,xmm_reg2
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF2;
-
-	//rexプリフィックス
-	set_rex(sizeof(long),xmm_reg1,0,xmm_reg2);
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x5A;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(xmm_reg1)<<3 | REGISTER_OPERAND(xmm_reg2));
-}
-void op_cvtss2sd(int xmm_reg1,int xmm_reg2){
-	//cvtss2sd xmm_reg1,xmm_reg2
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF3;
-
-	//rexプリフィックス
-	set_rex(0,xmm_reg1,0,xmm_reg2);
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x5A;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(xmm_reg1)<<3 | REGISTER_OPERAND(xmm_reg2));
-}
-void op_cvttsd2si_xmm(int op_size,int reg,int xmm_reg){
-	//cvttsd2si reg,xmm_reg
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF2;
-
-	//rexプリフィックス
-	set_rex(op_size,reg,0,xmm_reg);
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x2C;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(xmm_reg));
-}
-void op_cvttss2si_xmm(int op_size,int reg,int xmm_reg){
-	//cvttss2si reg,xmm_reg
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF3;
-
-	//rexプリフィックス
-	set_rex(op_size,reg,0,xmm_reg);
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x2C;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(xmm_reg));
-}
-void op_cvtsi2sd_reg(int op_size,int xmm_reg,int reg){
-	//cvtsi2sd xmm_reg,reg
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_XMM0<=xmm_reg&&xmm_reg<=REG_XMM7){
-			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
-		}
-		if(REG_XMM8<=xmm_reg&&xmm_reg<=REG_XMM15){
-			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x4C;
-			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x4D;
-		}
-	}
-	else{
-		if(REG_XMM0<=xmm_reg&&xmm_reg<=REG_XMM7){
-			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
-			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-		}
-		if(REG_XMM8<=xmm_reg&&xmm_reg<=REG_XMM15){
-			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x44;
-			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x45;
-		}
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF2;
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x2A;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(xmm_reg)<<3 | REGISTER_OPERAND(reg));
-}
-void op_cvtsi2ss_reg(int op_size,int xmm_reg,int reg){
-	//cvtsi2ss xmm_reg,reg
-	char RexByte=-1;
-
-	if(op_size==sizeof(_int64)){
-		if(REG_XMM0<=xmm_reg&&xmm_reg<=REG_XMM7){
-			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x48;
-			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x49;
-		}
-		if(REG_XMM8<=xmm_reg&&xmm_reg<=REG_XMM15){
-			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x4C;
-			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x4D;
-		}
-	}
-	else{
-		if(REG_XMM0<=xmm_reg&&xmm_reg<=REG_XMM7){
-			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=0;
-			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x41;
-		}
-		if(REG_XMM8<=xmm_reg&&xmm_reg<=REG_XMM15){
-			if(REG_RAX<=reg&&reg<=REG_RDI) RexByte=(char)0x44;
-			if(REG_R8<=reg&&reg<=REG_R15) RexByte=(char)0x45;
-		}
-	}
-
-	if(RexByte==-1) SetError(300,NULL,cp);
-
-
-	//オペコード
-	OpBuffer[obp++]=(char)0xF3;
-
-	//rexプリフィックス
-	if(RexByte) OpBuffer[obp++]=(char)RexByte;
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x2A;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(xmm_reg)<<3 | REGISTER_OPERAND(reg));
-}
-void op_comisd(int xmm_reg1,int xmm_reg2){
-	//comisd xmm_reg1,xmm_reg2
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x66;
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x2F;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(xmm_reg1)<<3 | REGISTER_OPERAND(xmm_reg2));
-}
-void op_comiss(int xmm_reg1,int xmm_reg2){
-	//comiss xmm_reg1,xmm_reg2
-
-	//オペコード
-	OpBuffer[obp++]=(char)0x0F;
-	OpBuffer[obp++]=(char)0x2F;
-
-	//レジスタ
-	OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(xmm_reg1)<<3 | REGISTER_OPERAND(xmm_reg2));
-}
-
-
-
-/////////////////////
-// ストリング関係
-/////////////////////
-
-void op_rep_movs(int op_size){
-	if(op_size==sizeof(BYTE)){
-		//rep movs byte ptr[edi],byte ptr[esi]
-		OpBuffer[obp++]=(char)0xF3;
-		OpBuffer[obp++]=(char)0xA4;
-	}
-	else if(op_size==sizeof(short)){
-		//rep movs word ptr[edi],word ptr[esi]
-		OpBuffer[obp++]=(char)0xF3;
-		OpBuffer[obp++]=(char)0x66;
-		OpBuffer[obp++]=(char)0xA5;
-	}
-	else if(op_size==sizeof(long)){
-		//rep movs dword ptr[edi],dword ptr[esi]
-		OpBuffer[obp++]=(char)0xF3;
-		OpBuffer[obp++]=(char)0xA5;
-	}
-}
-
-
-
-
-void op_add_rsp(int num){
-	//スタックポインタの加算（pop方向）
-
-	//add rsp,num
-	if(0xFFFFFF80&num){
-		OpBuffer[obp++]=(char)0x48;
-		OpBuffer[obp++]=(char)0x81;
-		OpBuffer[obp++]=(char)0xC4;
-		*((long *)(OpBuffer+obp))=num;
-		obp+=sizeof(long);
-	}
-	else{
-		//「-128 < num < 127」の場合
-		OpBuffer[obp++]=(char)0x48;
-		OpBuffer[obp++]=(char)0x83;
-		OpBuffer[obp++]=(char)0xC4;
-		OpBuffer[obp++]=(char)num;
-	}
-}
-void op_sub_rsp(int num){
-	//スタックポインタの減算（push方向）
-
-	//sub rsp,num
-	if(0xFFFFFF80&num){
-		OpBuffer[obp++]=(char)0x48;
-		OpBuffer[obp++]=(char)0x81;
-		OpBuffer[obp++]=(char)0xEC;
-		*((long *)(OpBuffer+obp))=num;
-		obp+=sizeof(long);
-	}
-	else{
-		//「-128 < num < 127」の場合
-		OpBuffer[obp++]=(char)0x48;
-		OpBuffer[obp++]=(char)0x83;
-		OpBuffer[obp++]=(char)0xEC;
-		OpBuffer[obp++]=(char)num;
-	}
-}
-
-
-void op_add_esp(int num){
-	//スタックポインタの加算（pop方向）
-
-	//add esp,num
-	if(0xFFFFFF80&num){
-		OpBuffer[obp++]=(char)0x81;
-		OpBuffer[obp++]=(char)0xC4;
-		*((long *)(OpBuffer+obp))=num;
-		obp+=sizeof(long);
-	}
-	else{
-		//「-128 < num < 127」の場合
-		OpBuffer[obp++]=(char)0x83;
-		OpBuffer[obp++]=(char)0xC4;
-		OpBuffer[obp++]=(char)num;
-	}
-}
-void op_sub_esp(int num){
-	//スタックポインタの減算（push方向）
-
-	//sub esp,num
-	if(0xFFFFFF80&num){
-		OpBuffer[obp++]=(char)0x81;
-		OpBuffer[obp++]=(char)0xEC;
-		*((long *)(OpBuffer+obp))=num;
-		obp+=sizeof(long);
-	}
-	else{
-		//「-128 < num < 127」の場合
-		OpBuffer[obp++]=(char)0x83;
-		OpBuffer[obp++]=(char)0xEC;
-		OpBuffer[obp++]=(char)num;
-	}
-}
-
-
-
-//////////////////////////////
-// 浮動小数点関連
-//////////////////////////////
-
-void op_fld_ptr_esp(int type){
-	//スタックポインタが示すバッファのデータを浮動小数点レジスタへロード
-
-	if(type==DEF_DOUBLE){
-		//fld qword ptr[esp]
-		OpBuffer[obp++]=(char)0xDD;
-		OpBuffer[obp++]=(char)0x04;
-		OpBuffer[obp++]=(char)0x24;
-	}
-	else if(type==DEF_SINGLE){
-		//fld dword ptr[esp]
-		OpBuffer[obp++]=(char)0xD9;
-		OpBuffer[obp++]=(char)0x04;
-		OpBuffer[obp++]=(char)0x24;
-	}
-	else if(type==DEF_INT64){
-		//fild qword ptr[esp]
-		OpBuffer[obp++]=(char)0xDF;
-		OpBuffer[obp++]=(char)0x2C;
-		OpBuffer[obp++]=(char)0x24;
-	}
-	else if(type==DEF_LONG){
-		//fild dword ptr[esp]
-		OpBuffer[obp++]=(char)0xDB;
-		OpBuffer[obp++]=(char)0x04;
-		OpBuffer[obp++]=(char)0x24;
-	}
-}
-
-
-
-//////////////////////////////
-// レジスタ関連
-//////////////////////////////
-
-void op_zero_reg(int reg){
-	//レジスタに0をセット
-
-	if(REG_RAX<=reg&&reg<=REG_RDI){
-		/*	rax～rdi
-			0100 1000 0011 0011 11 xxx xxx	*/
-		OpBuffer[obp++]=(char)0x48;
-		OpBuffer[obp++]=(char)0x33;
-		OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(reg));
-	}
-	if(REG_R8<=reg&&reg<=REG_R15){
-		/*	r8～r15
-			0100 1101 0011 0011 11 xxx xxx	*/
-		OpBuffer[obp++]=(char)0x4D;
-		OpBuffer[obp++]=(char)0x33;
-		OpBuffer[obp++]=(char)(0xC0| REGISTER_OPERAND(reg)<<3 | REGISTER_OPERAND(reg));
-	}
-}
-
-
-
-/////////////////////////////
-// 関数呼び出し
-/////////////////////////////
-
-void op_call( const UserProc *pUserProc ){
-	OpBuffer[obp++] = (char)0xE8;
-	pobj_SubAddrSchedule->add( pUserProc, 1 );
-	pUserProc->Using();
-	obp += sizeof(long);
-}
-void op_call( const DllProc *pDllProc ){
-	OpBuffer[obp++] = (char)0xFF;
-	OpBuffer[obp++] = (char)0x15;
-	pobj_ImportAddrSchedule->add(pDllProc);
-	obp += sizeof(long);
-
-	pDllProc->Using();
-}
-void op_ret(){
-	OpBuffer[obp++]=(char)0xC3;
-}
Index: /trunk/abdev/BasicCompiler64/increment.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/increment.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/increment.cpp	(revision 226)
@@ -1,3 +1,5 @@
 #include "stdafx.h"
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -47,9 +49,9 @@
 			if(idCalc==CALC_ADDITION){
 				//インクリメント
-				op_inc(REG_RAX);
+				compiler.codeGenerator.op_inc(REG_RAX);
 			}
 			else if(idCalc==CALC_SUBTRACTION){
 				//デクリメント
-				op_dec(REG_RAX);
+				compiler.codeGenerator.op_dec(REG_RAX);
 			}
 	}
Index: /trunk/abdev/BasicCompiler64/stack_frame.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/stack_frame.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler64/stack_frame.cpp	(revision 226)
@@ -1,3 +1,5 @@
 #include "stdafx.h"
+
+#include <Compiler.h>
 
 #include "../BasicCompiler_Common/common.h"
@@ -42,8 +44,8 @@
 void CStackFrame::mov_sp( int reg ){
 	//mov reg,rsp
-	op_mov_RR( reg, REG_RSP );
+	compiler.codeGenerator.op_mov_RR( reg, REG_RSP );
 
 	//add reg,now_sp
-	op_add_RV( reg, now_sp );
+	compiler.codeGenerator.op_add_RV( reg, now_sp );
 
 	//スケジュールをセット
@@ -59,5 +61,5 @@
 
 	//mov qword ptr[rsp+offset],reg
-	op_mov_MR(sizeof(_int64),reg,REG_RSP,now_sp,MOD_BASE_DISP32);
+	compiler.codeGenerator.op_mov_MR(sizeof(_int64),reg,REG_RSP,now_sp,MOD_BASE_DISP32);
 
 	//スケジュールをセット
@@ -74,5 +76,5 @@
 	if(varSize==sizeof(double)){
 		//movlpd qword ptr[rsp+offset],xmm_reg
-		op_movlpd_MR(xmm_reg,REG_RSP,now_sp,MOD_BASE_DISP32);
+		compiler.codeGenerator.op_movlpd_MR(xmm_reg,REG_RSP,now_sp,MOD_BASE_DISP32);
 	}
 	if(varSize==sizeof(float)){
@@ -94,5 +96,5 @@
 void CStackFrame::ref_offset_data( int reg, int sp_offset ){
 	//mov reg,qword ptr[rsp+offset]     ※スタックフレームを利用
-	op_mov_RM(sizeof(_int64),reg,REG_RSP,sp_offset,MOD_BASE_DISP32);
+	compiler.codeGenerator.op_mov_RM(sizeof(_int64),reg,REG_RSP,sp_offset,MOD_BASE_DISP32);
 
 	//スケジュールをセット
@@ -107,5 +109,5 @@
 	if(varSize==sizeof(double)){
 		//movlpd xmm_reg,qword ptr[rsp+offset]
-		op_movlpd_RM(xmm_reg,REG_RSP,now_sp,MOD_BASE_DISP32);
+		compiler.codeGenerator.op_movlpd_RM(xmm_reg,REG_RSP,now_sp,MOD_BASE_DISP32);
 	}
 	if(varSize==sizeof(float)){
Index: /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h	(revision 225)
+++ /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h	(revision 226)
@@ -32,4 +32,80 @@
 
 #ifdef _AMD64_
+private:
+	void set_rex(int op_size,int reg,int index_reg,int base_reg);
+	void set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp);
+	void __op_format(int op_size,char op_prefix,char opcode1,char opcode2,int reg,int base_reg,long offset,char mod);
+public:
+	void op_mov_RV					(int op_size,int reg,long i32data);
+	void op_mov_RV64				(int reg,_int64 i64data);
+	void op_mov_RM					(int op_size,int reg,int base_reg,long offset,char mod);
+	void op_mov_RM_ex				(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset);
+	void op_mov_MR					(int op_size,int reg,int base_reg,long offset,char mod);
+	void op_mov_MR_ex				(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset);
+	void op_mov_MV					(int op_size,int base_reg,int offset,BOOL bUseOffset,long i32data);
+	void op_mov_RR					(int reg1,int reg2);
+	void op_mov64_ToReg				(int reg,_int64 i64data);
+	void op_mov64_ToReg				(int reg,long i32data);
+	void op_movsxd					(int reg64,int reg32);
+	void op_movsx64_FromReg16		(int reg64,int reg16);
+	void op_movsx64_FromReg8		(int reg64,int reg8);
+	void op_movsx32_FromReg16		(int reg32,int reg16);
+	void op_movsx32_FromReg8		(int reg32,int reg8);
+	void op_movsx16_FromReg8		(int reg32,int reg8);
+	void op_inc						(int reg);
+	void op_dec						(int reg);
+	void op_add_RM					(int op_size,int reg,int base_reg,int offset,char mod);
+	void op_add_RV					(int reg,long offset);
+	void op_add64_reg				(int reg1,int reg2);
+	void op_add32_reg				(int reg1,int reg2);
+	void op_sub_RV					(int op_size,int reg,long i32data);
+	void op_sub64_reg				(int reg1,int reg2);
+	void op_sub32_reg				(int reg1,int reg2);
+	void op_sbb_RR					( int op_size, int reg1, int reg2 );
+	void op_imul_RR					(int op_size,int reg1,int reg2);
+	void op_imul_RV					(int op_size,int reg,long i32data);
+	void op_div64_reg				(int reg);
+	void op_idiv64_reg				(int reg);
+	void op_shl_reg					(int op_size,int reg);
+	void op_sar_reg					(int op_size,int reg);
+	void op_shr_reg					(int op_size,int reg);
+	void op_and_reg					(int op_size,int reg1,int reg2);
+	void op_and64_value				(int reg,long offset);
+	void op_and32_value				(int reg,long offset);
+	void op_or_reg					(int op_size,int reg1,int reg2);
+	void op_xor_reg					(int op_size,int reg1,int reg2);
+	void op_not_reg					(int op_size,int reg);
+	void op_neg						( int reg );
+	void op_test					(int reg1,int reg2);
+	void op_cmp_reg					(int op_size,int reg1,int reg2);
+	void op_cmp_value				(int op_size,int reg,char byte_data);
+	void op_setne					(int reg);
+	void op_movlpd_MR				(int xmm_reg,int base_reg,int offset,char mod);
+	void op_movlpd_RM				(int xmm_reg,int base_reg,int offset,char mod);
+	void op_movsd_RR				(int xmm_reg1,int xmm_reg2);
+	void op_movsd_MR				(int xmm_reg,int base_reg,int offset,char mod);
+	void op_movss_RR				(int xmm_reg1,int xmm_reg2);
+	void op_movss_RM				(int xmm_reg,int base_reg,int offset,char mod);
+	void op_movss_MR				(int xmm_reg,int base_reg,int offset,char mod);
+	void op_movd_RX					(int reg,int xmm_reg);
+	void op_cvtsd2ss				(int xmm_reg1,int xmm_reg2);
+	void op_cvtss2sd				(int xmm_reg1,int xmm_reg2);
+	void op_cvttsd2si_xmm			(int op_size,int reg,int xmm_reg);
+	void op_cvttss2si_xmm			(int op_size,int reg,int xmm_reg);
+	void op_cvtsi2sd_reg			(int op_size,int xmm_reg,int reg);
+	void op_cvtsi2ss_reg			(int op_size,int xmm_reg,int reg);
+	void op_comisd					(int xmm_reg1,int xmm_reg2);
+	void op_comiss					(int xmm_reg1,int xmm_reg2);
+	void op_rep_movs				(int op_size);
+	void op_add_rsp(long num);
+	void op_sub_rsp(long num);
+	void op_add_esp(long num);
+	void op_sub_esp(long num);
+	void op_fld_ptr_esp(int type);
+	void op_zero_reg(int reg);
+	void op_call( const UserProc *pUserProc );
+	void op_call( const DllProc *pDllProc );
+	void op_ret();
+
 #else
 private:
Index: /trunk/abdev/BasicCompiler_Common/include/NativeCode.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/NativeCode.h	(revision 225)
+++ /trunk/abdev/BasicCompiler_Common/include/NativeCode.h	(revision 226)
@@ -132,5 +132,5 @@
 		extern char *OpBuffer;
 		extern int obp;
-		memcpy( OpBuffer, codeBuffer, size );
+		memcpy( OpBuffer + obp, codeBuffer, size );
 		obp += size;
 	}
@@ -139,15 +139,7 @@
 		Put( nativeCode.codeBuffer, nativeCode.size );
 	}
-	void Put( char c )
+	void Put( _int64 i64data )
 	{
-		codeBuffer[size++] = c;
-		Realloc();
-
-
-
-		// 未完成
-		extern char *OpBuffer;
-		extern int obp;
-		OpBuffer[obp++]=c;
+		Put( (const char *)(&i64data), sizeof(_int64) );
 	}
 	void Put( long l, Schedule::Type scheduleType = Schedule::None )
@@ -169,3 +161,19 @@
 		obp+=sizeof(long);
 	}
+	void Put( short s )
+	{
+		Put( (const char *)(&s), sizeof(short) );
+	}
+	void Put( char c )
+	{
+		codeBuffer[size++] = c;
+		Realloc();
+
+
+
+		// 未完成
+		extern char *OpBuffer;
+		extern int obp;
+		OpBuffer[obp++]=c;
+	}
 };
Index: /trunk/abdev/BasicCompiler_Common/src/LexicalScopingImpl.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/LexicalScopingImpl.cpp	(revision 225)
+++ /trunk/abdev/BasicCompiler_Common/src/LexicalScopingImpl.cpp	(revision 226)
@@ -98,5 +98,5 @@
 
 			//mov rcx,qword ptr[rsp+offset]
-			op_mov_RM(sizeof(_int64),REG_RCX,REG_RSP,
+			compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RCX,REG_RSP,
 				-pVar->GetOffsetAddress(),
 				MOD_BASE_DISP32);
