LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AMDGPUConvertToISA.cpp
Go to the documentation of this file.
1 //===-- AMDGPUConvertToISA.cpp - Lower AMDIL to HW ISA --------------------===//
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 /// \file
11 /// \brief This pass lowers AMDIL machine instructions to the appropriate
12 /// hardware instructions.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #include "AMDGPU.h"
17 #include "AMDGPUInstrInfo.h"
19 
20 using namespace llvm;
21 
22 namespace {
23 
24 class AMDGPUConvertToISAPass : public MachineFunctionPass {
25 
26 private:
27  static char ID;
29 
30 public:
31  AMDGPUConvertToISAPass(TargetMachine &tm) :
32  MachineFunctionPass(ID), TM(tm) { }
33 
34  virtual bool runOnMachineFunction(MachineFunction &MF);
35 
36  virtual const char *getPassName() const {return "AMDGPU Convert to ISA";}
37 
38 };
39 
40 } // End anonymous namespace
41 
43 
45  return new AMDGPUConvertToISAPass(tm);
46 }
47 
48 bool AMDGPUConvertToISAPass::runOnMachineFunction(MachineFunction &MF) {
49  const AMDGPUInstrInfo * TII =
50  static_cast<const AMDGPUInstrInfo*>(TM.getInstrInfo());
51 
52  for (MachineFunction::iterator BB = MF.begin(), BB_E = MF.end();
53  BB != BB_E; ++BB) {
54  MachineBasicBlock &MBB = *BB;
55  for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
56  I != E; ++I) {
57  MachineInstr &MI = *I;
58  TII->convertToISA(MI, MF, MBB.findDebugLoc(I));
59  }
60  }
61  return false;
62 }
const HexagonInstrInfo * TII
ID
LLVM Calling Convention Representation.
Definition: CallingConv.h:26
bundle_iterator< MachineInstr, instr_iterator > iterator
DebugLoc findDebugLoc(instr_iterator MBBI)
virtual void convertToISA(MachineInstr &MI, MachineFunction &MF, DebugLoc DL) const
Convert the AMDIL MachineInstr to a supported ISA MachineInstr.
Contains the definition of a TargetInstrInfo class that is common to all AMD GPUs.
#define I(x, y, z)
Definition: MD5.cpp:54
BasicBlockListType::iterator iterator
FunctionPass * createAMDGPUConvertToISAPass(TargetMachine &tm)