mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
5d9dc9db26
Allow parsing generated mir with custom pseudo source value tokens. Also rename pseudo source values to have more meaningful names. Relands ba7dcd8542ab, which had memory leaks. Differential Revision: https://reviews.llvm.org/D95215
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
//===- AMDGPUMIRFormatter.cpp ---------------------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
/// \file
|
|
/// Implementation of AMDGPU overrides of MIRFormatter.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "AMDGPUMIRFormatter.h"
|
|
#include "GCNSubtarget.h"
|
|
#include "SIMachineFunctionInfo.h"
|
|
|
|
using namespace llvm;
|
|
|
|
bool AMDGPUMIRFormatter::parseCustomPseudoSourceValue(
|
|
StringRef Src, MachineFunction &MF, PerFunctionMIParsingState &PFS,
|
|
const PseudoSourceValue *&PSV, ErrorCallbackType ErrorCallback) const {
|
|
SIMachineFunctionInfo *MFI = MF.getInfo<SIMachineFunctionInfo>();
|
|
const SIInstrInfo &TII = *MF.getSubtarget<GCNSubtarget>().getInstrInfo();
|
|
if (Src == "BufferResource") {
|
|
PSV = MFI->getBufferPSV(TII);
|
|
return false;
|
|
}
|
|
if (Src == "ImageResource") {
|
|
PSV = MFI->getImagePSV(TII);
|
|
return false;
|
|
}
|
|
if (Src == "GWSResource") {
|
|
PSV = MFI->getGWSPSV(TII);
|
|
return false;
|
|
}
|
|
llvm_unreachable("unknown MIR custom pseudo source value");
|
|
}
|