Index: trunk/abdev/BasicCompiler64/CodeGenerator.cpp
===================================================================
--- trunk/abdev/BasicCompiler64/CodeGenerator.cpp	(revision 243)
+++ trunk/abdev/BasicCompiler64/CodeGenerator.cpp	(revision 254)
@@ -79,5 +79,8 @@
 #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, Schedule::Type scheduleType ){
+const PertialSchedule *CodeGenerator::set_mod_rm_sib_disp(char mod,int reg,int scale,int index_reg,int base_reg,long disp, Schedule::Type scheduleType, bool isPertialSchedule )
+{
+	const PertialSchedule *pPertialSchedule = NULL;
+
 	if(mod==MOD_DISP32){
 		//ModR/Mバイト
@@ -94,5 +97,5 @@
 
 	//レジスタモードの場合は、ここで終了
-	if(mod==MOD_REG) return;
+	if(mod==MOD_REG) return pPertialSchedule;
 
 
@@ -106,5 +109,5 @@
 
 	//ディスプレースメントを必要としない場合は、ここで終了
-	if(mod==MOD_BASE) return;
+	if(mod==MOD_BASE) return pPertialSchedule;
 
 
@@ -113,13 +116,25 @@
 	//////////////////////////
 
-	if(mod==MOD_BASE_DISP8) pNativeCode->Put( (char)disp );
-	else{
+	if(mod==MOD_BASE_DISP8)
+	{
+		pNativeCode->Put( (char)disp );
+	}
+	else
+	{
+		if( isPertialSchedule )
+		{
+			pertialSchedules.push_back( new PertialSchedule( pNativeCode->GetSize(), sizeof(long) ) );
+			pPertialSchedule = pertialSchedules.back();
+		}
+
 		pNativeCode->Put( disp, scheduleType );
 	}
-}
-
-
-
-void CodeGenerator::__op_format(int op_size,char op_prefix,char opcode1,char opcode2,int reg,int base_reg,long offset,char mod, Schedule::Type scheduleType ){
+
+	return pPertialSchedule;
+}
+
+
+
+const PertialSchedule *CodeGenerator::__op_format(int op_size,char op_prefix,char opcode1,char opcode2,int reg,int base_reg,long offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//命令プリフィックス
 	if(op_prefix) pNativeCode->Put( op_prefix );
@@ -133,5 +148,5 @@
 
 	//ModR/M, SIB, disp
-	set_mod_rm_sib_disp(mod,reg,SCALE_NON,INDEX_NON,base_reg,offset, scheduleType );
+	return set_mod_rm_sib_disp(mod,reg,SCALE_NON,INDEX_NON,base_reg,offset, scheduleType, isPertialSchedule );
 }
 
@@ -175,5 +190,5 @@
 	pNativeCode->Put( i64data );
 }
-void CodeGenerator::op_mov_RM(int op_size,int reg,int base_reg,long offset,char mod, Schedule::Type scheduleType ){
+const PertialSchedule *CodeGenerator::op_mov_RM(int op_size,int reg,int base_reg,long offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//mov reg64,qword ptr[base_reg+offset]
 	//mov reg32,dword ptr[base_reg+offset]
@@ -190,11 +205,12 @@
 	else opcode=(char)0x8B;
 
-	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod, scheduleType);
-}
-void CodeGenerator::op_mov_RM_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset, Schedule::Type scheduleType ){
+	return __op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod, scheduleType, isPertialSchedule );
+}
+const PertialSchedule *CodeGenerator::op_mov_RM_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//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]
+	const PertialSchedule *pPertialSchedule = NULL;
 
 	if(base_reg1==REG_RSP){
@@ -226,4 +242,9 @@
 
 		//オフセット値
+		if( isPertialSchedule )
+		{
+			pertialSchedules.push_back( new PertialSchedule( pNativeCode->GetSize(), sizeof(long) ) );
+			pPertialSchedule = pertialSchedules.back();
+		}
 		pNativeCode->Put( offset, scheduleType );
 	}
@@ -239,6 +260,8 @@
 		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, Schedule::Type scheduleType ){
+
+	return pPertialSchedule;
+}
+const PertialSchedule *CodeGenerator::op_mov_MR(int op_size,int reg,int base_reg,long offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//mov qword ptr[base_reg+offset],reg64
 	//mov dword ptr[base_reg+offset],reg32
@@ -255,11 +278,12 @@
 	else opcode=(char)0x89;
 
-	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod, scheduleType );
-}
-void CodeGenerator::op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset, Schedule::Type scheduleType ){
+	return __op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod, scheduleType, isPertialSchedule );
+}
+const PertialSchedule *CodeGenerator::op_mov_MR_ex(int op_size,int reg,int base_reg1,int base_reg2,long offset,BOOL bUseOffset, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//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
+	const PertialSchedule *pPertialSchedule = NULL;
 
 	if(base_reg1==REG_RSP){
@@ -291,4 +315,9 @@
 
 		//オフセット値
+		if( isPertialSchedule )
+		{
+			pertialSchedules.push_back( new PertialSchedule( pNativeCode->GetSize(), sizeof(long) ) );
+			pPertialSchedule = pertialSchedules.back();
+		}
 		pNativeCode->Put( offset, scheduleType );
 	}
@@ -304,9 +333,12 @@
 		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, Schedule::Type offsetScheduleType, BOOL bUseOffset,long i32data){
+
+	return pPertialSchedule;
+}
+
+const PertialSchedule *CodeGenerator::op_mov_MV(int op_size,int base_reg,int offset, Schedule::Type offsetScheduleType, bool isPertialSchedule, BOOL bUseOffset,long i32data){
 	//mov ptr[base_reg+offset],i32data
 	//mov ptr[base_reg       ],i32data
+	const PertialSchedule *pPertialSchedule = NULL;
 
 	//16ビット演算のプリフィックス
@@ -326,5 +358,5 @@
 
 		//ModR/M, SIB, disp
-		set_mod_rm_sib_disp(MOD_BASE_DISP32,0,SCALE_NON,INDEX_NON,base_reg,offset, offsetScheduleType );
+		pPertialSchedule = set_mod_rm_sib_disp(MOD_BASE_DISP32,0,SCALE_NON,INDEX_NON,base_reg,offset, offsetScheduleType, isPertialSchedule );
 	}
 	else{
@@ -346,4 +378,6 @@
 		pNativeCode->Put( (char)i32data );
 	}
+
+	return pPertialSchedule;
 }
 
@@ -561,5 +595,5 @@
 /////////////////////
 
-void CodeGenerator::op_add_RM(int op_size,int reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
+const PertialSchedule *CodeGenerator::op_add_RM(int op_size,int reg,int base_reg,int offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//add reg64,qword ptr[base_reg+offset]
 	//add reg32,dword ptr[base_reg+offset]
@@ -576,9 +610,11 @@
 	else opcode=(char)0x03;
 
-	__op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod, scheduleType );
-}
-
-void CodeGenerator::op_add_RV(int reg,long offset, Schedule::Type scheduleType ){
+	return __op_format(op_size,op_prefix,opcode,0,reg,base_reg,offset,mod, scheduleType, isPertialSchedule );
+}
+
+const PertialSchedule *CodeGenerator::op_add_RV(int reg,long offset, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//add reg,offset
+	const PertialSchedule *pPertialSchedule = NULL;
+
 	char RexByte=-1;
 
@@ -594,5 +630,4 @@
 		pNativeCode->Put( (char)RexByte );
 		pNativeCode->Put( (char)0x05 );
-		pNativeCode->Put( offset, scheduleType );
 	}
 	else{
@@ -603,6 +638,14 @@
 		pNativeCode->Put( (char)0x81 );
 		pNativeCode->Put( (char)(0xC0| REGISTER_OPERAND(reg)) );
-		pNativeCode->Put( offset, scheduleType );
-	}
+	}
+
+	if( isPertialSchedule )
+	{
+		pertialSchedules.push_back( new PertialSchedule( pNativeCode->GetSize(), sizeof(long) ) );
+		pPertialSchedule = pertialSchedules.back();
+	}
+	pNativeCode->Put( offset, scheduleType );
+
+	return pPertialSchedule;
 }
 void CodeGenerator::op_add_RR(int reg1,int reg2){
@@ -1303,11 +1346,11 @@
 ////////////////////
 
-void CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
+const PertialSchedule *CodeGenerator::op_movlpd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//movlpd qword ptr[base_reg+offset],xmm_reg
-	__op_format(0,(char)0x66,(char)0x0F,(char)0x13,xmm_reg,base_reg,offset,mod, scheduleType );
-}
-void CodeGenerator::op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
+	return __op_format(0,(char)0x66,(char)0x0F,(char)0x13,xmm_reg,base_reg,offset,mod, scheduleType, isPertialSchedule );
+}
+const PertialSchedule *CodeGenerator::op_movlpd_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//movlpd xmm_reg,qword ptr[base_reg+offset]
-	__op_format(0,(char)0x66,(char)0x0F,(char)0x12,xmm_reg,base_reg,offset,mod, scheduleType );
+	return __op_format(0,(char)0x66,(char)0x0F,(char)0x12,xmm_reg,base_reg,offset,mod, scheduleType, isPertialSchedule );
 }
 void CodeGenerator::op_movsd_RR(int xmm_reg1,int xmm_reg2){
@@ -1317,8 +1360,8 @@
 	__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, Schedule::Type scheduleType ){
+const PertialSchedule *CodeGenerator::op_movsd_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//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, scheduleType );
+	return __op_format(0,(char)0xF2,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod, scheduleType, isPertialSchedule );
 }
 void CodeGenerator::op_movss_RR(int xmm_reg1,int xmm_reg2){
@@ -1328,12 +1371,12 @@
 	__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, Schedule::Type scheduleType ){
+const PertialSchedule *CodeGenerator::op_movss_RM(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//movss xmm_reg,dword ptr[base_reg+offset]
-	__op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg,base_reg,offset,mod, scheduleType );
-}
-void CodeGenerator::op_movss_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType ){
+	return __op_format(0,(char)0xF3,(char)0x0F,(char)0x10,xmm_reg,base_reg,offset,mod, scheduleType, isPertialSchedule );
+}
+const PertialSchedule *CodeGenerator::op_movss_MR(int xmm_reg,int base_reg,int offset,char mod, Schedule::Type scheduleType, bool isPertialSchedule ){
 	//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, scheduleType );
+	return __op_format(0,(char)0xF3,(char)0x0F,(char)0x11,xmm_reg,base_reg,offset,mod, scheduleType, isPertialSchedule );
 }
 
