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 //===----------------------------------------------------------------------===//
10 // This pass lowers AMDIL machine instructions to the appropriate hardware
13 //===----------------------------------------------------------------------===//
16 #include "AMDGPUInstrInfo.h"
17 #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)
50 const AMDGPUInstrInfo * TII =
51 static_cast<const AMDGPUInstrInfo*>(TM.getInstrInfo());
53 for (MachineFunction::iterator BB = MF.begin(), BB_E = MF.end();
55 MachineBasicBlock &MBB = *BB;
56 for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
58 MachineInstr &MI = *I;
59 TII->convertToISA(MI, MF, MBB.findDebugLoc(I));