diff options
Diffstat (limited to 'src/gallium/drivers/radeon/AMDGPUMCInstLower.cpp')
-rw-r--r-- | src/gallium/drivers/radeon/AMDGPUMCInstLower.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeon/AMDGPUMCInstLower.cpp b/src/gallium/drivers/radeon/AMDGPUMCInstLower.cpp index 53bd561a2fe..65738c2f96d 100644 --- a/src/gallium/drivers/radeon/AMDGPUMCInstLower.cpp +++ b/src/gallium/drivers/radeon/AMDGPUMCInstLower.cpp @@ -1,6 +1,8 @@ #include "AMDGPUMCInstLower.h" #include "AMDGPUAsmPrinter.h" +#include "R600InstrInfo.h" +#include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Constants.h" #include "llvm/MC/MCInst.h" @@ -14,13 +16,12 @@ AMDGPUMCInstLower::AMDGPUMCInstLower() { } void AMDGPUMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const { OutMI.setOpcode(MI->getOpcode()); - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + for (unsigned i = 0, e = MI->getNumExplicitOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); MCOperand MCOp; switch (MO.getType()) { default: - MI->dump(); llvm_unreachable("unknown operand type"); case MachineOperand::MO_FPImmediate: { const APFloat &FloatValue = MO.getFPImm()->getValueAPF(); @@ -42,7 +43,26 @@ void AMDGPUMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const { void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) { AMDGPUMCInstLower MCInstLowering; - MCInst TmpInst; - MCInstLowering.Lower(MI, TmpInst); - OutStreamer.EmitInstruction(TmpInst); + + // Ignore placeholder instructions: + if (MI->getOpcode() == AMDGPU::MASK_WRITE) { + return; + } + + if (MI->isBundle()) { + const MachineBasicBlock *MBB = MI->getParent(); + MachineBasicBlock::const_instr_iterator I = MI; + ++I; + while (I != MBB->end() && I->isInsideBundle()) { + MCInst MCBundleInst; + const MachineInstr *BundledInst = I; + MCInstLowering.Lower(BundledInst, MCBundleInst); + OutStreamer.EmitInstruction(MCBundleInst); + ++I; + } + } else { + MCInst TmpInst; + MCInstLowering.Lower(MI, TmpInst); + OutStreamer.EmitInstruction(TmpInst); + } } |