1 //===-- AMDGPUConvertToISA.cpp - Lower AMDIL to HW ISA --------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// \brief This pass lowers AMDIL machine instructions to the appropriate
12 /// hardware instructions.
14 //===----------------------------------------------------------------------===//
17 #include "AMDGPUInstrInfo.h"
18 #include "llvm/CodeGen/MachineFunctionPass.h"
24 class AMDGPUConvertToISAPass : public MachineFunctionPass {
31 AMDGPUConvertToISAPass(TargetMachine &tm) :
32 MachineFunctionPass(ID), TM(tm) { }
34 virtual bool runOnMachineFunction(MachineFunction &MF);
36 virtual const char *getPassName() const {return "AMDGPU Convert to ISA";}
40 } // End anonymous namespace
42 char AMDGPUConvertToISAPass::ID = 0;
44 FunctionPass *llvm::createAMDGPUConvertToISAPass(TargetMachine &tm) {
45 return new AMDGPUConvertToISAPass(tm);
48 bool AMDGPUConvertToISAPass::runOnMachineFunction(MachineFunction &MF) {
49 const AMDGPUInstrInfo * TII =
50 static_cast<const AMDGPUInstrInfo*>(TM.getInstrInfo());
52 for (MachineFunction::iterator BB = MF.begin(), BB_E = MF.end();
54 MachineBasicBlock &MBB = *BB;
55 for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
57 MachineInstr &MI = *I;
58 TII->convertToISA(MI, MF, MBB.findDebugLoc(I));