summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
diff options
context:
space:
mode:
authorJack Carter <jcarter@mips.com>2012-08-28 19:07:39 +0000
committerJack Carter <jcarter@mips.com>2012-08-28 19:07:39 +0000
commitc20a21b855301a9720313c88f616cc4d53b11348 (patch)
tree800949a2379b6a7b865b4b7f4925fadbc28e5d3a /llvm/lib/Target/Mips/MipsAsmPrinter.cpp
parent8c4b6a307eb937faa134810c8cd2d68603713d4e (diff)
downloadbcm5719-llvm-c20a21b855301a9720313c88f616cc4d53b11348.tar.gz
bcm5719-llvm-c20a21b855301a9720313c88f616cc4d53b11348.zip
Some instructions are passed to the assembler to be
transformed to the final instruction variant. An example would be dsrll which is transformed into dsll32 if the shift value is greater than 32. For direct object output we need to do this transformation in the codegen. If the instruction was inside branch delay slot, it was being missed. This patch corrects this oversight. llvm-svn: 162779
Diffstat (limited to 'llvm/lib/Target/Mips/MipsAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsAsmPrinter.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index 00ff7545c14..3b1509d46bb 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -58,33 +58,37 @@ void MipsAsmPrinter::EmitInstruction(const MachineInstr *MI) {
return;
}
- // Direct object specific instruction lowering
- if (!OutStreamer.hasRawTextSupport())
- switch (MI->getOpcode()) {
- case Mips::DSLL:
- case Mips::DSRL:
- case Mips::DSRA:
- assert(MI->getNumOperands() == 3 &&
- "Invalid no. of machine operands for shift!");
- assert(MI->getOperand(2).isImm());
- int64_t Shift = MI->getOperand(2).getImm();
- if (Shift > 31) {
- MCInst TmpInst0;
- MCInstLowering.LowerLargeShift(MI, TmpInst0, Shift - 32);
- OutStreamer.EmitInstruction(TmpInst0);
- return;
- }
- break;
- }
-
MachineBasicBlock::const_instr_iterator I = MI;
MachineBasicBlock::const_instr_iterator E = MI->getParent()->instr_end();
do {
MCInst TmpInst0;
+
+ // Direct object specific instruction lowering
+ if (!OutStreamer.hasRawTextSupport())
+ switch (I->getOpcode()) {
+ // If shift amount is >= 32 it the inst needs to be lowered further
+ case Mips::DSLL:
+ case Mips::DSRL:
+ case Mips::DSRA:
+ {
+ assert(I->getNumOperands() == 3 &&
+ "Invalid no. of machine operands for shift!");
+ assert(I->getOperand(2).isImm());
+ int64_t Shift = I->getOperand(2).getImm();
+ if (Shift > 31) {
+ MCInst TmpInst0;
+ MCInstLowering.LowerLargeShift(I, TmpInst0, Shift - 32);
+ OutStreamer.EmitInstruction(TmpInst0);
+ return;
+ }
+ }
+ }
+
MCInstLowering.Lower(I++, TmpInst0);
OutStreamer.EmitInstruction(TmpInst0);
- } while ((I != E) && I->isInsideBundle());
+
+ } while ((I != E) && I->isInsideBundle()); // Delay slot check
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud