From e6ff05c59deb34866d4094eb972d04e3d9931d0d Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 12 Jan 2011 21:20:59 +0000 Subject: [PATCH] Sort the register list based on the *actual* register numbers rather than the enum values we give to them. llvm-svn: 123321 --- llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 10 +++++----- llvm/test/MC/ARM/reg-list.s | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 llvm/test/MC/ARM/reg-list.s diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index b51e3511724f..b672bc4ce41c 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -583,15 +583,15 @@ ParseRegisterList(SmallVectorImpl &Operands) { SmallVectorImpl >::const_iterator RI = Registers.begin(), RE = Registers.end(); - DenseMap RegMap; - RegMap[RI->first] = true; - - unsigned HighRegNum = RI->first; + unsigned HighRegNum = getARMRegisterNumbering(RI->first); bool EmittedWarning = false; + DenseMap RegMap; + RegMap[HighRegNum] = true; + for (++RI; RI != RE; ++RI) { const std::pair &RegInfo = *RI; - unsigned Reg = RegInfo.first; + unsigned Reg = getARMRegisterNumbering(RegInfo.first); if (RegMap[Reg]) { Error(RegInfo.second, "register duplicated in register list"); diff --git a/llvm/test/MC/ARM/reg-list.s b/llvm/test/MC/ARM/reg-list.s new file mode 100644 index 000000000000..4dd392e83791 --- /dev/null +++ b/llvm/test/MC/ARM/reg-list.s @@ -0,0 +1,8 @@ +@ RUN: llvm-mc -triple thumb-apple-darwin10 -show-encoding < %s 2> %t | FileCheck %s +@ RUN: FileCheck --check-prefix=CHECK-WARNINGS < %t %s + + push {r7, lr} +@ CHECK-WARNINGS: register not in ascending order in register list + + push {lr, r7} +@ CHECK: push {lr, r7}