2012-12-11 22:25:42 +01:00
|
|
|
//===-- R600InstrInfo.h - R600 Instruction Info Interface -------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2012-12-11 22:25:42 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Interface definition for R600InstrInfo
|
2012-12-11 22:25:42 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-03-11 09:00:27 +01:00
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_R600INSTRINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_R600INSTRINFO_H
|
2012-12-11 22:25:42 +01:00
|
|
|
|
|
|
|
#include "R600RegisterInfo.h"
|
AMDGPU: Separate R600 and GCN TableGen files
Summary:
We now have two sets of generated TableGen files, one for R600 and one
for GCN, so each sub-target now has its own tables of instructions,
registers, ISel patterns, etc. This should help reduce compile time
since each sub-target now only has to consider information that
is specific to itself. This will also help prevent the R600
sub-target from slowing down new features for GCN, like disassembler
support, GlobalISel, etc.
Reviewers: arsenm, nhaehnle, jvesely
Reviewed By: arsenm
Subscribers: MatzeB, kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46365
llvm-svn: 335942
2018-06-29 01:47:12 +02:00
|
|
|
#include "llvm/CodeGen/TargetInstrInfo.h"
|
|
|
|
|
|
|
|
#define GET_INSTRINFO_HEADER
|
|
|
|
#include "R600GenInstrInfo.inc"
|
2012-12-11 22:25:42 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
2016-08-13 03:43:46 +02:00
|
|
|
|
|
|
|
namespace R600InstrFlags {
|
2016-08-16 01:54:44 +02:00
|
|
|
enum : uint64_t {
|
2016-08-13 03:43:46 +02:00
|
|
|
REGISTER_STORE = UINT64_C(1) << 62,
|
|
|
|
REGISTER_LOAD = UINT64_C(1) << 63
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-06-24 08:30:11 +02:00
|
|
|
class AMDGPUTargetMachine;
|
|
|
|
class DFAPacketizer;
|
|
|
|
class MachineFunction;
|
|
|
|
class MachineInstr;
|
|
|
|
class MachineInstrBuilder;
|
|
|
|
class R600Subtarget;
|
|
|
|
|
AMDGPU: Separate R600 and GCN TableGen files
Summary:
We now have two sets of generated TableGen files, one for R600 and one
for GCN, so each sub-target now has its own tables of instructions,
registers, ISel patterns, etc. This should help reduce compile time
since each sub-target now only has to consider information that
is specific to itself. This will also help prevent the R600
sub-target from slowing down new features for GCN, like disassembler
support, GlobalISel, etc.
Reviewers: arsenm, nhaehnle, jvesely
Reviewed By: arsenm
Subscribers: MatzeB, kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46365
llvm-svn: 335942
2018-06-29 01:47:12 +02:00
|
|
|
class R600InstrInfo final : public R600GenInstrInfo {
|
2016-06-24 08:30:11 +02:00
|
|
|
private:
|
2012-12-11 22:25:42 +01:00
|
|
|
const R600RegisterInfo RI;
|
2016-06-24 08:30:11 +02:00
|
|
|
const R600Subtarget &ST;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-06-24 08:30:11 +02:00
|
|
|
std::vector<std::pair<int, unsigned>>
|
2016-06-30 02:01:54 +02:00
|
|
|
ExtractSrcs(MachineInstr &MI, const DenseMap<unsigned, unsigned> &PV,
|
2016-06-24 08:30:11 +02:00
|
|
|
unsigned &ConstCount) const;
|
2014-06-17 18:53:14 +02:00
|
|
|
|
|
|
|
MachineInstrBuilder buildIndirectRead(MachineBasicBlock *MBB,
|
|
|
|
MachineBasicBlock::iterator I,
|
|
|
|
unsigned ValueReg, unsigned Address,
|
|
|
|
unsigned OffsetReg,
|
|
|
|
unsigned AddrChan) const;
|
|
|
|
|
|
|
|
MachineInstrBuilder buildIndirectWrite(MachineBasicBlock *MBB,
|
2016-06-24 08:30:11 +02:00
|
|
|
MachineBasicBlock::iterator I,
|
|
|
|
unsigned ValueReg, unsigned Address,
|
|
|
|
unsigned OffsetReg,
|
|
|
|
unsigned AddrChan) const;
|
|
|
|
public:
|
2013-05-17 18:50:02 +02:00
|
|
|
enum BankSwizzle {
|
2013-06-29 21:32:29 +02:00
|
|
|
ALU_VEC_012_SCL_210 = 0,
|
|
|
|
ALU_VEC_021_SCL_122,
|
|
|
|
ALU_VEC_120_SCL_212,
|
|
|
|
ALU_VEC_102_SCL_221,
|
2013-05-17 18:50:02 +02:00
|
|
|
ALU_VEC_201,
|
|
|
|
ALU_VEC_210
|
|
|
|
};
|
|
|
|
|
2016-06-24 08:30:11 +02:00
|
|
|
explicit R600InstrInfo(const R600Subtarget &);
|
|
|
|
|
|
|
|
const R600RegisterInfo &getRegisterInfo() const {
|
|
|
|
return RI;
|
|
|
|
}
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-06-12 17:39:02 +02:00
|
|
|
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
2019-11-11 09:24:21 +01:00
|
|
|
const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
|
2014-04-29 09:57:24 +02:00
|
|
|
bool KillSrc) const override;
|
2013-11-22 01:41:08 +01:00
|
|
|
bool isLegalToSplitMBBAt(MachineBasicBlock &MBB,
|
2014-04-29 09:57:24 +02:00
|
|
|
MachineBasicBlock::iterator MBBI) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
|
|
|
bool isReductionOp(unsigned opcode) const;
|
|
|
|
bool isCubeOp(unsigned opcode) const;
|
|
|
|
|
|
|
|
/// \returns true if this \p Opcode represents an ALU instruction.
|
|
|
|
bool isALUInstr(unsigned Opcode) const;
|
2013-06-28 17:47:08 +02:00
|
|
|
bool hasInstrModifiers(unsigned Opcode) const;
|
|
|
|
bool isLDSInstr(unsigned Opcode) const;
|
2013-11-15 01:12:45 +01:00
|
|
|
bool isLDSRetInstr(unsigned Opcode) const;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2013-10-01 21:32:58 +02:00
|
|
|
/// \returns true if this \p Opcode represents an ALU instruction or an
|
|
|
|
/// instruction that will be lowered in ExpandSpecialInstrs Pass.
|
2016-06-30 02:01:54 +02:00
|
|
|
bool canBeConsideredALU(const MachineInstr &MI) const;
|
2013-10-01 21:32:58 +02:00
|
|
|
|
2013-04-30 02:14:17 +02:00
|
|
|
bool isTransOnly(unsigned Opcode) const;
|
2016-06-30 02:01:54 +02:00
|
|
|
bool isTransOnly(const MachineInstr &MI) const;
|
2013-09-04 21:53:30 +02:00
|
|
|
bool isVectorOnly(unsigned Opcode) const;
|
2016-06-30 02:01:54 +02:00
|
|
|
bool isVectorOnly(const MachineInstr &MI) const;
|
2013-08-16 03:11:51 +02:00
|
|
|
bool isExport(unsigned Opcode) const;
|
2013-04-30 02:14:17 +02:00
|
|
|
|
2013-04-30 02:13:39 +02:00
|
|
|
bool usesVertexCache(unsigned Opcode) const;
|
2016-06-30 02:01:54 +02:00
|
|
|
bool usesVertexCache(const MachineInstr &MI) const;
|
2013-04-30 02:13:39 +02:00
|
|
|
bool usesTextureCache(unsigned Opcode) const;
|
2016-06-30 02:01:54 +02:00
|
|
|
bool usesTextureCache(const MachineInstr &MI) const;
|
2013-04-30 02:13:39 +02:00
|
|
|
|
2013-06-28 17:46:59 +02:00
|
|
|
bool mustBeLastInClause(unsigned Opcode) const;
|
2016-06-30 02:01:54 +02:00
|
|
|
bool usesAddressRegister(MachineInstr &MI) const;
|
|
|
|
bool definesAddressRegister(MachineInstr &MI) const;
|
|
|
|
bool readsLDSSrcReg(const MachineInstr &MI) const;
|
2013-06-28 17:46:59 +02:00
|
|
|
|
2013-07-23 03:48:24 +02:00
|
|
|
/// \returns The operand Index for the Sel operand given an index to one
|
|
|
|
/// of the instruction's src operands.
|
|
|
|
int getSelIdx(unsigned Opcode, unsigned SrcIdx) const;
|
|
|
|
|
2013-05-17 18:50:02 +02:00
|
|
|
/// \returns a pair for each src of an ALU instructions.
|
|
|
|
/// The first member of a pair is the register id.
|
|
|
|
/// If register is ALU_CONST, second member is SEL.
|
|
|
|
/// If register is ALU_LITERAL, second member is IMM.
|
|
|
|
/// Otherwise, second member value is undefined.
|
|
|
|
SmallVector<std::pair<MachineOperand *, int64_t>, 3>
|
2016-06-30 02:01:54 +02:00
|
|
|
getSrcs(MachineInstr &MI) const;
|
2013-05-17 18:50:02 +02:00
|
|
|
|
2013-06-29 21:32:43 +02:00
|
|
|
unsigned isLegalUpTo(
|
|
|
|
const std::vector<std::vector<std::pair<int, unsigned> > > &IGSrcs,
|
|
|
|
const std::vector<R600InstrInfo::BankSwizzle> &Swz,
|
|
|
|
const std::vector<std::pair<int, unsigned> > &TransSrcs,
|
|
|
|
R600InstrInfo::BankSwizzle TransSwz) const;
|
|
|
|
|
|
|
|
bool FindSwizzleForVectorSlot(
|
|
|
|
const std::vector<std::vector<std::pair<int, unsigned> > > &IGSrcs,
|
|
|
|
std::vector<R600InstrInfo::BankSwizzle> &SwzCandidate,
|
|
|
|
const std::vector<std::pair<int, unsigned> > &TransSrcs,
|
|
|
|
R600InstrInfo::BankSwizzle TransSwz) const;
|
2013-06-28 17:47:08 +02:00
|
|
|
|
2013-05-17 18:50:02 +02:00
|
|
|
/// Given the order VEC_012 < VEC_021 < VEC_120 < VEC_102 < VEC_201 < VEC_210
|
|
|
|
/// returns true and the first (in lexical order) BankSwizzle affectation
|
|
|
|
/// starting from the one already provided in the Instruction Group MIs that
|
|
|
|
/// fits Read Port limitations in BS if available. Otherwise returns false
|
|
|
|
/// and undefined content in BS.
|
2013-06-29 21:32:43 +02:00
|
|
|
/// isLastAluTrans should be set if the last Alu of MIs will be executed on
|
|
|
|
/// Trans ALU. In this case, ValidTSwizzle returns the BankSwizzle value to
|
|
|
|
/// apply to the last instruction.
|
2013-05-17 18:50:02 +02:00
|
|
|
/// PV holds GPR to PV registers in the Instruction Group MIs.
|
|
|
|
bool fitsReadPortLimitations(const std::vector<MachineInstr *> &MIs,
|
|
|
|
const DenseMap<unsigned, unsigned> &PV,
|
2013-06-29 21:32:43 +02:00
|
|
|
std::vector<BankSwizzle> &BS,
|
|
|
|
bool isLastAluTrans) const;
|
|
|
|
|
|
|
|
/// An instruction group can only access 2 channel pair (either [XY] or [ZW])
|
|
|
|
/// from KCache bank on R700+. This function check if MI set in input meet
|
|
|
|
/// this limitations
|
|
|
|
bool fitsConstReadLimitations(const std::vector<MachineInstr *> &) const;
|
|
|
|
/// Same but using const index set instead of MI set.
|
2013-03-14 16:50:45 +01:00
|
|
|
bool fitsConstReadLimitations(const std::vector<unsigned>&) const;
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Vector instructions are instructions that must fill all
|
2012-12-11 22:25:42 +01:00
|
|
|
/// instruction slots within an instruction group.
|
|
|
|
bool isVector(const MachineInstr &MI) const;
|
|
|
|
|
2016-01-28 17:04:37 +01:00
|
|
|
bool isMov(unsigned Opcode) const;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2014-10-09 03:59:35 +02:00
|
|
|
DFAPacketizer *
|
|
|
|
CreateTargetScheduleState(const TargetSubtargetInfo &) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-09-14 22:43:16 +02:00
|
|
|
bool reverseBranchCondition(
|
2016-06-24 08:30:11 +02:00
|
|
|
SmallVectorImpl<MachineOperand> &Cond) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-07-15 16:41:04 +02:00
|
|
|
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
|
2016-06-24 08:30:11 +02:00
|
|
|
MachineBasicBlock *&FBB,
|
|
|
|
SmallVectorImpl<MachineOperand> &Cond,
|
|
|
|
bool AllowModify) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-09-14 19:24:15 +02:00
|
|
|
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
|
2015-06-11 21:30:37 +02:00
|
|
|
MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
|
2016-09-14 19:23:48 +02:00
|
|
|
const DebugLoc &DL,
|
|
|
|
int *BytesAdded = nullptr) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-09-14 22:43:16 +02:00
|
|
|
unsigned removeBranch(MachineBasicBlock &MBB,
|
2016-09-14 19:23:48 +02:00
|
|
|
int *BytesRemvoed = nullptr) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-02-23 03:46:52 +01:00
|
|
|
bool isPredicated(const MachineInstr &MI) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2017-03-03 19:30:54 +01:00
|
|
|
bool isPredicable(const MachineInstr &MI) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2017-03-15 16:37:42 +01:00
|
|
|
bool isProfitableToDupForIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
|
2016-06-24 08:30:11 +02:00
|
|
|
BranchProbability Probability) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2017-03-15 16:37:42 +01:00
|
|
|
bool isProfitableToIfCvt(MachineBasicBlock &MBB, unsigned NumCycles,
|
2012-12-11 22:25:42 +01:00
|
|
|
unsigned ExtraPredCycles,
|
2015-09-11 01:10:42 +02:00
|
|
|
BranchProbability Probability) const override ;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-06-24 08:30:11 +02:00
|
|
|
bool isProfitableToIfCvt(MachineBasicBlock &TMBB,
|
|
|
|
unsigned NumTCycles, unsigned ExtraTCycles,
|
|
|
|
MachineBasicBlock &FMBB,
|
|
|
|
unsigned NumFCycles, unsigned ExtraFCycles,
|
|
|
|
BranchProbability Probability) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2020-09-28 17:49:41 +02:00
|
|
|
bool ClobbersPredicate(MachineInstr &MI, std::vector<MachineOperand> &Pred,
|
|
|
|
bool SkipDead) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
|
|
|
bool isProfitableToUnpredicate(MachineBasicBlock &TMBB,
|
2016-06-24 08:30:11 +02:00
|
|
|
MachineBasicBlock &FMBB) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-02-23 03:46:52 +01:00
|
|
|
bool PredicateInstruction(MachineInstr &MI,
|
2015-06-11 21:30:37 +02:00
|
|
|
ArrayRef<MachineOperand> Pred) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-02-23 03:46:52 +01:00
|
|
|
unsigned int getPredicationCost(const MachineInstr &) const override;
|
2013-09-30 17:28:56 +02:00
|
|
|
|
2012-12-11 22:25:42 +01:00
|
|
|
unsigned int getInstrLatency(const InstrItineraryData *ItinData,
|
2016-06-30 02:01:54 +02:00
|
|
|
const MachineInstr &MI,
|
2014-04-29 09:57:24 +02:00
|
|
|
unsigned *PredCost = nullptr) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2016-06-30 02:01:54 +02:00
|
|
|
bool expandPostRAPseudo(MachineInstr &MI) const override;
|
2014-06-17 18:53:14 +02:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Reserve the registers that may be accesed using indirect addressing.
|
2013-11-14 00:36:50 +01:00
|
|
|
void reserveIndirectRegisters(BitVector &Reserved,
|
[AMDGPU] Make sure all super regs of reserved regs are marked reserved.
Summary:
Move reserveRegisterTuples into AMDGPURegisterInfo and use it in
R600RegisterInfo::getReservedRegs and
R600InstrInfo::reserveIndirectRegisters to ensure that all super
registers of reserved registers are also marked as reserved.
Before this change, under certain circumstances, the registers %t1_x and
%t1_xyzw would be marked as reserved, but %t1_xy and %t1_xyz would not
be, leading to the register allocator sometimes assigning a register to
%t1_xy, which is invalid since %t1_x is reserved.
Reviewers: arsenm, tstellar, MatzeB, qcolombet
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D42448
llvm-svn: 323356
2018-01-24 19:09:53 +01:00
|
|
|
const MachineFunction &MF,
|
|
|
|
const R600RegisterInfo &TRI) const;
|
2013-02-06 18:32:29 +01:00
|
|
|
|
2016-02-05 19:44:57 +01:00
|
|
|
/// Calculate the "Indirect Address" for the given \p RegIndex and
|
|
|
|
/// \p Channel
|
|
|
|
///
|
|
|
|
/// We model indirect addressing using a virtual address space that can be
|
|
|
|
/// accesed with loads and stores. The "Indirect Address" is the memory
|
|
|
|
/// address in this virtual address space that maps to the given \p RegIndex
|
|
|
|
/// and \p Channel.
|
|
|
|
unsigned calculateIndirectAddress(unsigned RegIndex, unsigned Channel) const;
|
|
|
|
|
2013-02-06 18:32:29 +01:00
|
|
|
|
2016-07-09 20:11:15 +02:00
|
|
|
/// \returns The register class to be used for loading and storing values
|
|
|
|
/// from an "Indirect Address" .
|
|
|
|
const TargetRegisterClass *getIndirectAddrRegClass() const;
|
|
|
|
|
|
|
|
/// \returns the smallest register index that will be accessed by an indirect
|
|
|
|
/// read or write or -1 if indirect addressing is not used by this program.
|
|
|
|
int getIndirectIndexBegin(const MachineFunction &MF) const;
|
|
|
|
|
|
|
|
/// \returns the largest register index that will be accessed by an indirect
|
|
|
|
/// read or write or -1 if indirect addressing is not used by this program.
|
|
|
|
int getIndirectIndexEnd(const MachineFunction &MF) const;
|
2013-02-06 18:32:29 +01:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Build instruction(s) for an indirect register write.
|
2016-02-05 19:44:57 +01:00
|
|
|
///
|
|
|
|
/// \returns The instruction that performs the indirect register write
|
2014-04-29 09:57:24 +02:00
|
|
|
MachineInstrBuilder buildIndirectWrite(MachineBasicBlock *MBB,
|
2016-02-05 19:44:57 +01:00
|
|
|
MachineBasicBlock::iterator I,
|
|
|
|
unsigned ValueReg, unsigned Address,
|
|
|
|
unsigned OffsetReg) const;
|
2013-02-06 18:32:29 +01:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Build instruction(s) for an indirect register read.
|
2016-02-05 19:44:57 +01:00
|
|
|
///
|
|
|
|
/// \returns The instruction that performs the indirect register read
|
2014-04-29 09:57:24 +02:00
|
|
|
MachineInstrBuilder buildIndirectRead(MachineBasicBlock *MBB,
|
|
|
|
MachineBasicBlock::iterator I,
|
|
|
|
unsigned ValueReg, unsigned Address,
|
2016-02-05 19:44:57 +01:00
|
|
|
unsigned OffsetReg) const;
|
2013-02-06 18:32:29 +01:00
|
|
|
|
2013-04-03 18:49:34 +02:00
|
|
|
unsigned getMaxAlusPerClause() const;
|
2013-02-06 18:32:29 +01:00
|
|
|
|
2016-06-24 08:30:11 +02:00
|
|
|
/// buildDefaultInstruction - This function returns a MachineInstr with all
|
|
|
|
/// the instruction modifiers initialized to their default values. You can
|
|
|
|
/// use this function to avoid manually specifying each instruction modifier
|
|
|
|
/// operand when building a new instruction.
|
2012-12-11 22:25:42 +01:00
|
|
|
///
|
|
|
|
/// \returns a MachineInstr with all the instruction modifiers initialized
|
|
|
|
/// to their default values.
|
|
|
|
MachineInstrBuilder buildDefaultInstruction(MachineBasicBlock &MBB,
|
|
|
|
MachineBasicBlock::iterator I,
|
|
|
|
unsigned Opcode,
|
|
|
|
unsigned DstReg,
|
|
|
|
unsigned Src0Reg,
|
|
|
|
unsigned Src1Reg = 0) const;
|
|
|
|
|
2013-05-17 18:50:32 +02:00
|
|
|
MachineInstr *buildSlotOfVectorInstruction(MachineBasicBlock &MBB,
|
|
|
|
MachineInstr *MI,
|
|
|
|
unsigned Slot,
|
|
|
|
unsigned DstReg) const;
|
|
|
|
|
2012-12-11 22:25:42 +01:00
|
|
|
MachineInstr *buildMovImm(MachineBasicBlock &BB,
|
2016-06-24 08:30:11 +02:00
|
|
|
MachineBasicBlock::iterator I,
|
|
|
|
unsigned DstReg,
|
|
|
|
uint64_t Imm) const;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2013-10-22 20:19:10 +02:00
|
|
|
MachineInstr *buildMovInstr(MachineBasicBlock *MBB,
|
|
|
|
MachineBasicBlock::iterator I,
|
2016-01-28 17:04:37 +01:00
|
|
|
unsigned DstReg, unsigned SrcReg) const;
|
2013-10-22 20:19:10 +02:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Get the index of Op in the MachineInstr.
|
2012-12-11 22:25:42 +01:00
|
|
|
///
|
|
|
|
/// \returns -1 if the Instruction does not contain the specified \p Op.
|
2013-06-25 23:22:18 +02:00
|
|
|
int getOperandIdx(const MachineInstr &MI, unsigned Op) const;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Get the index of \p Op for the given Opcode.
|
2012-12-11 22:25:42 +01:00
|
|
|
///
|
|
|
|
/// \returns -1 if the Instruction does not contain the specified \p Op.
|
2013-06-25 23:22:18 +02:00
|
|
|
int getOperandIdx(unsigned Opcode, unsigned Op) const;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Helper function for setting instruction flag values.
|
2016-06-30 02:01:54 +02:00
|
|
|
void setImmOperand(MachineInstr &MI, unsigned Op, int64_t Imm) const;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
///Add one of the MO_FLAG* flags to the specified \p Operand.
|
2016-06-30 02:01:54 +02:00
|
|
|
void addFlag(MachineInstr &MI, unsigned Operand, unsigned Flag) const;
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
///Determine if the specified \p Flag is set on this \p Operand.
|
2012-12-11 22:25:42 +01:00
|
|
|
bool isFlagSet(const MachineInstr &MI, unsigned Operand, unsigned Flag) const;
|
|
|
|
|
|
|
|
/// \param SrcIdx The register source to set the flag on (e.g src0, src1, src2)
|
|
|
|
/// \param Flag The flag being set.
|
|
|
|
///
|
|
|
|
/// \returns the operand containing the flags for this instruction.
|
2016-06-30 02:01:54 +02:00
|
|
|
MachineOperand &getFlagOp(MachineInstr &MI, unsigned SrcIdx = 0,
|
2012-12-11 22:25:42 +01:00
|
|
|
unsigned Flag = 0) const;
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Clear the specified flag on the instruction.
|
2016-06-30 02:01:54 +02:00
|
|
|
void clearFlag(MachineInstr &MI, unsigned Operand, unsigned Flag) const;
|
2016-01-28 17:04:37 +01:00
|
|
|
|
|
|
|
// Helper functions that check the opcode for status information
|
2016-08-13 03:43:46 +02:00
|
|
|
bool isRegisterStore(const MachineInstr &MI) const {
|
|
|
|
return get(MI.getOpcode()).TSFlags & R600InstrFlags::REGISTER_STORE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isRegisterLoad(const MachineInstr &MI) const {
|
|
|
|
return get(MI.getOpcode()).TSFlags & R600InstrFlags::REGISTER_LOAD;
|
|
|
|
}
|
2017-11-10 02:53:24 +01:00
|
|
|
|
|
|
|
unsigned getAddressSpaceForPseudoSourceKind(
|
2018-08-20 21:23:45 +02:00
|
|
|
unsigned Kind) const override;
|
2012-12-11 22:25:42 +01:00
|
|
|
};
|
|
|
|
|
AMDGPU: Separate R600 and GCN TableGen files
Summary:
We now have two sets of generated TableGen files, one for R600 and one
for GCN, so each sub-target now has its own tables of instructions,
registers, ISel patterns, etc. This should help reduce compile time
since each sub-target now only has to consider information that
is specific to itself. This will also help prevent the R600
sub-target from slowing down new features for GCN, like disassembler
support, GlobalISel, etc.
Reviewers: arsenm, nhaehnle, jvesely
Reviewed By: arsenm
Subscribers: MatzeB, kzhuravl, wdng, mgorny, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46365
llvm-svn: 335942
2018-06-29 01:47:12 +02:00
|
|
|
namespace R600 {
|
2013-09-05 20:38:09 +02:00
|
|
|
|
|
|
|
int getLDSNoRetOp(uint16_t Opcode);
|
|
|
|
|
|
|
|
} //End namespace AMDGPU
|
|
|
|
|
2015-06-23 11:49:53 +02:00
|
|
|
} // End llvm namespace
|
2012-12-11 22:25:42 +01:00
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#endif
|