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 "SIMachineFunctionInfo.h"
16 
17 using namespace llvm;
18 
19 bool AMDGPUMIRFormatter::parseCustomPseudoSourceValue(
20     StringRef Src, MachineFunction &MF, PerFunctionMIParsingState &PFS,
21     const PseudoSourceValue *&PSV, ErrorCallbackType ErrorCallback) const {
22   if (Src == "BufferResource") {
23     const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
24     PSV = new AMDGPUBufferPseudoSourceValue(*TII);
25     return false;
26   }
27   if (Src == "ImageResource") {
28     const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
29     PSV = new AMDGPUImagePseudoSourceValue(*TII);
30     return false;
31   }
32   if (Src == "GWSResource") {
33     const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
34     PSV = new AMDGPUGWSResourcePseudoSourceValue(*TII);
35     return false;
36   }
37   llvm_unreachable("unknown MIR custom pseudo source value");
38 }
39