mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-13 10:32:06 +00:00
The ARM AsmMatcher needs to know that the CCOut operand is a register value,
not an immediate. It stores either ARM::CPSR or reg0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121018 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9267d140de
commit
d67641b6f8
@ -143,6 +143,11 @@ def CondCodeOperand : AsmOperandClass {
|
|||||||
let SuperClasses = [];
|
let SuperClasses = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def CCOutOperand : AsmOperandClass {
|
||||||
|
let Name = "CCOut";
|
||||||
|
let SuperClasses = [];
|
||||||
|
}
|
||||||
|
|
||||||
// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
|
// ARM Predicate operand. Default to 14 = always (AL). Second part is CC
|
||||||
// register whose default is 0 (no register).
|
// register whose default is 0 (no register).
|
||||||
def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
|
def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
|
||||||
@ -155,12 +160,14 @@ def pred : PredicateOperand<OtherVT, (ops i32imm, CCR),
|
|||||||
def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
|
def cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 zero_reg))> {
|
||||||
let EncoderMethod = "getCCOutOpValue";
|
let EncoderMethod = "getCCOutOpValue";
|
||||||
let PrintMethod = "printSBitModifierOperand";
|
let PrintMethod = "printSBitModifierOperand";
|
||||||
|
let ParserMatchClass = CCOutOperand;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same as cc_out except it defaults to setting CPSR.
|
// Same as cc_out except it defaults to setting CPSR.
|
||||||
def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
|
def s_cc_out : OptionalDefOperand<OtherVT, (ops CCR), (ops (i32 CPSR))> {
|
||||||
let EncoderMethod = "getCCOutOpValue";
|
let EncoderMethod = "getCCOutOpValue";
|
||||||
let PrintMethod = "printSBitModifierOperand";
|
let PrintMethod = "printSBitModifierOperand";
|
||||||
|
let ParserMatchClass = CCOutOperand;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ARM special operands for disassembly only.
|
// ARM special operands for disassembly only.
|
||||||
|
@ -103,6 +103,7 @@ namespace {
|
|||||||
class ARMOperand : public MCParsedAsmOperand {
|
class ARMOperand : public MCParsedAsmOperand {
|
||||||
enum KindTy {
|
enum KindTy {
|
||||||
CondCode,
|
CondCode,
|
||||||
|
CCOut,
|
||||||
Immediate,
|
Immediate,
|
||||||
Memory,
|
Memory,
|
||||||
Register,
|
Register,
|
||||||
@ -162,6 +163,7 @@ public:
|
|||||||
case Token:
|
case Token:
|
||||||
Tok = o.Tok;
|
Tok = o.Tok;
|
||||||
break;
|
break;
|
||||||
|
case CCOut:
|
||||||
case Register:
|
case Register:
|
||||||
Reg = o.Reg;
|
Reg = o.Reg;
|
||||||
break;
|
break;
|
||||||
@ -195,7 +197,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned getReg() const {
|
unsigned getReg() const {
|
||||||
assert(Kind == Register && "Invalid access!");
|
assert(Kind == Register || Kind == CCOut && "Invalid access!");
|
||||||
return Reg.RegNum;
|
return Reg.RegNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +213,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isCondCode() const { return Kind == CondCode; }
|
bool isCondCode() const { return Kind == CondCode; }
|
||||||
|
bool isCCOut() const { return Kind == CCOut; }
|
||||||
bool isImm() const { return Kind == Immediate; }
|
bool isImm() const { return Kind == Immediate; }
|
||||||
bool isReg() const { return Kind == Register; }
|
bool isReg() const { return Kind == Register; }
|
||||||
bool isRegList() const { return Kind == RegisterList; }
|
bool isRegList() const { return Kind == RegisterList; }
|
||||||
@ -264,6 +267,11 @@ public:
|
|||||||
Inst.addOperand(MCOperand::CreateReg(0));
|
Inst.addOperand(MCOperand::CreateReg(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addCCOutOperands(MCInst &Inst, unsigned N) const {
|
||||||
|
assert(N == 1 && "Invalid number of operands!");
|
||||||
|
Inst.addOperand(MCOperand::CreateReg(getReg()));
|
||||||
|
}
|
||||||
|
|
||||||
void addRegOperands(MCInst &Inst, unsigned N) const {
|
void addRegOperands(MCInst &Inst, unsigned N) const {
|
||||||
assert(N == 1 && "Invalid number of operands!");
|
assert(N == 1 && "Invalid number of operands!");
|
||||||
Inst.addOperand(MCOperand::CreateReg(getReg()));
|
Inst.addOperand(MCOperand::CreateReg(getReg()));
|
||||||
@ -341,6 +349,14 @@ public:
|
|||||||
return Op;
|
return Op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ARMOperand *CreateCCOut(unsigned RegNum, SMLoc S) {
|
||||||
|
ARMOperand *Op = new ARMOperand(CCOut);
|
||||||
|
Op->Reg.RegNum = RegNum;
|
||||||
|
Op->StartLoc = S;
|
||||||
|
Op->EndLoc = S;
|
||||||
|
return Op;
|
||||||
|
}
|
||||||
|
|
||||||
static ARMOperand *CreateToken(StringRef Str, SMLoc S) {
|
static ARMOperand *CreateToken(StringRef Str, SMLoc S) {
|
||||||
ARMOperand *Op = new ARMOperand(Token);
|
ARMOperand *Op = new ARMOperand(Token);
|
||||||
Op->Tok.Data = Str.data();
|
Op->Tok.Data = Str.data();
|
||||||
@ -418,6 +434,9 @@ void ARMOperand::dump(raw_ostream &OS) const {
|
|||||||
case CondCode:
|
case CondCode:
|
||||||
OS << ARMCondCodeToString(getCondCode());
|
OS << ARMCondCodeToString(getCondCode());
|
||||||
break;
|
break;
|
||||||
|
case CCOut:
|
||||||
|
OS << "<ccout " << getReg() << ">";
|
||||||
|
break;
|
||||||
case Immediate:
|
case Immediate:
|
||||||
getImm()->print(OS);
|
getImm()->print(OS);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user