[spirv] Use proper file names and delete unused tests
This commit is contained in:
Родитель
13f3baf9e0
Коммит
adf2332a37
|
@ -1,4 +1,4 @@
|
||||||
//===--- SPIRVContext.cpp - SPIR-V SPIRVContext implementation-------------===//
|
//===--- SpirvContext.cpp - SPIR-V SpirvContext implementation-------------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
|
|
|
@ -7,14 +7,14 @@ set(LLVM_LINK_COMPONENTS
|
||||||
)
|
)
|
||||||
|
|
||||||
add_clang_unittest(clang-spirv-tests
|
add_clang_unittest(clang-spirv-tests
|
||||||
CodeGenSPIRVTest.cpp
|
CodeGenSpirvTest.cpp
|
||||||
FileTestFixture.cpp
|
FileTestFixture.cpp
|
||||||
FileTestUtils.cpp
|
FileTestUtils.cpp
|
||||||
SPIRVContextTest.cpp
|
SpirvContextTest.cpp
|
||||||
SPIRVTestOptions.cpp
|
SpirvTestOptions.cpp
|
||||||
TestMain.cpp
|
|
||||||
SpirvConstantTest.cpp
|
SpirvConstantTest.cpp
|
||||||
StringTest.cpp
|
StringTest.cpp
|
||||||
|
TestMain.cpp
|
||||||
WholeFileTestFixture.cpp
|
WholeFileTestFixture.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include "dxc/Support/HLSLOptions.h"
|
#include "dxc/Support/HLSLOptions.h"
|
||||||
|
|
||||||
#include "SPIRVTestOptions.h"
|
#include "SpirvTestOptions.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
namespace clang {
|
namespace clang {
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
//===- unittests/SPIRV/SPIRVTestUtils.h - Common utilities for tests ------===//
|
|
||||||
//
|
|
||||||
// The LLVM Compiler Infrastructure
|
|
||||||
//
|
|
||||||
// This file is distributed under the University of Illinois Open Source
|
|
||||||
// License. See LICENSE.TXT for details.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This file defines utility functions for writing SPIR-V tests. They are
|
|
||||||
// not supposed to be included in source files other than tests.
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#include <initializer_list>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
#include "spirv/unified1/spirv.hpp11"
|
|
||||||
#include "clang/SPIRV/InstBuilder.h"
|
|
||||||
#include "llvm/ADT/ArrayRef.h"
|
|
||||||
|
|
||||||
namespace clang {
|
|
||||||
namespace spirv {
|
|
||||||
|
|
||||||
/// Creates an InstBuilder which pushes all constructed SPIR-V instructions
|
|
||||||
/// into the given binary.
|
|
||||||
inline InstBuilder constructInstBuilder(std::vector<uint32_t> &binary) {
|
|
||||||
return InstBuilder([&binary](std::vector<uint32_t> &&words) {
|
|
||||||
binary.insert(binary.end(), words.begin(), words.end());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the words in SPIR-V module header with the given id bound.
|
|
||||||
inline std::vector<uint32_t> getModuleHeader(uint32_t bound) {
|
|
||||||
return {spv::MagicNumber, 0x00010000, 14u << 16, bound, 0};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a SPIR-V instruction.
|
|
||||||
inline std::vector<uint32_t> constructInst(spv::Op opcode,
|
|
||||||
llvm::ArrayRef<uint32_t> params) {
|
|
||||||
std::vector<uint32_t> words;
|
|
||||||
|
|
||||||
words.push_back(static_cast<uint32_t>(opcode));
|
|
||||||
for (auto w : params) {
|
|
||||||
words.push_back(w);
|
|
||||||
}
|
|
||||||
words.front() |= static_cast<uint32_t>(words.size()) << 16;
|
|
||||||
|
|
||||||
return words;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A simple instruction builder for testing purpose.
|
|
||||||
class SimpleInstBuilder {
|
|
||||||
public:
|
|
||||||
/// Constructs a simple instruction builder with no module header.
|
|
||||||
SimpleInstBuilder() {}
|
|
||||||
|
|
||||||
/// Constructs a simple instruction builder with module header having the
|
|
||||||
/// given id bound.
|
|
||||||
explicit SimpleInstBuilder(uint32_t bound) : words(getModuleHeader(bound)) {}
|
|
||||||
|
|
||||||
/// Adds an instruction.
|
|
||||||
void inst(spv::Op opcode, llvm::ArrayRef<uint32_t> params) {
|
|
||||||
auto inst = constructInst(opcode, params);
|
|
||||||
words.insert(words.end(), inst.begin(), inst.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<uint32_t> &get() const { return words; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::vector<uint32_t> words;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Expects the given status is success.
|
|
||||||
inline void expectBuildSuccess(InstBuilder::Status status) {
|
|
||||||
EXPECT_EQ(InstBuilder::Status::Success, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace spirv
|
|
||||||
} // end namespace clang
|
|
|
@ -1,4 +1,4 @@
|
||||||
//===- unittests/SPIRV/SPIRVContextTest.cpp ----- SPIRVContext tests ------===//
|
//===- unittests/SPIRV/SpirvContextTest.cpp ----- SpirvContext tests ------===//
|
||||||
//
|
//
|
||||||
// The LLVM Compiler Infrastructure
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
|
@ -12,7 +12,7 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "SPIRVTestOptions.h"
|
#include "SpirvTestOptions.h"
|
||||||
|
|
||||||
namespace clang {
|
namespace clang {
|
||||||
namespace spirv {
|
namespace spirv {
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "llvm/Support/Signals.h"
|
#include "llvm/Support/Signals.h"
|
||||||
|
|
||||||
#include "SPIRVTestOptions.h"
|
#include "SpirvTestOptions.h"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче