mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-01-09 05:28:42 +00:00
Fixed another assert exposed by fuzzing. The utility function getRegisterEnum()
was asserting because the (RegClass, RegNum) combination doesn't make sense from an encoding point of view. Since getRegisterEnum() is used all over the place, to change the code to check for encoding error after each call would not only bloat the code, but also make it less readable. An Err flag is added to the ARMBasicMCBuilder where a client can set a non-zero value to indicate some kind of error condition while building up the MCInst. ARMBasicMCBuilder::BuildIt() checks this flag and returns false if a non-zero value is detected. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101290 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -187,6 +187,7 @@ class ARMBasicMCBuilder {
|
||||
unsigned short NumOps;
|
||||
DisassembleFP Disasm;
|
||||
Session *SP;
|
||||
int Err; // !=0 if the builder encounters some error condition during build.
|
||||
|
||||
private:
|
||||
/// Opcode, Format, and NumOperands make up an ARM Basic MCBuilder.
|
||||
@@ -195,15 +196,20 @@ private:
|
||||
public:
|
||||
ARMBasicMCBuilder(ARMBasicMCBuilder &B)
|
||||
: Opcode(B.Opcode), Format(B.Format), NumOps(B.NumOps), Disasm(B.Disasm),
|
||||
SP(B.SP)
|
||||
{}
|
||||
SP(B.SP) {
|
||||
Err = 0;
|
||||
}
|
||||
|
||||
virtual ~ARMBasicMCBuilder() {}
|
||||
|
||||
void setSession(Session *sp) {
|
||||
void SetSession(Session *sp) {
|
||||
SP = sp;
|
||||
}
|
||||
|
||||
void SetErr(int ErrCode) {
|
||||
Err = ErrCode;
|
||||
}
|
||||
|
||||
/// TryPredicateAndSBitModifier - TryPredicateAndSBitModifier tries to process
|
||||
/// the possible Predicate and SBitModifier, to build the remaining MCOperand
|
||||
/// constituents.
|
||||
|
||||
Reference in New Issue
Block a user