summaryrefslogtreecommitdiff
path: root/source/operand.h
AgeCommit message (Collapse)AuthorFilesLines
2017-09-06Update MARK-V to version 1.01Andrey Tuganov1-0/+8
Includes: - Multi-sequence move-to-front - Coding by id descriptor - Statistical coding of non-id words - Joint coding of opcode and num_operands Removed explicit form Huffman codec constructor - The standard use case for it is to be constructed from initializer list. Using serialization for Huffman codecs
2017-07-04Convert pattern stack from deque to vector, and share itChris Forbes1-13/+18
Also move various vector::reserve calls to State ctor Negligible perf benefit, but more tidy.
2016-09-02Relicense SPIRV-Tools under Apache 2.0David Neto1-21/+9
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/383 Finalize v2016.4
2016-02-17Rearrange headersDavid Neto1-1/+1
Now we have public headers arranged as follows: $SPIRV_TOOLS_ROOT/include/spirv-tools/libspirv.h $SPIRV_TOOLS_ROOT/include/spirv/spirv.h $SPIRV_TOOLS_ROOT/include/spirv/GLSL.std.450.h $SPIRV_TOOLS_ROOT/include/spirv/OpenCL.std.h A project should use -I$SPIRV_TOOLS_ROOT/include and then #include "spirv-tools/libspirv.h" The headers from the SPIR-V Registry can be accessed as "spirv/spirv." for example. The install target should also install the headers from the SPIR-V Registry. The libspirv.h header is broken otherwise. The SPIRV-Tools library depends on the headers from the SPIR-V Registry. The util/bitutils.h and util/hex_float.h are pulled into the internal source tree. Those are not part of the public API to SPIRV-Tools.
2016-02-02Add spvOperandIsConcreteMaskDavid Neto1-0/+3
2016-01-20Track uses and defs during parsing.Dejan Mircevski1-0/+3
Replace two other, imperfect mechanisms for use-def tracking. Use ValidationState_t::entry_points to track entry points. Concentrate undefined-ID diagnostics in a single place. Move validate_types.h content into validate.h due to increased inter-dependency. Track uses of all IDs: TYPE_ID, SCOPE_ID, ... Also update some blurbs. Fix entry-point accumulation and move it outside ProcessIds(). Remove validate_types.h from CMakeLists.txt. Blurb for spvIsIdType. Remove redundant diagnostics for undefined IDs. Join "can not" and reformat.
2016-01-07Extend copyright to 2016.Dejan Mircevski1-1/+1
2015-11-16Use Google comment style and fix typos.Lei Zhang1-96/+63
2015-11-12Use quotation for libspirv.h and sort headers.Lei Zhang1-1/+1
2015-11-12Move info table related structs into table.h.Lei Zhang1-0/+1
2015-11-10spv_operand_type_t cleanup.David Neto1-1/+1
- Concrete operand types are never optional. Split them to make this so, e.g. add SPV_OPERAND_TYPE_IMAGE since there was SPV_OPERAND_TYPE_OPTIONAL_IMAGE. Similarly for SPV_OPERAND_TYPE_MEMORY_ACCESS. This entails duplicating two operand table entries. - The above, plus some rearranging of enums, allows us to define first and last optional operand types, and first and last variable operand types. This lets us simplify the code for spvOperandIsOptional, and spvOperandIsVariable. - Replace SPV_OPERAND_TYPE_MULTIWORD_LITERAL_NUMBER with the more accurately named SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER. Its special characteristic is that the type of the literal number is determined by some previous operand in the instruction. This is used for literals in OpSwitch, OpConstant, and OpSpecConstant. This lets us refactor operand parsing cases in the assembler. - Remove the special required-thing-in-optional-tuple in favour of the corresponding concrete operand type: SPV_OPERAND_TYPE_ID_IN_OPTIONAL_TUPLE --> SPV_OPERAND_TYPE_ID SPV_OPERAND_TYPE_INTEGER_LITERAL_IN_OPTIONAL_TUPLE --> SPV_OPERAND_TYPE_INTEGER_LITERAL - Constrain spvOpeandTypeStr to only have to work for non-variable operand types. Add a test for this.
2015-11-02Inclusion guards follow Google C++ styleDavid Neto1-3/+3
Follow the scheme in http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#The__define_Guard except: - 'include/' is dropped from the guard token - 'source/' is dropped from the guard token
2015-10-26Simplify (and test) the alternate-parsing pattern.Dejan Mircevski1-4/+4
2015-10-26Refactored dynamic and static state out of text processing.Andrew Woloszyn1-1/+1
This reduces the number of arguments required to be passed to every single function. This is in preparation for adding id tracking.
2015-10-26Run clang-format.Dejan Mircevski1-8/+8
2015-10-26Implement alternate-parsing mode for !<integer>.Dejan Mircevski1-0/+5
2015-10-26Assembler: mask expressions where 1 bits imply operandsDavid Neto1-0/+18
Properly support a memory access mask with a combination of bits, including the Aligned bit. When the Aligned bit is set, the parser should expect an alignment value literal operand.
2015-10-26Generalize spvOperandTableNameLookup to take string length.David Neto1-0/+2
This is preparation for parsing mask expressions.
2015-10-26Use opcode operand definitions from SPIR-V specification generator.David Neto1-0/+70
The assembler and disassembler now use a dynamically adjusted sequence of expected operand types. (Internally, it is a deque, for readability.) Both parsers repeatedly pull an expected operand type from the left of this pattern list, and try to match the next input token against it. The expected pattern is adjusted during the parse to accommodate: - an extended instruction's expected operands, depending on the extended instruction's index. - when an operand itself has operands - to handle sequences of zero or more operands, or pairs of operands. These are expanded lazily during the parse. Adds spv::OperandClass from the SPIR-V specification generator. Modifies spv_operand_desc_t: - adds hasResult, hasType, and operandClass array to the opcode description type. - "wordCount" is replaced with "numTypes", which counts the number of entries in operandTypes. And each of those describes a *logical* operand, including the type id for the instruction, and the result id for the instruction. A logical operand could be variable-width, such as a literal string. Adds opcode.inc, an automatically-generated table of operation descriptions, with one line to describe each core instruction. Externally, we have modified the SPIR-V spec doc generator to emit this file. (We have hacked this copy to use the old semantics for OpLine.) Inside the assembler, parsing an operand may fail with new error code SPV_FAIL_MATCH. For an optional operand, this is not fatal, but should trigger backtracking at a higher level. The spvTextIsStartOfNewInst checks the case of the third letter of what might be an opcode. So now, "OpenCL" does not look like an opcode name. In assembly, the EntryPoint name field is mandatory, but can be an empty string. Adjust tests for changes to: - OpSampedImage - OpTypeSampler
2015-05-22Code drop of the Codeplay spirv-tools source.Kenneth Benzie (Benie)1-0/+65
This commit contains the source for the SPIRV static library, spirv-as, spirv-dis, and spirv-val tools.