mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Add asm parsing support w/ testcases for strex/ldrex family of instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128236 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -350,6 +350,23 @@ public:
|
||||
int64_t Value = CE->getValue();
|
||||
return ((Value & 0x3) == 0 && Value <= 1020 && Value >= -1020);
|
||||
}
|
||||
bool isMemMode7() const {
|
||||
if (!isMemory() ||
|
||||
getMemPreindexed() ||
|
||||
getMemPostindexed() ||
|
||||
getMemOffsetIsReg() ||
|
||||
getMemNegative() ||
|
||||
getMemWriteback())
|
||||
return false;
|
||||
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getMemOffset());
|
||||
if (!CE) return false;
|
||||
|
||||
if (CE->getValue())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
bool isMemModeRegThumb() const {
|
||||
if (!isMemory() || !getMemOffsetIsReg() || getMemWriteback())
|
||||
return false;
|
||||
@@ -438,6 +455,15 @@ public:
|
||||
Inst.addOperand(MCOperand::CreateImm(unsigned(getMemBarrierOpt())));
|
||||
}
|
||||
|
||||
void addMemMode7Operands(MCInst &Inst, unsigned N) const {
|
||||
assert(N == 1 && isMemMode7() && "Invalid number of operands!");
|
||||
Inst.addOperand(MCOperand::CreateReg(getMemBaseRegNum()));
|
||||
|
||||
const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getMemOffset());
|
||||
assert((CE || CE->getValue() == 0) &&
|
||||
"No offset operand support in mode 7");
|
||||
}
|
||||
|
||||
void addMemMode5Operands(MCInst &Inst, unsigned N) const {
|
||||
assert(N == 2 && isMemMode5() && "Invalid number of operands!");
|
||||
|
||||
|
Reference in New Issue
Block a user