more bugs fixes in the translator

This commit is contained in:
Rajshekar K K 2021-08-11 16:01:08 +05:30
parent bf6d6aba33
commit 271f715f7c
3 changed files with 12 additions and 6 deletions

View File

@ -40,7 +40,7 @@ public class FloatMove implements X86StaticInstructionHandler
{
//if operand1 is a register and operand2 is a register/immediate, we will use normal move operation
if( (operand1.isIntegerRegisterOperand() || operand1.isFloatRegisterOperand()) &&
(operand2.isIntegerRegisterOperand() || operand1.isFloatRegisterOperand() || operand2.isImmediateOperand()) &&
(operand2.isIntegerRegisterOperand() || operand2.isFloatRegisterOperand() || operand2.isImmediateOperand()) &&
(operand3==null))
{
instructionArrayList.appendInstruction(Instruction.getFloatingPointALU(operand2, null, operand1));
@ -65,6 +65,11 @@ public class FloatMove implements X86StaticInstructionHandler
OperandTranslator.processDestinationMemoryOperand(operand2, operand1, instructionArrayList, tempRegisterNum);
}
else if(operand1.isFloatRegisterOperand() && operand2.isFloatRegisterOperand() && operand3.isFloatRegisterOperand())
{
instructionArrayList.appendInstruction(Instruction.getFloatingPointALU(operand2, operand3, operand1));
}
//TODO I doubt if this is a valid instruction !! Anyways found this in an object-code
//operand1 can be a data-stored in memory and operand2 can be immediate/register.
//first, we load the value at location into temporary register
@ -82,3 +87,4 @@ public class FloatMove implements X86StaticInstructionHandler
}
}
}

View File

@ -513,7 +513,7 @@ public class InstructionClassTable {
instructionClassTable.put(integerMoveAccumulator[i],
InstructionClass.INTEGER_MOVE_ACCUMULATOR);
String floatMove[] = "movddup".split("\\|");
String floatMove[] = "movddup|movss|vmovss|movsd|vmovsd".split("\\|");
for (int i = 0; i < floatMove.length; i++)
instructionClassTable.put(floatMove[i], InstructionClass.FLOAT_MOVE);
@ -599,7 +599,7 @@ public class InstructionClassTable {
for (int i = 0; i < loop.length; i++)
instructionClassTable.put(loop[i], InstructionClass.UNCONDITIONAL_LOOP);
String conditionalLoop[] = "loopw|loopd|loope|looped|loopew|loopne|loopned|loopnew|loopz|loopzd|loopzw|loopnz|loopnzd|loopnzw"
String conditionalLoop[] = "loop|loopw|loopd|loope|looped|loopew|loopne|loopned|loopnew|loopz|loopzd|loopzw|loopnz|loopnzd|loopnzw"
.split("\\|");
for (int i = 0; i < conditionalLoop.length; i++)
instructionClassTable.put(conditionalLoop[i], InstructionClass.CONDITIONAL_LOOP);
@ -667,7 +667,7 @@ public class InstructionClassTable {
for (int i = 0; i < SSEFloatDiv.length; i++)
instructionClassTable.put(SSEFloatDiv[i], InstructionClass.SSE_FLOAT_DIV);
String FloatALU[] = "addss|addsd|subss|subsd|vaddss|vaddsd|vsubss|vsubsd|roundss|roundsd|vfixupimmsd|vfixupimmss|vfpclasssd|vfpclassss|vgetexpsd|vgetexpss|vgetmantss|vgetmantsd|vrangesd|vrangess|vrcp14sd|vrcp14ss|vreducesd|vreducess|vrndscalesd|vrndscaless|vscalefsd|vscalefss|minsd|vminsd|minss|vminss|cvtsi2ss|cvtsi2sd|cvtusi2ss|cvtusi2sd|cvtss2si|cvtsd2si|cvtss2usi|cvtsd2usi|cvttsi2ss|cvttsi2sd|cvttusi2ss|cvttusi2sd|cvttss2si|cvttsd2si|cvttss2usi|cvttsd2usi|vcvtsi2ss|vcvtsi2sd|vcvtusi2ss|vcvtusi2sd|vcvtss2si|vcvtsd2si|vcvtss2usi|vcvtsd2usi|vcvttsi2ss|vcvttsi2sd|vcvttusi2ss|vcvttusi2sd|vcvttss2si|vcvttsd2si|vcvttss2usi|vcvttsd2usi|cmpeqsd|vcmpeqsd|cmpltsd|vcmpltsd|cmplesd|vcmplesd|cmpunordsd|vcmpunordsd|cmpneqsd|vcmpneqsd|cmpnltsd|vcmpnltsd|cmpnlesd|vcmpnlesd|cmpordsd|vcmpordsd|vcmpeq_uqsd|vcmpngesd|vcmpngtsd|vcmpfalsesd|vcmpneq_oqsd|vcmpgesd|vcmpgtsd|vcmptruesd|vcmpeq_ossd|vcmplt_oqsd|vcmple_oqsd|vcmpunord_ssd|vcmpneq_ussd|vcmpnlt_uqsd|vcmpnle_uqsd|vcmpord_ssd|vcmpeq_ussd|vcmpnge_uqsd|vcmpngt_uqsd|vcmpfalse_ossd|vcmpneq_ossd|vcmpge_oqsd|vcmpgt_oqsd|vcmptrue_ussd|cmpeqss|vcmpeqss|cmpltss|vcmpltss|cmpless|vcmpless|cmpunordss|vcmpunordss|cmpneqss|vcmpneqss|cmpnltss|vcmpnltss|cmpnless|vcmpnless|cmpordss|vcmpordss|vcmpeq_uqss|vcmpngess|vcmpngtss|vcmpfalsess|vcmpneq_oqss|vcmpgess|vcmpgtss|vcmptruess|vcmpeq_osss|vcmplt_oqss|vcmple_oqss|vcmpunord_sss|vcmpneq_usss|vcmpnlt_uqss|vcmpnle_uqss|vcmpord_sss|vcmpeq_usss|vcmpnge_uqss|vcmpngt_uqss|vcmpfalse_osss|vcmpneq_osss|vcmpge_oqss|vcmpgt_oqss|vcmptrue_usss|movss|vmovss|movsd|vmovsd|maxsd|vmaxsd|maxss|vmaxss|minsd|vminsd|minss|vminss|cvtsd2ss|vcvtsd2ss|cvtss2sd|vcvtss2sd|cmpsd|vcmpsd".split("\\|");
String FloatALU[] = "addss|addsd|subss|subsd|vaddss|vaddsd|vsubss|vsubsd|roundss|roundsd|vfixupimmsd|vfixupimmss|vfpclasssd|vfpclassss|vgetexpsd|vgetexpss|vgetmantss|vgetmantsd|vrangesd|vrangess|vrcp14sd|vrcp14ss|vreducesd|vreducess|vrndscalesd|vrndscaless|vscalefsd|vscalefss|minsd|vminsd|minss|vminss|cvtsi2ss|cvtsi2sd|cvtusi2ss|cvtusi2sd|cvtss2si|cvtsd2si|cvtss2usi|cvtsd2usi|cvttsi2ss|cvttsi2sd|cvttusi2ss|cvttusi2sd|cvttss2si|cvttsd2si|cvttss2usi|cvttsd2usi|vcvtsi2ss|vcvtsi2sd|vcvtusi2ss|vcvtusi2sd|vcvtss2si|vcvtsd2si|vcvtss2usi|vcvtsd2usi|vcvttsi2ss|vcvttsi2sd|vcvttusi2ss|vcvttusi2sd|vcvttss2si|vcvttsd2si|vcvttss2usi|vcvttsd2usi|cmpeqsd|vcmpeqsd|cmpltsd|vcmpltsd|cmplesd|vcmplesd|cmpunordsd|vcmpunordsd|cmpneqsd|vcmpneqsd|cmpnltsd|vcmpnltsd|cmpnlesd|vcmpnlesd|cmpordsd|vcmpordsd|vcmpeq_uqsd|vcmpngesd|vcmpngtsd|vcmpfalsesd|vcmpneq_oqsd|vcmpgesd|vcmpgtsd|vcmptruesd|vcmpeq_ossd|vcmplt_oqsd|vcmple_oqsd|vcmpunord_ssd|vcmpneq_ussd|vcmpnlt_uqsd|vcmpnle_uqsd|vcmpord_ssd|vcmpeq_ussd|vcmpnge_uqsd|vcmpngt_uqsd|vcmpfalse_ossd|vcmpneq_ossd|vcmpge_oqsd|vcmpgt_oqsd|vcmptrue_ussd|cmpeqss|vcmpeqss|cmpltss|vcmpltss|cmpless|vcmpless|cmpunordss|vcmpunordss|cmpneqss|vcmpneqss|cmpnltss|vcmpnltss|cmpnless|vcmpnless|cmpordss|vcmpordss|vcmpeq_uqss|vcmpngess|vcmpngtss|vcmpfalsess|vcmpneq_oqss|vcmpgess|vcmpgtss|vcmptruess|vcmpeq_osss|vcmplt_oqss|vcmple_oqss|vcmpunord_sss|vcmpneq_usss|vcmpnlt_uqss|vcmpnle_uqss|vcmpord_sss|vcmpeq_usss|vcmpnge_uqss|vcmpngt_uqss|vcmpfalse_osss|vcmpneq_osss|vcmpge_oqss|vcmpgt_oqss|vcmptrue_usss|maxsd|vmaxsd|maxss|vmaxss|minsd|vminsd|minss|vminss|cvtsd2ss|vcvtsd2ss|cvtss2sd|vcvtss2sd|cmpsd|vcmpsd".split("\\|");
for (int i = 0; i < FloatALU.length; i++)
instructionClassTable.put(FloatALU[i], InstructionClass.FLOAT_ALU);

View File

@ -40,7 +40,7 @@ public class IntegerMove implements X86StaticInstructionHandler
{
//if operand1 is a register and operand2 is a register/immediate, we will use normal move operation
if( (operand1.isIntegerRegisterOperand() || operand1.isFloatRegisterOperand()) &&
(operand2.isIntegerRegisterOperand() || operand1.isFloatRegisterOperand() || operand2.isImmediateOperand()) &&
(operand2.isIntegerRegisterOperand() || operand2.isFloatRegisterOperand() || operand2.isImmediateOperand()) &&
(operand3==null))
{
instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(operand2, null, operand1));