Remove spvOpcodeIsVariable

Nothing was using it.
This commit is contained in:
David Neto 2015-09-08 14:59:57 -04:00
parent a12c2240bc
commit c9b5152b4f
6 changed files with 3 additions and 72 deletions

View File

@ -172,7 +172,6 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES})
${CMAKE_CURRENT_SOURCE_DIR}/test/LibspirvMacros.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/NamedId.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/OperandPattern.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeIsVariable.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeMake.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeRequiresCapabilities.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeSplit.cpp

View File

@ -135,8 +135,7 @@ typedef enum spv_endianness_t {
typedef enum spv_opcode_flags_t {
SPV_OPCODE_FLAGS_NONE = 0,
SPV_OPCODE_FLAGS_VARIABLE = 1,
SPV_OPCODE_FLAGS_CAPABILITIES = 2,
SPV_OPCODE_FLAGS_CAPABILITIES = 1,
SPV_FORCE_32_BIT_ENUM(spv_opcode_flags_t)
} spv_opcode_flags_t;

View File

@ -50,7 +50,7 @@ spv_opcode_desc_t opcodeTableEntries[] = {
#define Instruction(Name,HasResult,HasType,NumLogicalOperands,NumCapabilities,CapabilityRequired,IsVariable,LogicalArgsList) \
{ #Name, \
Op##Name, \
((IsVariable ? SPV_OPCODE_FLAGS_VARIABLE : 0) | (CapabilityRequired != CapabilityNone ? SPV_OPCODE_FLAGS_CAPABILITIES : 0)), \
((CapabilityRequired != CapabilityNone ? SPV_OPCODE_FLAGS_CAPABILITIES : 0)), \
uint32_t(CapabilityRequired), \
0, {}, /* Filled in later. Operand list, including result id and type id, if needed */ \
HasResult, \
@ -274,11 +274,6 @@ spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table,
return SPV_ERROR_INVALID_LOOKUP;
}
int32_t spvOpcodeIsVariable(spv_opcode_desc entry) {
return SPV_OPCODE_FLAGS_VARIABLE ==
(SPV_OPCODE_FLAGS_VARIABLE & entry->flags);
}
int16_t spvOpcodeResultIdIndex(spv_opcode_desc entry) {
for (int16_t i = 0; i < entry->numTypes; ++i) {
if (SPV_OPERAND_TYPE_RESULT_ID == entry->operandTypes[i]) return i;

View File

@ -73,15 +73,6 @@ spv_result_t spvOpcodeTableNameLookup(const spv_opcode_table table,
spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table,
const Op opcode, spv_opcode_desc *pEntry);
/// @brief Determine if the Opcode has variable word count
///
/// This function does not check if @a entry is valid.
///
/// @param[in] entry the Opcode entry
///
/// @return zero if false, non-zero otherwise
int32_t spvOpcodeIsVariable(spv_opcode_desc entry);
/// @brief Get the argument index for the <result-id> operand, if any.
///
/// @param[in] entry the Opcode entry

View File

@ -1,48 +0,0 @@
// Copyright (c) 2015 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and/or associated documentation files (the
// "Materials"), to deal in the Materials without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Materials, and to
// permit persons to whom the Materials are furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Materials.
//
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
// https://www.khronos.org/registry/
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
#include "UnitSPIRV.h"
// TODO(dneto): This function is dead anyway. We should remove its implementation
// and tests.
namespace {
TEST(OpcodeIsVariable, IsVariable) {
spv_opcode_desc_t entry = {
nullptr, Op(0), SPV_OPCODE_FLAGS_VARIABLE, 0, 0, {}, false, false, {}};
EXPECT_TRUE(spvOpcodeIsVariable(&entry));
}
TEST(OpcodeIsVariable, NotVariable) {
spv_opcode_desc_t entryNone = {
nullptr, Op(0), SPV_OPCODE_FLAGS_NONE, 0, 0, {}, true, false, {}};
EXPECT_FALSE(spvOpcodeIsVariable(&entryNone));
spv_opcode_desc_t entryCap = {
nullptr, Op(0), SPV_OPCODE_FLAGS_CAPABILITIES, 0, 0, {}, true, false, {}};
EXPECT_FALSE(spvOpcodeIsVariable(&entryCap));
}
} // anonymous namespace

View File

@ -55,14 +55,9 @@ INSTANTIATE_TEST_CASE_P(Op, Requires,
CapabilityAddresses,
CapabilityLinkage, CapabilityKernel));
TEST(OpcodeRequiresCapabilityaspvities, None) {
TEST(OpcodeRequiresCapability, None) {
spv_opcode_desc_t entry = {nullptr, (Op)0, SPV_OPCODE_FLAGS_NONE, 0, 0, {}, false, false, {}};
ASSERT_EQ(0, spvOpcodeRequiresCapabilities(&entry));
}
TEST(OpcodeRequiresCapabilityaspvities, Variable) {
spv_opcode_desc_t entry = {nullptr, (Op)0, SPV_OPCODE_FLAGS_VARIABLE, 0, 0, {}, false, false, {}};
ASSERT_EQ(0, spvOpcodeRequiresCapabilities(&entry));
}
} // anonymous namespace