mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-14 17:34:41 +00:00
move in/out aliases to the .td files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118348 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9c1dbc69d7
commit
7e925cc3c9
@ -797,22 +797,6 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
|
||||
Operands.push_back(X86Operand::CreateReg(Reg, Loc, Loc));
|
||||
}
|
||||
|
||||
// FIXME: Hack to handle recognize "out[bwl] <op>". Canonicalize it to
|
||||
// "outb %al, <op>".
|
||||
if ((Name == "outb" || Name == "outw" || Name == "outl") &&
|
||||
Operands.size() == 2) {
|
||||
unsigned Reg;
|
||||
if (Name[3] == 'b')
|
||||
Reg = MatchRegisterName("al");
|
||||
else if (Name[3] == 'w')
|
||||
Reg = MatchRegisterName("ax");
|
||||
else
|
||||
Reg = MatchRegisterName("eax");
|
||||
SMLoc Loc = Operands.back()->getEndLoc();
|
||||
Operands.push_back(X86Operand::CreateReg(Reg, Loc, Loc));
|
||||
std::swap(Operands[1], Operands[2]);
|
||||
}
|
||||
|
||||
// FIXME: Hack to handle "out[bwl]? %al, (%dx)" -> "outb %al, %dx".
|
||||
if ((Name == "outb" || Name == "outw" || Name == "outl" || Name == "out") &&
|
||||
Operands.size() == 3) {
|
||||
|
@ -1388,6 +1388,14 @@ def : InstAlias<"imull $imm, $r", (IMUL32rri8 GR32:$r, GR32:$r, i32i8imm:$imm)>;
|
||||
def : InstAlias<"imulq $imm, $r",(IMUL64rri32 GR64:$r, GR64:$r,i64i32imm:$imm)>;
|
||||
def : InstAlias<"imulq $imm, $r", (IMUL64rri8 GR64:$r, GR64:$r, i64i8imm:$imm)>;
|
||||
|
||||
// inb %dx -> inb %al, %dx
|
||||
def : InstAlias<"inb %dx", (IN8rr)>;
|
||||
def : InstAlias<"inw %dx", (IN16rr)>;
|
||||
def : InstAlias<"inl %dx", (IN32rr)>;
|
||||
def : InstAlias<"inb $port", (IN8ri i8imm:$port)>;
|
||||
def : InstAlias<"inw $port", (IN16rir i8imm:$port)>;
|
||||
def : InstAlias<"inl $port", (IN32ri i8imm:$port)>;
|
||||
|
||||
|
||||
// jmp and call aliases for lcall and ljmp. jmp $42,$5 -> ljmp
|
||||
def : InstAlias<"call $seg, $off", (FARCALL32i i32imm:$off, i16imm:$seg)>;
|
||||
@ -1423,6 +1431,14 @@ def : InstAlias<"movzx $src, $dst", (MOVZX64rr8_Q GR64:$dst, GR8:$src)>;
|
||||
def : InstAlias<"movzx $src, $dst", (MOVZX64rr16_Q GR64:$dst, GR16:$src)>;
|
||||
// Note: No GR32->GR64 movzx form.
|
||||
|
||||
// outb %dx -> outb %al, %dx
|
||||
def : InstAlias<"outb %dx", (OUT8rr)>;
|
||||
def : InstAlias<"outw %dx", (OUT16rr)>;
|
||||
def : InstAlias<"outl %dx", (OUT32rr)>;
|
||||
def : InstAlias<"outb $port", (OUT8ir i8imm:$port)>;
|
||||
def : InstAlias<"outw $port", (OUT16ir i8imm:$port)>;
|
||||
def : InstAlias<"outl $port", (OUT32ir i8imm:$port)>;
|
||||
|
||||
// 'sldt <mem>' can be encoded with either sldtw or sldtq with the same
|
||||
// effect (both store to a 16-bit mem). Force to sldtw to avoid ambiguity
|
||||
// errors, since its encoding is the most compact.
|
||||
|
Loading…
x
Reference in New Issue
Block a user