1 //===-- PTXMCInstLower.cpp - Convert PTX MachineInstr to an MCInst --------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file contains code to lower PTX MachineInstrs to their corresponding 11 // MCInst records. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #include "PTX.h" 16 #include "PTXAsmPrinter.h" 17 #include "llvm/Constants.h" 18 #include "llvm/CodeGen/MachineBasicBlock.h" 19 #include "llvm/MC/MCExpr.h" 20 #include "llvm/MC/MCInst.h" 21 #include "llvm/Target/Mangler.h" 22 LowerPTXMachineInstrToMCInst(const MachineInstr * MI,MCInst & OutMI,PTXAsmPrinter & AP)23void llvm::LowerPTXMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, 24 PTXAsmPrinter &AP) { 25 OutMI.setOpcode(MI->getOpcode()); 26 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { 27 const MachineOperand &MO = MI->getOperand(i); 28 MCOperand MCOp; 29 OutMI.addOperand(AP.lowerOperand(MO)); 30 } 31 } 32 33