A64: Add ExceptionRaised IR instruction

The purpose of this instruction is to raise exceptions when certain decode-time
issues happen, instead of asserting at translate time. This allows us to
use the translator for code analysis without worrying about unnecessary asserts,
but also provides flexibility for the library user to perform custom behaviour
when one of these states are raised.
This commit is contained in:
MerryMage 2018-01-13 17:54:29 +00:00
parent 71a1851ee6
commit 0992987c98
7 changed files with 41 additions and 4 deletions

View file

@ -17,17 +17,20 @@ bool TranslatorVisitor::InterpretThisInstruction() {
}
bool TranslatorVisitor::UnpredictableInstruction() {
ASSERT_MSG(false, "UNPREDICTABLE");
ir.ExceptionRaised(Exception::UnpredictableInstruction);
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
return false;
}
bool TranslatorVisitor::ReservedValue() {
ASSERT_MSG(false, "RESERVEDVALUE");
ir.ExceptionRaised(Exception::ReservedValue);
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
return false;
}
bool TranslatorVisitor::UnallocatedEncoding() {
ASSERT_MSG(false, "UNALLOCATEDENCODING");
ir.ExceptionRaised(Exception::UnallocatedEncoding);
ir.SetTerm(IR::Term::CheckHalt{IR::Term::ReturnToDispatch{}});
return false;
}