|
@@ -16,6 +16,7 @@
|
|
|
#include "dxc/HLSL/DxilTypeSystem.h"
|
|
|
#include "dxc/HLSL/DxilRootSignature.h"
|
|
|
|
|
|
+#include "llvm/ADT/STLExtras.h"
|
|
|
#include "llvm/IR/Constants.h"
|
|
|
#include "llvm/IR/Function.h"
|
|
|
#include "llvm/IR/IRBuilder.h"
|
|
@@ -32,7 +33,6 @@ using std::string;
|
|
|
using std::vector;
|
|
|
using std::unique_ptr;
|
|
|
|
|
|
-
|
|
|
namespace hlsl {
|
|
|
|
|
|
static void
|
|
@@ -42,10 +42,10 @@ CreateSignatures(const ShaderModel *pSM,
|
|
|
std::unique_ptr<DxilSignature> &PatchConstantSignature,
|
|
|
std::unique_ptr<RootSignatureHandle> &RootSignature) {
|
|
|
DXIL::ShaderKind shaderKind = pSM->GetKind();
|
|
|
- InputSignature = std::make_unique<DxilSignature>(shaderKind, DxilSignature::Kind::Input);
|
|
|
- OutputSignature = std::make_unique<DxilSignature>(shaderKind, DxilSignature::Kind::Output);
|
|
|
- PatchConstantSignature = std::make_unique<DxilSignature>(shaderKind, DxilSignature::Kind::PatchConstant);
|
|
|
- RootSignature = std::make_unique<RootSignatureHandle>();
|
|
|
+ InputSignature = llvm::make_unique<DxilSignature>(shaderKind, DxilSignature::Kind::Input);
|
|
|
+ OutputSignature = llvm::make_unique<DxilSignature>(shaderKind, DxilSignature::Kind::Output);
|
|
|
+ PatchConstantSignature = llvm::make_unique<DxilSignature>(shaderKind, DxilSignature::Kind::PatchConstant);
|
|
|
+ RootSignature = llvm::make_unique<RootSignatureHandle>();
|
|
|
}
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
@@ -58,10 +58,10 @@ HLModule::HLModule(Module *pModule)
|
|
|
, m_pEntryFunc(nullptr)
|
|
|
, m_EntryName("")
|
|
|
, m_pSM(nullptr)
|
|
|
- , m_pOP(std::make_unique<OP>(pModule->getContext(), pModule))
|
|
|
- , m_pTypeSystem(std::make_unique<DxilTypeSystem>(pModule))
|
|
|
- , m_pMDHelper(std::make_unique<DxilMDHelper>(
|
|
|
- pModule, std::make_unique<HLExtraPropertyHelper>(pModule)))
|
|
|
+ , m_pOP(llvm::make_unique<OP>(pModule->getContext(), pModule))
|
|
|
+ , m_pTypeSystem(llvm::make_unique<DxilTypeSystem>(pModule))
|
|
|
+ , m_pMDHelper(llvm::make_unique<DxilMDHelper>(
|
|
|
+ pModule, llvm::make_unique<HLExtraPropertyHelper>(pModule)))
|
|
|
, m_pDebugInfoFinder(nullptr)
|
|
|
, m_DxilMajor(1)
|
|
|
, m_DxilMinor(0) {
|
|
@@ -507,7 +507,7 @@ void HLModule::LoadHLMetadata() {
|
|
|
while (propIdx < fnProps->getNumOperands()) {
|
|
|
MDTuple *pProps = dyn_cast<MDTuple>(fnProps->getOperand(propIdx++));
|
|
|
|
|
|
- std::unique_ptr<hlsl::HLFunctionProps> props = std::make_unique<hlsl::HLFunctionProps>();
|
|
|
+ std::unique_ptr<hlsl::HLFunctionProps> props = llvm::make_unique<hlsl::HLFunctionProps>();
|
|
|
unsigned idx = 0;
|
|
|
Function *F = dyn_cast<Function>(dyn_cast<ValueAsMetadata>(pProps->getOperand(idx++))->getValue());
|
|
|
switch (m_pSM->GetKind()) {
|
|
@@ -653,7 +653,7 @@ void HLModule::LoadHLResources(const llvm::MDOperand &MDO) {
|
|
|
// Load CBuffer records.
|
|
|
if (pCBuffers != nullptr) {
|
|
|
for (unsigned i = 0; i < pCBuffers->getNumOperands(); i++) {
|
|
|
- unique_ptr<DxilCBuffer> pCB = std::make_unique<DxilCBuffer>();
|
|
|
+ unique_ptr<DxilCBuffer> pCB = llvm::make_unique<DxilCBuffer>();
|
|
|
m_pMDHelper->LoadDxilCBuffer(pCBuffers->getOperand(i), *pCB);
|
|
|
AddCBuffer(std::move(pCB));
|
|
|
}
|
|
@@ -795,7 +795,7 @@ void HLModule::AddResourceWithGlobalVariableAndMDNode(llvm::Constant *GV,
|
|
|
|
|
|
switch (RC) {
|
|
|
case DxilResource::Class::Sampler: {
|
|
|
- std::unique_ptr<DxilSampler> S = std::make_unique<DxilSampler>();
|
|
|
+ std::unique_ptr<DxilSampler> S = llvm::make_unique<DxilSampler>();
|
|
|
m_pMDHelper->LoadDxilSampler(Meta, *S);
|
|
|
S->SetGlobalSymbol(GV);
|
|
|
S->SetGlobalName(GV->getName());
|
|
@@ -803,7 +803,7 @@ void HLModule::AddResourceWithGlobalVariableAndMDNode(llvm::Constant *GV,
|
|
|
AddSampler(std::move(S));
|
|
|
} break;
|
|
|
case DxilResource::Class::SRV: {
|
|
|
- std::unique_ptr<HLResource> Res = std::make_unique<HLResource>();
|
|
|
+ std::unique_ptr<HLResource> Res = llvm::make_unique<HLResource>();
|
|
|
m_pMDHelper->LoadDxilSRV(Meta, *Res);
|
|
|
Res->SetGlobalSymbol(GV);
|
|
|
Res->SetGlobalName(GV->getName());
|
|
@@ -811,7 +811,7 @@ void HLModule::AddResourceWithGlobalVariableAndMDNode(llvm::Constant *GV,
|
|
|
AddSRV(std::move(Res));
|
|
|
} break;
|
|
|
case DxilResource::Class::UAV: {
|
|
|
- std::unique_ptr<HLResource> Res = std::make_unique<HLResource>();
|
|
|
+ std::unique_ptr<HLResource> Res = llvm::make_unique<HLResource>();
|
|
|
m_pMDHelper->LoadDxilUAV(Meta, *Res);
|
|
|
Res->SetGlobalSymbol(GV);
|
|
|
Res->SetGlobalName(GV->getName());
|
|
@@ -1367,7 +1367,7 @@ void HLModule::UpdateGlobalVariableDebugInfo(
|
|
|
|
|
|
DebugInfoFinder &HLModule::GetOrCreateDebugInfoFinder() {
|
|
|
if (m_pDebugInfoFinder == nullptr) {
|
|
|
- m_pDebugInfoFinder = std::make_unique<llvm::DebugInfoFinder>();
|
|
|
+ m_pDebugInfoFinder = llvm::make_unique<llvm::DebugInfoFinder>();
|
|
|
m_pDebugInfoFinder->processModule(*m_pModule);
|
|
|
}
|
|
|
return *m_pDebugInfoFinder;
|
|
@@ -1397,7 +1397,7 @@ namespace llvm {
|
|
|
hlsl::HLModule &Module::GetOrCreateHLModule(bool skipInit) {
|
|
|
std::unique_ptr<hlsl::HLModule> M;
|
|
|
if (!HasHLModule()) {
|
|
|
- M = std::make_unique<hlsl::HLModule>(this);
|
|
|
+ M = llvm::make_unique<hlsl::HLModule>(this);
|
|
|
if (!skipInit) {
|
|
|
M->LoadHLMetadata();
|
|
|
}
|