mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
[AArch64] Handle aliases of conditional branches without b.pred form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201091 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dbd5c285b8
commit
5fcb5c92d3
@ -2240,15 +2240,36 @@ validateInstruction(MCInst &Inst,
|
||||
bool AArch64AsmParser::ParseInstruction(ParseInstructionInfo &Info,
|
||||
StringRef Name, SMLoc NameLoc,
|
||||
SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
|
||||
size_t CondCodePos = Name.find('.');
|
||||
StringRef PatchedName = StringSwitch<StringRef>(Name.lower())
|
||||
.Case("beq", "b.eq")
|
||||
.Case("bne", "b.ne")
|
||||
.Case("bhs", "b.hs")
|
||||
.Case("bcs", "b.cs")
|
||||
.Case("blo", "b.lo")
|
||||
.Case("bcc", "b.cc")
|
||||
.Case("bmi", "b.mi")
|
||||
.Case("bpl", "b.pl")
|
||||
.Case("bvs", "b.vs")
|
||||
.Case("bvc", "b.vc")
|
||||
.Case("bhi", "b.hi")
|
||||
.Case("bls", "b.ls")
|
||||
.Case("bge", "b.ge")
|
||||
.Case("blt", "b.lt")
|
||||
.Case("bgt", "b.gt")
|
||||
.Case("ble", "b.le")
|
||||
.Case("bal", "b.al")
|
||||
.Case("bnv", "b.nv")
|
||||
.Default(Name);
|
||||
|
||||
StringRef Mnemonic = Name.substr(0, CondCodePos);
|
||||
size_t CondCodePos = PatchedName.find('.');
|
||||
|
||||
StringRef Mnemonic = PatchedName.substr(0, CondCodePos);
|
||||
Operands.push_back(AArch64Operand::CreateToken(Mnemonic, NameLoc));
|
||||
|
||||
if (CondCodePos != StringRef::npos) {
|
||||
// We have a condition code
|
||||
SMLoc S = SMLoc::getFromPointer(NameLoc.getPointer() + CondCodePos + 1);
|
||||
StringRef CondStr = Name.substr(CondCodePos + 1, StringRef::npos);
|
||||
StringRef CondStr = PatchedName.substr(CondCodePos + 1, StringRef::npos);
|
||||
A64CC::CondCodes Code;
|
||||
|
||||
Code = A64StringToCondCode(CondStr);
|
||||
|
@ -1192,6 +1192,58 @@ _func:
|
||||
// CHECK: b.le lbl // encoding: [0x0d'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.al lbl // encoding: [0x0e'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
|
||||
beq lbl
|
||||
bne lbl
|
||||
bcs lbl
|
||||
bhs lbl
|
||||
blo lbl
|
||||
bcc lbl
|
||||
bmi lbl
|
||||
bpl lbl
|
||||
bvs lbl
|
||||
bvc lbl
|
||||
bhi lbl
|
||||
bls lbl
|
||||
bge lbl
|
||||
blt lbl
|
||||
bgt lbl
|
||||
ble lbl
|
||||
bal lbl
|
||||
// CHECK: b.eq lbl // encoding: [A,A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.ne lbl // encoding: [0x01'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.hs lbl // encoding: [0x02'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.hs lbl // encoding: [0x02'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.lo lbl // encoding: [0x03'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.lo lbl // encoding: [0x03'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.mi lbl // encoding: [0x04'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.pl lbl // encoding: [0x05'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.vs lbl // encoding: [0x06'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.vc lbl // encoding: [0x07'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.hi lbl // encoding: [0x08'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.ls lbl // encoding: [0x09'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.ge lbl // encoding: [0x0a'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.lt lbl // encoding: [0x0b'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.gt lbl // encoding: [0x0c'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.le lbl // encoding: [0x0d'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
// CHECK: b.al lbl // encoding: [0x0e'A',A,A,0x54'A']
|
||||
// CHECK: // fixup A - offset: 0, value: lbl, kind: fixup_a64_condbr
|
||||
|
||||
b.eq #0
|
||||
|
Loading…
x
Reference in New Issue
Block a user