mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
[ARMAsmParser] Sort the ARM register lists based on the encoding value, not the
tablegen enum values. This should be the last fix due to fallout from r185094. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185379 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
781f5b3953
commit
e29e2afc73
@ -2281,21 +2281,24 @@ public:
|
||||
}
|
||||
|
||||
static ARMOperand *
|
||||
CreateRegList(const SmallVectorImpl<std::pair<unsigned, SMLoc> > &Regs,
|
||||
CreateRegList(SmallVectorImpl<std::pair<unsigned, unsigned> > &Regs,
|
||||
SMLoc StartLoc, SMLoc EndLoc) {
|
||||
assert (Regs.size() > 0 && "RegList contains no registers?");
|
||||
KindTy Kind = k_RegisterList;
|
||||
|
||||
if (ARMMCRegisterClasses[ARM::DPRRegClassID].contains(Regs.front().first))
|
||||
if (ARMMCRegisterClasses[ARM::DPRRegClassID].contains(Regs.front().second))
|
||||
Kind = k_DPRRegisterList;
|
||||
else if (ARMMCRegisterClasses[ARM::SPRRegClassID].
|
||||
contains(Regs.front().first))
|
||||
contains(Regs.front().second))
|
||||
Kind = k_SPRRegisterList;
|
||||
|
||||
// Sort based on the register encoding values.
|
||||
array_pod_sort(Regs.begin(), Regs.end());
|
||||
|
||||
ARMOperand *Op = new ARMOperand(Kind);
|
||||
for (SmallVectorImpl<std::pair<unsigned, SMLoc> >::const_iterator
|
||||
for (SmallVectorImpl<std::pair<unsigned, unsigned> >::const_iterator
|
||||
I = Regs.begin(), E = Regs.end(); I != E; ++I)
|
||||
Op->Registers.push_back(I->first);
|
||||
array_pod_sort(Op->Registers.begin(), Op->Registers.end());
|
||||
Op->Registers.push_back(I->second);
|
||||
Op->StartLoc = StartLoc;
|
||||
Op->EndLoc = EndLoc;
|
||||
return Op;
|
||||
@ -2975,12 +2978,14 @@ parseRegisterList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||
|
||||
// The reglist instructions have at most 16 registers, so reserve
|
||||
// space for that many.
|
||||
SmallVector<std::pair<unsigned, SMLoc>, 16> Registers;
|
||||
int EReg = 0;
|
||||
SmallVector<std::pair<unsigned, unsigned>, 16> Registers;
|
||||
|
||||
// Allow Q regs and just interpret them as the two D sub-registers.
|
||||
if (ARMMCRegisterClasses[ARM::QPRRegClassID].contains(Reg)) {
|
||||
Reg = getDRegFromQReg(Reg);
|
||||
Registers.push_back(std::pair<unsigned, SMLoc>(Reg, RegLoc));
|
||||
EReg = MRI->getEncodingValue(Reg);
|
||||
Registers.push_back(std::pair<unsigned, unsigned>(EReg, Reg));
|
||||
++Reg;
|
||||
}
|
||||
const MCRegisterClass *RC;
|
||||
@ -2994,7 +2999,8 @@ parseRegisterList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||
return Error(RegLoc, "invalid register in register list");
|
||||
|
||||
// Store the register.
|
||||
Registers.push_back(std::pair<unsigned, SMLoc>(Reg, RegLoc));
|
||||
EReg = MRI->getEncodingValue(Reg);
|
||||
Registers.push_back(std::pair<unsigned, unsigned>(EReg, Reg));
|
||||
|
||||
// This starts immediately after the first register token in the list,
|
||||
// so we can see either a comma or a minus (range separator) as a legal
|
||||
@ -3024,7 +3030,8 @@ parseRegisterList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||
// Add all the registers in the range to the register list.
|
||||
while (Reg != EndReg) {
|
||||
Reg = getNextRegister(Reg);
|
||||
Registers.push_back(std::pair<unsigned, SMLoc>(Reg, RegLoc));
|
||||
EReg = MRI->getEncodingValue(Reg);
|
||||
Registers.push_back(std::pair<unsigned, unsigned>(EReg, Reg));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -3057,14 +3064,15 @@ parseRegisterList(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||
continue;
|
||||
}
|
||||
// VFP register lists must also be contiguous.
|
||||
// It's OK to use the enumeration values directly here rather, as the
|
||||
// VFP register classes have the enum sorted properly.
|
||||
if (RC != &ARMMCRegisterClasses[ARM::GPRRegClassID] &&
|
||||
Reg != OldReg + 1)
|
||||
return Error(RegLoc, "non-contiguous register range");
|
||||
Registers.push_back(std::pair<unsigned, SMLoc>(Reg, RegLoc));
|
||||
if (isQReg)
|
||||
Registers.push_back(std::pair<unsigned, SMLoc>(++Reg, RegLoc));
|
||||
EReg = MRI->getEncodingValue(Reg);
|
||||
Registers.push_back(std::pair<unsigned, unsigned>(EReg, Reg));
|
||||
if (isQReg) {
|
||||
EReg = MRI->getEncodingValue(++Reg);
|
||||
Registers.push_back(std::pair<unsigned, unsigned>(EReg, Reg));
|
||||
}
|
||||
}
|
||||
|
||||
if (Parser.getTok().isNot(AsmToken::RCurly))
|
||||
|
@ -897,19 +897,19 @@ Lforward:
|
||||
ldm r0, {r0, r2, lr}^
|
||||
ldm sp!, {r0-r3, pc}^
|
||||
|
||||
@ CHECK: ldm r2, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x92,0xe8]
|
||||
@ CHECK: ldm r2, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x92,0xe8]
|
||||
@ CHECK: ldmib r2, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x92,0xe9]
|
||||
@ CHECK: ldmda r2, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x12,0xe8]
|
||||
@ CHECK: ldmdb r2, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x12,0xe9]
|
||||
@ CHECK: ldm r2, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x92,0xe8]
|
||||
@ CHECK: ldm r2, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x92,0xe8]
|
||||
@ CHECK: ldm r2, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x92,0xe8]
|
||||
@ CHECK: ldmib r2, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x92,0xe9]
|
||||
@ CHECK: ldmda r2, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x12,0xe8]
|
||||
@ CHECK: ldmdb r2, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x12,0xe9]
|
||||
@ CHECK: ldm r2, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x92,0xe8]
|
||||
|
||||
@ CHECK: ldm r2!, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0xb2,0xe8]
|
||||
@ CHECK: ldmib r2!, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0xb2,0xe9]
|
||||
@ CHECK: ldmda r2!, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x32,0xe8]
|
||||
@ CHECK: ldmdb r2!, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x32,0xe9]
|
||||
@ CHECK: ldm r0, {lr, r0, r2} ^ @ encoding: [0x05,0x40,0xd0,0xe8]
|
||||
@ CHECK: ldm sp!, {pc, r0, r1, r2, r3} ^ @ encoding: [0x0f,0x80,0xfd,0xe8]
|
||||
@ CHECK: ldm r2!, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0xb2,0xe8]
|
||||
@ CHECK: ldmib r2!, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0xb2,0xe9]
|
||||
@ CHECK: ldmda r2!, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x32,0xe8]
|
||||
@ CHECK: ldmdb r2!, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x32,0xe9]
|
||||
@ CHECK: ldm r0, {r0, r2, lr} ^ @ encoding: [0x05,0x40,0xd0,0xe8]
|
||||
@ CHECK: ldm sp!, {r0, r1, r2, r3, pc} ^ @ encoding: [0x0f,0x80,0xfd,0xe8]
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
@ -2332,17 +2332,17 @@ Lforward:
|
||||
stmda sp!, {r1,r3-r6}
|
||||
stmdb r0!, {r1,r5,r7,sp}
|
||||
|
||||
@ CHECK: stm r2, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x82,0xe8]
|
||||
@ CHECK: stm r3, {lr, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x40,0x83,0xe8]
|
||||
@ CHECK: stmib r4, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x84,0xe9]
|
||||
@ CHECK: stmda r5, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x05,0xe8]
|
||||
@ CHECK: stm r2, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x82,0xe8]
|
||||
@ CHECK: stm r3, {r1, r3, r4, r5, r6, lr} @ encoding: [0x7a,0x40,0x83,0xe8]
|
||||
@ CHECK: stmib r4, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x84,0xe9]
|
||||
@ CHECK: stmda r5, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x05,0xe8]
|
||||
@ CHECK: stmdb r6, {r1, r3, r4, r5, r6, r8} @ encoding: [0x7a,0x01,0x06,0xe9]
|
||||
@ CHECK: stmdb sp, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0x0d,0xe9]
|
||||
@ CHECK: stmdb sp, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0x0d,0xe9]
|
||||
|
||||
@ CHECK: stm r8!, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0xa8,0xe8]
|
||||
@ CHECK: stmib r9!, {sp, r1, r3, r4, r5, r6} @ encoding: [0x7a,0x20,0xa9,0xe9]
|
||||
@ CHECK: stm r8!, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0xa8,0xe8]
|
||||
@ CHECK: stmib r9!, {r1, r3, r4, r5, r6, sp} @ encoding: [0x7a,0x20,0xa9,0xe9]
|
||||
@ CHECK: stmda sp!, {r1, r3, r4, r5, r6} @ encoding: [0x7a,0x00,0x2d,0xe8]
|
||||
@ CHECK: stmdb r0!, {sp, r1, r5, r7} @ encoding: [0xa2,0x20,0x20,0xe9]
|
||||
@ CHECK: stmdb r0!, {r1, r5, r7, sp} @ encoding: [0xa2,0x20,0x20,0xe9]
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
@ -708,7 +708,7 @@ _func:
|
||||
@ CHECK: ldm.w r4, {r5, r6} @ encoding: [0x94,0xe8,0x60,0x00]
|
||||
@ CHECK: ldm.w r5!, {r3, r8} @ encoding: [0xb5,0xe8,0x08,0x01]
|
||||
@ CHECK: ldm.w r5!, {r3, r8} @ encoding: [0xb5,0xe8,0x08,0x01]
|
||||
@ CHECK: pop.w {pc, r4, r5, r6, r7, r8, r9, r10, r11} @ encoding: [0xbd,0xe8,0xf0,0x8f]
|
||||
@ CHECK: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc} @ encoding: [0xbd,0xe8,0xf0,0x8f]
|
||||
|
||||
|
||||
@------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user