LLVM  5.0.0
AMDGPUInstructionSelector.h
Go to the documentation of this file.
1 //===- AMDGPUInstructionSelector --------------------------------*- C++ -*-==//
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 /// \file
10 /// This file declares the targeting of the InstructionSelector class for
11 /// AMDGPU.
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRUCTIONSELECTOR_H
15 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUINSTRUCTIONSELECTOR_H
16 
17 #include "AMDGPU.h"
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/SmallVector.h"
21 
22 namespace llvm {
23 
24 class AMDGPUInstrInfo;
25 class AMDGPURegisterBankInfo;
26 class MachineInstr;
27 class MachineOperand;
28 class MachineRegisterInfo;
29 class SIInstrInfo;
30 class SIRegisterInfo;
31 class SISubtarget;
32 
34 public:
36  const AMDGPURegisterBankInfo &RBI);
37 
38  bool select(MachineInstr &I) const override;
39 private:
40  struct GEPInfo {
41  const MachineInstr &GEP;
42  SmallVector<unsigned, 2> SgprParts;
43  SmallVector<unsigned, 2> VgprParts;
44  int64_t Imm;
45  GEPInfo(const MachineInstr &GEP) : GEP(GEP), Imm(0) { }
46  };
47 
48  MachineOperand getSubOperand64(MachineOperand &MO, unsigned SubIdx) const;
49  bool selectG_CONSTANT(MachineInstr &I) const;
50  bool selectG_ADD(MachineInstr &I) const;
51  bool selectG_GEP(MachineInstr &I) const;
52  bool hasVgprParts(ArrayRef<GEPInfo> AddrInfo) const;
53  void getAddrModeInfo(const MachineInstr &Load, const MachineRegisterInfo &MRI,
54  SmallVectorImpl<GEPInfo> &AddrInfo) const;
55  bool selectSMRD(MachineInstr &I, ArrayRef<GEPInfo> AddrInfo) const;
56  bool selectG_LOAD(MachineInstr &I) const;
57  bool selectG_STORE(MachineInstr &I) const;
58 
59  const SIInstrInfo &TII;
60  const SIRegisterInfo &TRI;
61  const AMDGPURegisterBankInfo &RBI;
62 protected:
64 };
65 
66 } // End llvm namespace.
67 #endif
Hexagon Common GEP
bool select(MachineInstr &I) const override
Select the (possibly generic) instruction I to only use target-specific opcodes.
OpenCL uses address spaces to differentiate between various memory regions on the hardware...
Definition: AMDGPU.h:164
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
AMDGPUInstructionSelector(const SISubtarget &STI, const AMDGPURegisterBankInfo &RBI)
unsigned const MachineRegisterInfo * MRI
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Provides the logic to select generic machine instructions.
Representation of each machine instruction.
Definition: MachineInstr.h:59
#define I(x, y, z)
Definition: MD5.cpp:58