summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips
diff options
context:
space:
mode:
authorJack Carter <jcarter@mips.com>2012-07-05 23:58:21 +0000
committerJack Carter <jcarter@mips.com>2012-07-05 23:58:21 +0000
commitb2af512cef448ac4e9d866b38c2b49f6cc79ad62 (patch)
treec396bc109c4455848489c94064c111fab3f166ef /llvm/lib/Target/Mips
parent00da236f7e402d34a2b5c6ad7962e8b8cde93174 (diff)
downloadbcm5719-llvm-b2af512cef448ac4e9d866b38c2b49f6cc79ad62.tar.gz
bcm5719-llvm-b2af512cef448ac4e9d866b38c2b49f6cc79ad62.zip
Mips specific inline asm operand modifier D.
Print the second half of a double word operand. The include list was cleaned up a bit as well. Also the test case was modified to test for both big and little patterns. llvm-svn: 159787
Diffstat (limited to 'llvm/lib/Target/Mips')
-rw-r--r--llvm/lib/Target/Mips/MipsAsmPrinter.cpp48
1 files changed, 41 insertions, 7 deletions
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index 14c4b966647..3be0b287d8d 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -18,24 +18,23 @@
#include "MipsInstrInfo.h"
#include "InstPrinter/MipsInstPrinter.h"
#include "MCTargetDesc/MipsBaseInfo.h"
-#include "llvm/BasicBlock.h"
-#include "llvm/DebugInfo.h"
-#include "llvm/Instructions.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
-#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/BasicBlock.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineMemOperand.h"
+#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
-#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/TargetRegistry.h"
#include "llvm/Target/Mangler.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
@@ -334,8 +333,43 @@ bool MipsAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum,
O << "$0";
return false;
}
+ // This will be shared with other cases in succeeding checkins
+ case 'D': {
+ // Second part of a double word register operand
+ if (OpNum == 0)
+ return true;
+ const MachineOperand &FlagsOP = MI->getOperand(OpNum - 1);
+ if (!FlagsOP.isImm())
+ return true;
+ unsigned Flags = FlagsOP.getImm();
+ unsigned NumVals = InlineAsm::getNumOperandRegisters(Flags);
+ if (NumVals != 2) {
+ if (!Subtarget->isGP32bit() && NumVals == 1 && MO.isReg()) {
+ // In 64 bit mode long longs are always just a single reg
+ unsigned Reg = MO.getReg();
+ O << '$' << MipsInstPrinter::getRegisterName(Reg);
+ return false;
+ }
+ return true;
+ }
+ unsigned RegOp;
+ switch(ExtraCode[0]) {
+ // This will have other cases in succeeding checkins
+ case 'D':
+ RegOp = (!Subtarget->isGP32bit()) ? OpNum : OpNum + 1;
+ break;
+ }
+ if (RegOp >= MI->getNumOperands())
+ return true;
+ const MachineOperand &MO = MI->getOperand(RegOp);
+ if (!MO.isReg())
+ return true;
+ unsigned Reg = MO.getReg();
+ O << '$' << MipsInstPrinter::getRegisterName(Reg);
+ return false;
}
- }
+ } // switch
+ } // if ExtraCode
printOperand(MI, OpNum, O);
return false;
OpenPOWER on IntegriCloud