mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-03 16:21:41 +00:00
Add a RegList (register list) object to ARMOperand. It will be used soon to hold
(surprise!) a list of registers. Register lists are consecutive, so we only need to record the start register plus the number of registers. llvm-svn: 118351
This commit is contained in:
parent
c0e756dc47
commit
ac0e90a877
@ -42,7 +42,6 @@ class ARMAsmParser : public TargetAsmParser {
|
|||||||
MCAsmParser &Parser;
|
MCAsmParser &Parser;
|
||||||
TargetMachine &TM;
|
TargetMachine &TM;
|
||||||
|
|
||||||
private:
|
|
||||||
MCAsmParser &getParser() const { return Parser; }
|
MCAsmParser &getParser() const { return Parser; }
|
||||||
|
|
||||||
MCAsmLexer &getLexer() const { return Parser.getLexer(); }
|
MCAsmLexer &getLexer() const { return Parser.getLexer(); }
|
||||||
@ -118,6 +117,7 @@ public:
|
|||||||
Immediate,
|
Immediate,
|
||||||
Memory,
|
Memory,
|
||||||
Register,
|
Register,
|
||||||
|
RegisterList,
|
||||||
Token
|
Token
|
||||||
} Kind;
|
} Kind;
|
||||||
|
|
||||||
@ -138,6 +138,11 @@ public:
|
|||||||
bool Writeback;
|
bool Writeback;
|
||||||
} Reg;
|
} Reg;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
unsigned RegStart;
|
||||||
|
unsigned Number;
|
||||||
|
} RegList;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
const MCExpr *Val;
|
const MCExpr *Val;
|
||||||
} Imm;
|
} Imm;
|
||||||
@ -174,6 +179,9 @@ public:
|
|||||||
case Register:
|
case Register:
|
||||||
Reg = o.Reg;
|
Reg = o.Reg;
|
||||||
break;
|
break;
|
||||||
|
case RegisterList:
|
||||||
|
RegList = o.RegList;
|
||||||
|
break;
|
||||||
case Immediate:
|
case Immediate:
|
||||||
Imm = o.Imm;
|
Imm = o.Imm;
|
||||||
break;
|
break;
|
||||||
@ -203,6 +211,11 @@ public:
|
|||||||
return Reg.RegNum;
|
return Reg.RegNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::pair<unsigned, unsigned> getRegList() const {
|
||||||
|
assert(Kind == RegisterList && "Invalid access!");
|
||||||
|
return std::make_pair(RegList.RegStart, RegList.Number);
|
||||||
|
}
|
||||||
|
|
||||||
const MCExpr *getImm() const {
|
const MCExpr *getImm() const {
|
||||||
assert(Kind == Immediate && "Invalid access!");
|
assert(Kind == Immediate && "Invalid access!");
|
||||||
return Imm.Val;
|
return Imm.Val;
|
||||||
@ -211,6 +224,7 @@ public:
|
|||||||
bool isCondCode() const { return Kind == CondCode; }
|
bool isCondCode() const { return Kind == CondCode; }
|
||||||
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 isToken() const { return Kind == Token; }
|
bool isToken() const { return Kind == Token; }
|
||||||
bool isMemory() const { return Kind == Memory; }
|
bool isMemory() const { return Kind == Memory; }
|
||||||
|
|
||||||
@ -312,6 +326,16 @@ public:
|
|||||||
return Op;
|
return Op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ARMOperand *CreateRegList(unsigned RegStart, unsigned Number,
|
||||||
|
SMLoc S, SMLoc E) {
|
||||||
|
ARMOperand *Op = new ARMOperand(RegisterList);
|
||||||
|
Op->RegList.RegStart = RegStart;
|
||||||
|
Op->RegList.Number = Number;
|
||||||
|
Op->StartLoc = S;
|
||||||
|
Op->EndLoc = E;
|
||||||
|
return Op;
|
||||||
|
}
|
||||||
|
|
||||||
static ARMOperand *CreateImm(const MCExpr *Val, SMLoc S, SMLoc E) {
|
static ARMOperand *CreateImm(const MCExpr *Val, SMLoc S, SMLoc E) {
|
||||||
ARMOperand *Op = new ARMOperand(Immediate);
|
ARMOperand *Op = new ARMOperand(Immediate);
|
||||||
Op->Imm.Val = Val;
|
Op->Imm.Val = Val;
|
||||||
@ -364,6 +388,19 @@ void ARMOperand::dump(raw_ostream &OS) const {
|
|||||||
case Register:
|
case Register:
|
||||||
OS << "<register " << getReg() << ">";
|
OS << "<register " << getReg() << ">";
|
||||||
break;
|
break;
|
||||||
|
case RegisterList: {
|
||||||
|
OS << "<register_list ";
|
||||||
|
std::pair<unsigned, unsigned> List = getRegList();
|
||||||
|
unsigned RegEnd = List.first + List.second;
|
||||||
|
|
||||||
|
for (unsigned Idx = List.first; Idx < RegEnd; ) {
|
||||||
|
OS << Idx;
|
||||||
|
if (++Idx < RegEnd) OS << ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
OS << ">";
|
||||||
|
break;
|
||||||
|
}
|
||||||
case Token:
|
case Token:
|
||||||
OS << "'" << getToken() << "'";
|
OS << "'" << getToken() << "'";
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user