Skip to content

Commit 6dd49d4

Browse files
committed
get infra setup
1 parent 9b74dce commit 6dd49d4

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed

llvm/include/llvm/Frontend/HLSL/HLSLRootSignature.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define LLVM_FRONTEND_HLSL_HLSLROOTSIGNATURE_H
1616

1717
#include "llvm/Support/DXILABI.h"
18+
#include "llvm/Support/raw_ostream.h"
1819
#include <variant>
1920

2021
namespace llvm {
@@ -86,6 +87,8 @@ struct DescriptorTableClause {
8687
break;
8788
}
8889
}
90+
91+
void dump(raw_ostream &OS) const;
8992
};
9093

9194
// Models RootElement : DescriptorTable | DescriptorTableClause

llvm/lib/Frontend/HLSL/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
add_llvm_component_library(LLVMFrontendHLSL
22
CBuffer.cpp
33
HLSLResource.cpp
4+
HLSLRootSignature.cpp
45

56
ADDITIONAL_HEADER_DIRS
67
${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//===- HLSLRootSignature.cpp - HLSL Root Signature helper objects ---------===//
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 This file contains helpers for working with HLSL Root Signatures.
10+
///
11+
//===----------------------------------------------------------------------===//
12+
13+
#include "llvm/Frontend/HLSL/HLSLRootSignature.h"
14+
15+
namespace llvm {
16+
namespace hlsl {
17+
namespace rootsig {
18+
19+
void DescriptorTableClause::dump(raw_ostream &OS) const {
20+
OS << "Clause!";
21+
}
22+
23+
} // namespace rootsig
24+
} // namespace hlsl
25+
} // namespace llvm

llvm/unittests/Frontend/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(LLVM_LINK_COMPONENTS
22
Analysis
33
Core
4+
FrontendHLSL
45
FrontendOpenACC
56
FrontendOpenMP
67
Passes
@@ -10,6 +11,7 @@ set(LLVM_LINK_COMPONENTS
1011
)
1112

1213
add_llvm_unittest(LLVMFrontendTests
14+
HLSLRootSignatureDumpTest.cpp
1315
OpenACCTest.cpp
1416
OpenMPContextTest.cpp
1517
OpenMPIRBuilderTest.cpp
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===-------- HLSLRootSignatureDumpTest.cpp - RootSignature dump tests ----===//
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+
#include "llvm/Frontend/HLSL/HLSLRootSignature.h"
10+
#include "gtest/gtest.h"
11+
12+
using namespace llvm::hlsl::rootsig;
13+
14+
namespace {
15+
16+
TEST(HLSLRootSignatureTest, DescriptorTablesDump) {
17+
// Default clause
18+
DescriptorTableClause Clause;
19+
Clause.Type = ClauseType::CBuffer;
20+
Clause.Reg = { RegisterType::BReg, 0 };
21+
22+
std::string Out;
23+
llvm::raw_string_ostream OS(Out);
24+
Clause.dump(OS);
25+
OS.flush();
26+
27+
EXPECT_EQ(Out, "Clause!");
28+
}
29+
30+
} // namespace

0 commit comments

Comments
 (0)