summaryrefslogtreecommitdiff
path: root/source
AgeCommit message (Collapse)AuthorFilesLines
2018-08-07Unify validation of OpCopyMemory*HEADmasterAlan Baker1-82/+71
Fixes #1800 * Refactored duplication of code between OpCopyMemory and OpCopyMemorySized validation * Fixed some bugs in OpCopyMemorySized validation * Replaced asserts with checks * Added new tests
2018-08-07Refactor where opcodes are validatedAlan Baker8-63/+81
* Replaced uses in opcode validation of current_function() * Added non-const accessor to function lookup in ValidationState_t * Updated a couple bad tests due to check reordering
2018-08-07Remove unused bit stream methods. (#1807)dan sinclair2-267/+5
This CL deletes methods from bit stream which are never used and moves several to the anonymous namespace in the bit_stream test file.
2018-08-07Simplify MoveToFront (#1806)dan sinclair4-473/+486
This CL removes the templating from the MoveToFront code as all non-test code uses uint32_t as the variable.
2018-08-07Fix readbility/braces warnings (#1804)dan sinclair10-23/+27
2018-08-03Cleanup includes. (#1795)dan sinclair247-846/+1090
This Cl cleans up the include paths to be relative to the top level directory. Various include-what-you-use fixes have been added.
2018-08-03Rewrite include guards (#1793)dan sinclair131-389/+389
This CL rewrites the include guards to make PRESUBMIT.py include guard check happy.
2018-08-02Validation within function body when doing a FunctionCall. (#1790)dan sinclair1-1/+7
When validating a FunctionCall we can trigger an assert if we are not currently within a function body. This CL adds verification that we are within a function before attempting to add a function call. Issue 1789.
2018-08-02Simplify validation ProcessInstruction (#1786)dan sinclair4-123/+128
This CL moves most of the logic out of validation ProcessInstruction and groups it into validate. This places all of the validation logic in the same place making it clearer what is running. The Instruction class is changed to allow setting the function and block after creation.
2018-08-02Remove ValidateInstructionAndUpdateValidationState (#1784)dan sinclair4-159/+103
This CL changes the stats aggregator to use ValidateBinaryAndKeepValidationState to process the binary. This means we can remove ValidateInstructionAndUpdateValidationState which expects to be able to call ProcessInstruction in the validate anonymous namespace. This decouples the stats aggregator from how validation processes the binary.
2018-08-02Update OpPhi instructions after splitting block. (#1783)Steven Perron2-4/+25
In the merge return pass, we will split a block, but not update the phi instructions that reference the block. Since the branch in the original block is now part of the block with the new id, the phi nodes must be updated. This commit will change this. I have also considered other places where an id of a basic block could be referenced, and I don't think any of them need to change. 1) Branch and merge instructions: These jump to the start of the original block, and so we want them to jump to the block that uses the original id. Nothing needs to change. 2) Names and decorations: I don't think it matters with block keeps the name, and there are no decorations that apply to basic blocks. Fixes #1736.
2018-08-02Combine ordered_instruction loops in validation. (#1782)dan sinclair5-96/+100
There are several validation passes which loop over all ordered instructions. This CL combines those into a single loop, calling each pass as needed.
2018-08-01 Remove instruction_counter from ValidationState. (#1781)dan sinclair6-27/+10
The instruction counter is the same as the size of the ordered_instruction list when we insert a new instruction. This Cl removes instruction_counter_ and uses that instead.
2018-08-01Move memory class instructions to new passAlan Baker5-562/+608
* Refactored the Memory class of instructions in the spec out Id validation and into a new pass * Tests unmodified * some minor disassembly changes * minor style changes
2018-08-01Remove using std::<foo> statements. (#1756)dan sinclair12-147/+108
Many of the files have using std::<foo> statements in them, but then the use of <foo> will be inconsistently std::<foo> or <foo> scattered through the file. This CL removes all of the using statements and updates the code to have the required std:: prefix.
2018-08-01Remove diag() overloads. (#1776)dan sinclair3-17/+4
This CL removes the two diag() overloads and leaves only the version which accepts an Instruction. This is safer as we never use the implicit location from the validation state.
2018-08-01Update diag() calls in validate_capability. (#1759)dan sinclair1-5/+5
This CL updates the diag() call in validate_capability to provide the instruction.
2018-08-01Don't change decorations and names in merge return. (#1777)Steven Perron1-1/+5
When creating a new phi for a value in the function, merge return will rewrite all uses of an id that are no longer dominated by its definition. Uses that are not in a basic block, like OpName or decorations, are not dominated, but they should not be replaced. Fixes #1736.
2018-08-01Update diag() calls in validate_type_unique. (#1775)dan sinclair1-1/+1
This CL updates the diag() calls in validate_type_unique to pass the relevant instruction.
2018-08-01Update diag() calls in validate_primitives. (#1774)dan sinclair1-2/+2
This CL updates the diag() calls in validate_primitives to provide the relevant instruction.
2018-08-01Update diag() calls in validate_non_uniform. (#1773)dan sinclair1-5/+5
This CL upldates diag() calls in validate_non_uniform to provide the relevant instruction.
2018-08-01Update diag() calls in validate_logicals. (#1772)dan sinclair1-24/+24
This CL updates the diag() calls in validate_logicals to provide the Instruction.
2018-08-01Update diag() calls in validate_literals. (#1771)dan sinclair1-1/+1
This CL updates the diag() call in validate_literals to provide the relevant instruction.
2018-08-01Update diag() calls in validate_layout. (#1770)dan sinclair1-16/+16
This CL updates the diag() calls in validate_layout to pass the relevant instruction.
2018-08-01Update diag() call in validate_interface. (#1769)dan sinclair1-1/+1
This CL upldates validate_interface to pass the instruction to the diag() method.
2018-08-01Update diag() calls in validate_instruction. (#1768)dan sinclair1-41/+39
This CL updates validate_instruction to pass the Instruction to diag().
2018-08-01Update diag() calls in validate_image. (#1767)dan sinclair1-155/+167
This CL updates the diag() calls in validate_image to provide the relvant instruction.
2018-08-01Update diag() calls in validate_ext_inst. (#1766)dan sinclair1-197/+197
This CL updates the diag() usage in validate_ext_inst to provide the relevant instruction.
2018-08-01Update diag() calls in validate_derivatives. (#1765)dan sinclair1-2/+2
This CL updates diag() in validate_derivatives to provide the instruction of interest.
2018-08-01Update diag() calls in validate_decorations. (#1764)dan sinclair1-15/+19
Several of the diag() calls in validate_decorations do not provide the line number, and will output the last line in the file. This CL updates the diag() calls to provide the instruction of interest.
2018-08-01Remove std::deque in favour of std::vector. (#1755)dan sinclair6-29/+64
This CL removes the two deque's from ValidationState and converts them into std::vectors. In order to maintain the stability of instructions we walk over the binary and counter the instructions and functions in the ValidationState constructor and reserve the required number of items in the module_functions_ and ordered_instructions_ vectors. Issue #1176.
2018-08-01Update diag() calls in validate_datarules. (#1763)dan sinclair1-22/+22
This CL updates validate_datarules to provide the instruction to diag().
2018-08-01Update diag() calls in validate_conversion. (#1762)dan sinclair1-52/+52
This CL updates validate_conversion to provide the instruction to diag() calls.
2018-08-01Update diag() calls in validate_composites. (#1761)dan sinclair1-34/+36
This CL updates the diag() calls in validate_composites to provide the instruction directly.
2018-08-01Update diag() calls in validate_cfg. (#1760)dan sinclair1-3/+3
This CL updates the diag() calls in validate_cfg to provide the associated instruction. This fixes a couple places where we output the last line of the file instead of the instruction as the disassembly.
2018-08-01Update diag() use in validate_builtin. (#1758)dan sinclair1-109/+123
This CL updates the calls to diag() in vlidate_builtings to provide the instruction.
2018-08-01Update diag() usage in validate_bitwise. (#1757)dan sinclair1-24/+24
This Cl upldates the diag() calls to pass the instruction in validate_bitwise.
2018-07-31Update diag() in validate_barriers (#1754)dan sinclair1-13/+13
This CL updates validate_barriers to provide an explicit instruction when calling diag().
2018-07-31Update diag() in validate_atomics (#1753)dan sinclair1-22/+22
This CL updates validate_atomics to explicitly provide the instruction when caling diag().
2018-07-31Pass the instruction to diag in arithmetic validation (#1752)dan sinclair1-50/+50
This CL updates the diag() calls in validate_arithmetics to explicitly provide the instruction the diagnostic is attached too.
2018-07-31Fix disassembly line for adjacency validations. (#1751)dan sinclair1-3/+3
Previously the adjacency messages would output the last line of the file as the disassembly. This is incorrect, as we have an instruction they can be attached too. This CL fixes the messages to attach to the correct line number.
2018-07-31Switch validate to use explicit diag() method. (#1750)dan sinclair1-5/+6
This CL changes validate.cpp to use diag providing an explicit instruction. This changes the result of the function end checks to not output a disassembly anymore as printing the last line of the module didn't seem to make sense.
2018-07-31Change ValidationState::diag to accept an Instruction. (#1749)dan sinclair4-40/+32
This CL changes the signature of diag() to accept an Instruction instead of the instructions position. A deprecated variant that accepts the position is available but will be removed in the near future.
2018-07-31Transform to combine consecutive access chainsAlan Baker6-0/+411
* Combines OpAccessChain, OpInBoundsAccessChain, OpPtrAccessChain and OpInBoundsPtrAccessChain * New folding rule to fold add with 0 for integers * Converts to a bitcast if the result type does not match the operand type V
2018-07-31Wrap entire timer.cpp in SPIRV_TIMER_ENABLED.Dan Sinclair1-4/+4
This CL moves the SPIRV_TIMER_ENABLED preprocesser guard to encompass the includes along with the source. Currently we will try to pull in sys/resource.h on machines which may not have the file available and the build will fail. If we don't need timers, then we don't need the includes as well.
2018-07-31Make sure all instructions are in the ordered list.Dan Sinclair6-76/+72
Currently, some instructions will be missing from the list of ordered_instructions. This will cause issues due to the debug change which passed the last instruction into subsequent passes. This CL moves the addition to the ordered list out of the RegisterInstruction method into AddOrderedInstruction. This method is called first in ProcessInstruction and the CapabilitiesPass and IdPass are updated to take an Instruction parameter.
2018-07-31Update error messages in validate_composites. (#1743)dan sinclair1-76/+39
This CL removes the redundant operator name from the error messages in validate_composites. The operator will be printed on the next line with the disassembly.
2018-07-30Split ImagePass into individual methods. (#1742)dan sinclair1-942/+856
This CL splits the switch in ImagePass into individual validate functions. The error messages have been updated to drop the suffix/prefix of the opcode name since it will be displayed in the disassembly.
2018-07-30Move OpVectorShuffle check into validate_composites (#1741)dan sinclair2-163/+65
This CL moves the OpVectorShuffle ID check out of validate_id and into validate_composites with the rest of the composite checks.
2018-07-30Move CompositePass code into methods. (#1740)dan sinclair1-279/+290
This Cl splits the CompositePass switch to have one method per case label. This makes the code a lot simpler to follow.