LLVM  15.0.0git
AMDGPUMIRFormatter.cpp
Go to the documentation of this file.
1 //===- AMDGPUMIRFormatter.cpp ---------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// Implementation of AMDGPU overrides of MIRFormatter.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "AMDGPUMIRFormatter.h"
15 #include "GCNSubtarget.h"
16 #include "SIMachineFunctionInfo.h"
17 
18 using namespace llvm;
19 
22  const PseudoSourceValue *&PSV, ErrorCallbackType ErrorCallback) const {
24  const AMDGPUTargetMachine &TM =
25  static_cast<const AMDGPUTargetMachine &>(MF.getTarget());
26  if (Src == "BufferResource") {
27  PSV = MFI->getBufferPSV(TM);
28  return false;
29  }
30  if (Src == "ImageResource") {
31  PSV = MFI->getImagePSV(TM);
32  return false;
33  }
34  if (Src == "GWSResource") {
35  PSV = MFI->getGWSPSV(TM);
36  return false;
37  }
38  llvm_unreachable("unknown MIR custom pseudo source value");
39 }
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
SIMachineFunctionInfo.h
llvm::AMDGPUMIRFormatter::parseCustomPseudoSourceValue
virtual bool parseCustomPseudoSourceValue(StringRef Src, MachineFunction &MF, PerFunctionMIParsingState &PFS, const PseudoSourceValue *&PSV, ErrorCallbackType ErrorCallback) const override
Implement target specific parsing of target custom pseudo source value.
Definition: AMDGPUMIRFormatter.cpp:20
llvm::SIMachineFunctionInfo::getGWSPSV
const AMDGPUGWSResourcePseudoSourceValue * getGWSPSV(const AMDGPUTargetMachine &TM)
Definition: SIMachineFunctionInfo.h:941
llvm::SIMachineFunctionInfo::getImagePSV
const AMDGPUImagePseudoSourceValue * getImagePSV(const AMDGPUTargetMachine &TM)
Definition: SIMachineFunctionInfo.h:936
llvm::AMDGPUTargetMachine
Definition: AMDGPUTargetMachine.h:28
GCNSubtarget.h
llvm::MachineFunction::getInfo
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Definition: MachineFunction.h:754
AMDGPUMIRFormatter.h
llvm::PseudoSourceValue
Special value supplied for machine level alias analysis.
Definition: PseudoSourceValue.h:35
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
llvm::MachineFunction
Definition: MachineFunction.h:257
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::PerFunctionMIParsingState
Definition: MIParser.h:162
llvm::MachineFunction::getTarget
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition: MachineFunction.h:652
llvm::SIMachineFunctionInfo::getBufferPSV
const AMDGPUBufferPseudoSourceValue * getBufferPSV(const AMDGPUTargetMachine &TM)
Definition: SIMachineFunctionInfo.h:931
llvm::SIMachineFunctionInfo
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
Definition: SIMachineFunctionInfo.h:349
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47