Browse Source

Assert that zero/sign extension does not operate on memory operands (i.e. only on registers)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6794 8c9fc860-2736-0410-a75d-ab315db34111
felixf 9 years ago
parent
commit
ec95e4b945
1 changed files with 4 additions and 0 deletions
  1. 4 0
      source/FoxARMBackend.Mod

+ 4 - 0
source/FoxARMBackend.Mod

@@ -1806,6 +1806,8 @@ TYPE
 				ELSE
 				ELSE
 					HALT(100)
 					HALT(100)
 				END
 				END
+			ELSIF (sizeInBits < 32)  THEN
+				ASSERT(operand.mode = InstructionSet.modeImmediate);
 			END
 			END
 		END ZeroExtendOperand;
 		END ZeroExtendOperand;
 
 
@@ -1817,6 +1819,8 @@ TYPE
 					Emit2(opMOV, operand, InstructionSet.NewRegister(operand.register, InstructionSet.shiftLSL, None, 32 - sizeInBits));
 					Emit2(opMOV, operand, InstructionSet.NewRegister(operand.register, InstructionSet.shiftLSL, None, 32 - sizeInBits));
 					Emit2(opMOV, operand, InstructionSet.NewRegister(operand.register, InstructionSet.shiftASR, None, 32 - sizeInBits))
 					Emit2(opMOV, operand, InstructionSet.NewRegister(operand.register, InstructionSet.shiftASR, None, 32 - sizeInBits))
 				END
 				END
+			ELSIF (sizeInBits < 32)  THEN
+				ASSERT(operand.mode = InstructionSet.modeImmediate);
 			END
 			END
 		END SignExtendOperand;
 		END SignExtendOperand;