Revert "[GlobalISel] GIntrinsic subclass to represent intrinsics in Generic Machine IR"
This reverts commit baa3386edb11a2f9bcadda8cf58d56f3707c39fa. The changes did not cover all occurrences of the deteleted function MachineInstr::getIntrinsicID().
This commit is contained in:
parent
baa3386edb
commit
d0f7850b01
@ -358,29 +358,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// Represents a call to an intrinsic.
|
||||
class GIntrinsic final : public GenericMachineInstr {
|
||||
public:
|
||||
Intrinsic::ID getIntrinsicID() const {
|
||||
return getOperand(getNumExplicitDefs()).getIntrinsicID();
|
||||
}
|
||||
|
||||
bool is(Intrinsic::ID ID) const { return getIntrinsicID() == ID; }
|
||||
bool hasSideEffects() const {
|
||||
return getOpcode() == TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS;
|
||||
}
|
||||
|
||||
static bool classof(const MachineInstr *MI) {
|
||||
switch (MI->getOpcode()) {
|
||||
case TargetOpcode::G_INTRINSIC:
|
||||
case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_GLOBALISEL_GENERICMACHINEINSTRS_H
|
||||
|
||||
@ -1930,6 +1930,12 @@ public:
|
||||
/// and point them to \p Reg instead.
|
||||
void changeDebugValuesDefReg(Register Reg);
|
||||
|
||||
/// Returns the Intrinsic::ID for this instruction.
|
||||
/// \pre Must have an intrinsic ID operand.
|
||||
unsigned getIntrinsicID() const {
|
||||
return getOperand(getNumExplicitDefs()).getIntrinsicID();
|
||||
}
|
||||
|
||||
/// Sets all register debug operands in this debug value instruction to be
|
||||
/// undef.
|
||||
void setDebugValueUndef() {
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
#include "AMDGPUCombinerHelper.h"
|
||||
#include "GCNSubtarget.h"
|
||||
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
|
||||
#include "llvm/IR/IntrinsicsAMDGPU.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
@ -43,7 +42,7 @@ static bool fnegFoldsIntoMI(const MachineInstr &MI) {
|
||||
case AMDGPU::G_AMDGPU_FMAX_LEGACY:
|
||||
return true;
|
||||
case AMDGPU::G_INTRINSIC: {
|
||||
unsigned IntrinsicID = cast<GIntrinsic>(MI).getIntrinsicID();
|
||||
unsigned IntrinsicID = MI.getIntrinsicID();
|
||||
switch (IntrinsicID) {
|
||||
case Intrinsic::amdgcn_rcp:
|
||||
case Intrinsic::amdgcn_rcp_legacy:
|
||||
@ -93,7 +92,7 @@ static bool hasSourceMods(const MachineInstr &MI) {
|
||||
case AMDGPU::G_PHI:
|
||||
return false;
|
||||
case AMDGPU::G_INTRINSIC: {
|
||||
unsigned IntrinsicID = cast<GIntrinsic>(MI).getIntrinsicID();
|
||||
unsigned IntrinsicID = MI.getIntrinsicID();
|
||||
switch (IntrinsicID) {
|
||||
case Intrinsic::amdgcn_interp_p1:
|
||||
case Intrinsic::amdgcn_interp_p2:
|
||||
@ -229,7 +228,7 @@ bool AMDGPUCombinerHelper::matchFoldableFneg(MachineInstr &MI,
|
||||
case AMDGPU::G_AMDGPU_RCP_IFLAG:
|
||||
return true;
|
||||
case AMDGPU::G_INTRINSIC: {
|
||||
unsigned IntrinsicID = cast<GIntrinsic>(MatchInfo)->getIntrinsicID();
|
||||
unsigned IntrinsicID = MatchInfo->getIntrinsicID();
|
||||
switch (IntrinsicID) {
|
||||
case Intrinsic::amdgcn_rcp:
|
||||
case Intrinsic::amdgcn_rcp_legacy:
|
||||
@ -328,7 +327,7 @@ void AMDGPUCombinerHelper::applyFoldableFneg(MachineInstr &MI,
|
||||
NegateOperand(MatchInfo->getOperand(1));
|
||||
break;
|
||||
case AMDGPU::G_INTRINSIC: {
|
||||
unsigned IntrinsicID = cast<GIntrinsic>(MatchInfo)->getIntrinsicID();
|
||||
unsigned IntrinsicID = MatchInfo->getIntrinsicID();
|
||||
switch (IntrinsicID) {
|
||||
case Intrinsic::amdgcn_rcp:
|
||||
case Intrinsic::amdgcn_rcp_legacy:
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
|
||||
#include "AMDGPUInstrInfo.h"
|
||||
#include "AMDGPU.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Instruction.h"
|
||||
@ -27,9 +26,6 @@ using namespace llvm;
|
||||
|
||||
AMDGPUInstrInfo::AMDGPUInstrInfo(const GCNSubtarget &ST) { }
|
||||
|
||||
Intrinsic::ID AMDGPU::getIntrinsicID(const MachineInstr &I) {
|
||||
return I.getOperand(I.getNumExplicitDefs()).getIntrinsicID();
|
||||
}
|
||||
|
||||
// TODO: Should largely merge with AMDGPUTTIImpl::isSourceOfDivergence.
|
||||
bool AMDGPUInstrInfo::isUniformMMO(const MachineMemOperand *MMO) {
|
||||
|
||||
@ -21,7 +21,6 @@ namespace llvm {
|
||||
|
||||
class GCNSubtarget;
|
||||
class MachineMemOperand;
|
||||
class MachineInstr;
|
||||
|
||||
class AMDGPUInstrInfo {
|
||||
public:
|
||||
@ -32,13 +31,6 @@ public:
|
||||
|
||||
namespace AMDGPU {
|
||||
|
||||
/// Return the intrinsic ID for opcodes with the G_AMDGPU_INTRIN_ prefix.
|
||||
///
|
||||
/// These opcodes have an Intrinsic::ID operand similar to a GIntrinsic. But
|
||||
/// they are not actual instances of GIntrinsics, so we cannot use
|
||||
/// GIntrinsic::getIntrinsicID() on them.
|
||||
unsigned getIntrinsicID(const MachineInstr &I);
|
||||
|
||||
struct RsrcIntrinsic {
|
||||
unsigned Intr;
|
||||
uint8_t RsrcArg;
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "Utils/AMDGPUBaseInfo.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
@ -1002,7 +1001,7 @@ bool AMDGPUInstructionSelector::selectDivScale(MachineInstr &MI) const {
|
||||
}
|
||||
|
||||
bool AMDGPUInstructionSelector::selectG_INTRINSIC(MachineInstr &I) const {
|
||||
unsigned IntrinsicID = cast<GIntrinsic>(I).getIntrinsicID();
|
||||
unsigned IntrinsicID = I.getIntrinsicID();
|
||||
switch (IntrinsicID) {
|
||||
case Intrinsic::amdgcn_if_break: {
|
||||
MachineBasicBlock *BB = I.getParent();
|
||||
@ -2009,7 +2008,7 @@ bool AMDGPUInstructionSelector::selectDSBvhStackIntrinsic(
|
||||
|
||||
bool AMDGPUInstructionSelector::selectG_INTRINSIC_W_SIDE_EFFECTS(
|
||||
MachineInstr &I) const {
|
||||
unsigned IntrinsicID = cast<GIntrinsic>(I).getIntrinsicID();
|
||||
unsigned IntrinsicID = I.getIntrinsicID();
|
||||
switch (IntrinsicID) {
|
||||
case Intrinsic::amdgcn_end_cf:
|
||||
return selectEndCfIntrinsic(I);
|
||||
@ -2690,8 +2689,8 @@ static bool isVCmpResult(Register Reg, MachineRegisterInfo &MRI) {
|
||||
return isVCmpResult(MI.getOperand(1).getReg(), MRI) &&
|
||||
isVCmpResult(MI.getOperand(2).getReg(), MRI);
|
||||
|
||||
if (auto *GI = dyn_cast<GIntrinsic>(&MI))
|
||||
return GI->is(Intrinsic::amdgcn_class);
|
||||
if (Opcode == TargetOpcode::G_INTRINSIC)
|
||||
return MI.getIntrinsicID() == Intrinsic::amdgcn_class;
|
||||
|
||||
return Opcode == AMDGPU::G_ICMP || Opcode == AMDGPU::G_FCMP;
|
||||
}
|
||||
@ -3253,7 +3252,7 @@ bool AMDGPUInstructionSelector::selectBVHIntrinsic(MachineInstr &MI) const{
|
||||
|
||||
bool AMDGPUInstructionSelector::selectSMFMACIntrin(MachineInstr &MI) const {
|
||||
unsigned Opc;
|
||||
switch (cast<GIntrinsic>(MI).getIntrinsicID()) {
|
||||
switch (MI.getIntrinsicID()) {
|
||||
case Intrinsic::amdgcn_smfmac_f32_16x16x32_f16:
|
||||
Opc = AMDGPU::V_SMFMAC_F32_16X16X32_F16_e64;
|
||||
break;
|
||||
@ -3458,8 +3457,8 @@ bool AMDGPUInstructionSelector::select(MachineInstr &I) {
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_LOAD_D16:
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_STORE:
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_STORE_D16: {
|
||||
const AMDGPU::ImageDimIntrinsicInfo *Intr =
|
||||
AMDGPU::getImageDimIntrinsicInfo(AMDGPU::getIntrinsicID(I));
|
||||
const AMDGPU::ImageDimIntrinsicInfo *Intr
|
||||
= AMDGPU::getImageDimIntrinsicInfo(I.getIntrinsicID());
|
||||
assert(Intr && "not an image intrinsic with image pseudo");
|
||||
return selectImageIntrinsic(I, Intr);
|
||||
}
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "Utils/AMDGPUBaseInfo.h"
|
||||
#include "llvm/ADT/ScopeExit.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
|
||||
#include "llvm/CodeGen/GlobalISel/LegalizerHelper.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
|
||||
@ -6525,7 +6524,7 @@ bool AMDGPULegalizerInfo::legalizeIntrinsic(LegalizerHelper &Helper,
|
||||
MachineRegisterInfo &MRI = *B.getMRI();
|
||||
|
||||
// Replace the use G_BRCOND with the exec manipulate and branch pseudos.
|
||||
auto IntrID = cast<GIntrinsic>(MI).getIntrinsicID();
|
||||
auto IntrID = MI.getIntrinsicID();
|
||||
switch (IntrID) {
|
||||
case Intrinsic::amdgcn_if:
|
||||
case Intrinsic::amdgcn_else: {
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
|
||||
#include "llvm/CodeGen/MachineDominators.h"
|
||||
#include "llvm/CodeGen/TargetPassConfig.h"
|
||||
@ -269,10 +268,10 @@ bool AMDGPUPostLegalizerCombinerImpl::matchRcpSqrtToRsq(
|
||||
|
||||
auto getRcpSrc = [=](const MachineInstr &MI) {
|
||||
MachineInstr *ResMI = nullptr;
|
||||
if (auto *GI = dyn_cast<GIntrinsic>(&MI)) {
|
||||
if (GI->is(Intrinsic::amdgcn_rcp))
|
||||
ResMI = MRI.getVRegDef(MI.getOperand(2).getReg());
|
||||
}
|
||||
if (MI.getOpcode() == TargetOpcode::G_INTRINSIC &&
|
||||
MI.getIntrinsicID() == Intrinsic::amdgcn_rcp)
|
||||
ResMI = MRI.getVRegDef(MI.getOperand(2).getReg());
|
||||
|
||||
return ResMI;
|
||||
};
|
||||
|
||||
|
||||
@ -337,7 +337,7 @@ AMDGPURegisterBankInfo::addMappingFromTable(
|
||||
RegisterBankInfo::InstructionMappings
|
||||
AMDGPURegisterBankInfo::getInstrAlternativeMappingsIntrinsic(
|
||||
const MachineInstr &MI, const MachineRegisterInfo &MRI) const {
|
||||
switch (cast<GIntrinsic>(MI).getIntrinsicID()) {
|
||||
switch (MI.getIntrinsicID()) {
|
||||
case Intrinsic::amdgcn_readlane: {
|
||||
static const OpRegBankEntry<3> Table[2] = {
|
||||
// Perfectly legal.
|
||||
@ -378,7 +378,7 @@ RegisterBankInfo::InstructionMappings
|
||||
AMDGPURegisterBankInfo::getInstrAlternativeMappingsIntrinsicWSideEffects(
|
||||
const MachineInstr &MI, const MachineRegisterInfo &MRI) const {
|
||||
|
||||
switch (cast<GIntrinsic>(MI).getIntrinsicID()) {
|
||||
switch (MI.getIntrinsicID()) {
|
||||
case Intrinsic::amdgcn_s_buffer_load: {
|
||||
static const OpRegBankEntry<2> Table[4] = {
|
||||
// Perfectly legal.
|
||||
@ -2949,7 +2949,7 @@ void AMDGPURegisterBankInfo::applyMappingImpl(
|
||||
return;
|
||||
}
|
||||
case AMDGPU::G_INTRINSIC: {
|
||||
switch (cast<GIntrinsic>(MI).getIntrinsicID()) {
|
||||
switch (MI.getIntrinsicID()) {
|
||||
case Intrinsic::amdgcn_readlane: {
|
||||
substituteSimpleCopyRegs(OpdMapper, 2);
|
||||
|
||||
@ -3019,8 +3019,8 @@ void AMDGPURegisterBankInfo::applyMappingImpl(
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_LOAD_D16:
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_STORE:
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_STORE_D16: {
|
||||
const AMDGPU::RsrcIntrinsic *RSrcIntrin =
|
||||
AMDGPU::lookupRsrcIntrinsic(AMDGPU::getIntrinsicID(MI));
|
||||
const AMDGPU::RsrcIntrinsic *RSrcIntrin
|
||||
= AMDGPU::lookupRsrcIntrinsic(MI.getIntrinsicID());
|
||||
assert(RSrcIntrin && RSrcIntrin->IsImage);
|
||||
// Non-images can have complications from operands that allow both SGPR
|
||||
// and VGPR. For now it's too complicated to figure out the final opcode
|
||||
@ -3035,7 +3035,7 @@ void AMDGPURegisterBankInfo::applyMappingImpl(
|
||||
return;
|
||||
}
|
||||
case AMDGPU::G_INTRINSIC_W_SIDE_EFFECTS: {
|
||||
auto IntrID = cast<GIntrinsic>(MI).getIntrinsicID();
|
||||
auto IntrID = MI.getIntrinsicID();
|
||||
switch (IntrID) {
|
||||
case Intrinsic::amdgcn_ds_ordered_add:
|
||||
case Intrinsic::amdgcn_ds_ordered_swap: {
|
||||
@ -4198,7 +4198,7 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
|
||||
break;
|
||||
}
|
||||
case AMDGPU::G_INTRINSIC: {
|
||||
switch (cast<GIntrinsic>(MI).getIntrinsicID()) {
|
||||
switch (MI.getIntrinsicID()) {
|
||||
default:
|
||||
return getInvalidInstructionMapping();
|
||||
case Intrinsic::amdgcn_div_fmas:
|
||||
@ -4531,7 +4531,7 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_LOAD_D16:
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_STORE:
|
||||
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_STORE_D16: {
|
||||
auto IntrID = AMDGPU::getIntrinsicID(MI);
|
||||
auto IntrID = MI.getIntrinsicID();
|
||||
const AMDGPU::RsrcIntrinsic *RSrcIntrin = AMDGPU::lookupRsrcIntrinsic(IntrID);
|
||||
assert(RSrcIntrin && "missing RsrcIntrinsic for image intrinsic");
|
||||
// Non-images can have complications from operands that allow both SGPR
|
||||
@ -4560,7 +4560,7 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
|
||||
break;
|
||||
}
|
||||
case AMDGPU::G_INTRINSIC_W_SIDE_EFFECTS: {
|
||||
auto IntrID = cast<GIntrinsic>(MI).getIntrinsicID();
|
||||
auto IntrID = MI.getIntrinsicID();
|
||||
switch (IntrID) {
|
||||
case Intrinsic::amdgcn_s_getreg:
|
||||
case Intrinsic::amdgcn_s_memtime:
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
#include "llvm/CodeGen/ByteProvider.h"
|
||||
#include "llvm/CodeGen/FunctionLoweringInfo.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
@ -11303,7 +11302,7 @@ bool SITargetLowering::isCanonicalized(Register Reg, MachineFunction &MF,
|
||||
return false;
|
||||
return true;
|
||||
case AMDGPU::G_INTRINSIC:
|
||||
switch (cast<GIntrinsic>(MI)->getIntrinsicID()) {
|
||||
switch (MI->getIntrinsicID()) {
|
||||
case Intrinsic::amdgcn_fmul_legacy:
|
||||
case Intrinsic::amdgcn_fmad_ftz:
|
||||
case Intrinsic::amdgcn_sqrt:
|
||||
@ -13737,7 +13736,7 @@ void SITargetLowering::computeKnownBitsForTargetInstr(
|
||||
const MachineInstr *MI = MRI.getVRegDef(R);
|
||||
switch (MI->getOpcode()) {
|
||||
case AMDGPU::G_INTRINSIC: {
|
||||
switch (cast<GIntrinsic>(MI)->getIntrinsicID()) {
|
||||
switch (MI->getIntrinsicID()) {
|
||||
case Intrinsic::amdgcn_workitem_id_x:
|
||||
knownBitsForWorkitemID(*getSubtarget(), KB, Known, 0);
|
||||
break;
|
||||
@ -13802,17 +13801,21 @@ Align SITargetLowering::computeKnownAlignForTargetInstr(
|
||||
GISelKnownBits &KB, Register R, const MachineRegisterInfo &MRI,
|
||||
unsigned Depth) const {
|
||||
const MachineInstr *MI = MRI.getVRegDef(R);
|
||||
if (auto *GI = dyn_cast<GIntrinsic>(MI)) {
|
||||
switch (MI->getOpcode()) {
|
||||
case AMDGPU::G_INTRINSIC:
|
||||
case AMDGPU::G_INTRINSIC_W_SIDE_EFFECTS: {
|
||||
// FIXME: Can this move to generic code? What about the case where the call
|
||||
// site specifies a lower alignment?
|
||||
Intrinsic::ID IID = GI->getIntrinsicID();
|
||||
Intrinsic::ID IID = MI->getIntrinsicID();
|
||||
LLVMContext &Ctx = KB.getMachineFunction().getFunction().getContext();
|
||||
AttributeList Attrs = Intrinsic::getAttributes(Ctx, IID);
|
||||
if (MaybeAlign RetAlign = Attrs.getRetAlignment())
|
||||
return *RetAlign;
|
||||
return Align(1);
|
||||
}
|
||||
return Align(1);
|
||||
default:
|
||||
return Align(1);
|
||||
}
|
||||
}
|
||||
|
||||
Align SITargetLowering::getPrefLoopAlignment(MachineLoop *ML) const {
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#include "GCNSubtarget.h"
|
||||
#include "SIMachineFunctionInfo.h"
|
||||
#include "llvm/Analysis/ValueTracking.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
|
||||
#include "llvm/CodeGen/LiveIntervals.h"
|
||||
#include "llvm/CodeGen/LiveVariables.h"
|
||||
#include "llvm/CodeGen/MachineDominators.h"
|
||||
@ -8604,8 +8603,9 @@ unsigned SIInstrInfo::getInstrLatency(const InstrItineraryData *ItinData,
|
||||
InstructionUniformity
|
||||
SIInstrInfo::getGenericInstructionUniformity(const MachineInstr &MI) const {
|
||||
unsigned opcode = MI.getOpcode();
|
||||
if (auto *GI = dyn_cast<GIntrinsic>(&MI)) {
|
||||
auto IID = GI->getIntrinsicID();
|
||||
if (opcode == AMDGPU::G_INTRINSIC ||
|
||||
opcode == AMDGPU::G_INTRINSIC_W_SIDE_EFFECTS) {
|
||||
auto IID = static_cast<Intrinsic::ID>(MI.getIntrinsicID());
|
||||
if (AMDGPU::isIntrinsicSourceOfDivergence(IID))
|
||||
return InstructionUniformity::NeverUniform;
|
||||
if (AMDGPU::isIntrinsicAlwaysUniform(IID))
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
#include "SPIRVUtils.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
|
||||
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
@ -1315,7 +1314,7 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
|
||||
const SPIRVType *ResType,
|
||||
MachineInstr &I) const {
|
||||
MachineBasicBlock &BB = *I.getParent();
|
||||
switch (cast<GIntrinsic>(I).getIntrinsicID()) {
|
||||
switch (I.getIntrinsicID()) {
|
||||
case Intrinsic::spv_load:
|
||||
return selectLoad(ResVReg, ResType, I);
|
||||
case Intrinsic::spv_store:
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
#include "SPIRV.h"
|
||||
#include "SPIRVInstrInfo.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/CodeGen/GlobalISel/GenericMachineInstrs.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
@ -210,14 +209,13 @@ SPIRV::MemorySemantics::MemorySemantics getMemSemantics(AtomicOrdering Ord) {
|
||||
MachineInstr *getDefInstrMaybeConstant(Register &ConstReg,
|
||||
const MachineRegisterInfo *MRI) {
|
||||
MachineInstr *ConstInstr = MRI->getVRegDef(ConstReg);
|
||||
if (auto *GI = dyn_cast<GIntrinsic>(ConstInstr)) {
|
||||
if (GI->is(Intrinsic::spv_track_constant)) {
|
||||
ConstReg = ConstInstr->getOperand(2).getReg();
|
||||
return MRI->getVRegDef(ConstReg);
|
||||
}
|
||||
if (ConstInstr->getOpcode() == TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS &&
|
||||
ConstInstr->getIntrinsicID() == Intrinsic::spv_track_constant) {
|
||||
ConstReg = ConstInstr->getOperand(2).getReg();
|
||||
ConstInstr = MRI->getVRegDef(ConstReg);
|
||||
} else if (ConstInstr->getOpcode() == SPIRV::ASSIGN_TYPE) {
|
||||
ConstReg = ConstInstr->getOperand(1).getReg();
|
||||
return MRI->getVRegDef(ConstReg);
|
||||
ConstInstr = MRI->getVRegDef(ConstReg);
|
||||
}
|
||||
return ConstInstr;
|
||||
}
|
||||
@ -229,9 +227,8 @@ uint64_t getIConstVal(Register ConstReg, const MachineRegisterInfo *MRI) {
|
||||
}
|
||||
|
||||
bool isSpvIntrinsic(MachineInstr &MI, Intrinsic::ID IntrinsicID) {
|
||||
if (auto *GI = dyn_cast<GIntrinsic>(&MI))
|
||||
return GI->is(IntrinsicID);
|
||||
return false;
|
||||
return MI.getOpcode() == TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS &&
|
||||
MI.getIntrinsicID() == IntrinsicID;
|
||||
}
|
||||
|
||||
Type *getMDOperandAsType(const MDNode *N, unsigned I) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user