summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/InstPrinter
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2013-09-06 23:40:15 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2013-09-06 23:40:15 +0000
commit1d04ca7987ef0abb5be07b11e3bb9c9e756a1fce (patch)
treed0dc569e06404a16064bc3447d814eaa64a8ebb5 /lib/Target/Mips/InstPrinter
parent77e1ebd18fc558620b97fe38f3ebbf825533655f (diff)
downloadllvm-1d04ca7987ef0abb5be07b11e3bb9c9e756a1fce.tar.gz
llvm-1d04ca7987ef0abb5be07b11e3bb9c9e756a1fce.tar.bz2
llvm-1d04ca7987ef0abb5be07b11e3bb9c9e756a1fce.tar.xz
[mips] Make "b" (unconditional branch) a pseudo. "b" is an assembly idiom, which is
equivalent to "beq $zero, $zero, offset". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190220 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/InstPrinter')
-rw-r--r--lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp b/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
index 755a948f72..231d48520e 100644
--- a/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
+++ b/lib/Target/Mips/InstPrinter/MipsInstPrinter.cpp
@@ -230,8 +230,11 @@ bool MipsInstPrinter::printAlias(const char *Str, const MCInst &MI,
bool MipsInstPrinter::printAlias(const MCInst &MI, raw_ostream &OS) {
switch (MI.getOpcode()) {
case Mips::BEQ:
+ // beq $zero, $zero, $L2 => b $L2
// beq $r0, $zero, $L2 => beqz $r0, $L2
- return isReg<Mips::ZERO>(MI, 1) && printAlias("beqz", MI, 0, 2, OS);
+ return isReg<Mips::ZERO>(MI, 0) && isReg<Mips::ZERO>(MI, 1) &&
+ printAlias("b", MI, 2, OS) ||
+ isReg<Mips::ZERO>(MI, 1) && printAlias("beqz", MI, 0, 2, OS);
case Mips::BEQ64:
// beq $r0, $zero, $L2 => beqz $r0, $L2
return isReg<Mips::ZERO_64>(MI, 1) && printAlias("beqz", MI, 0, 2, OS);