Chris Forbes
1cd47d7af2
Reserve expected length of instructions vector
2017-06-28 11:13:26 -04:00
Chris Forbes
fcd991f081
Move some temp vectors into parser state
...
We don't need to churn the allocations for these every instruction.
2017-06-28 11:13:26 -04:00
GregF
ad1d0351a0
BlockMerge: Add BlockMergePass
...
Also, add BasicBlock::tail()
2017-06-27 11:31:33 -04:00
Rex Xu
5fbbadca4e
Add support for SPV AMD extensions
2017-06-21 15:08:07 -04:00
GregF
6136bf9e0b
mem2reg: Add InsertExtractElimPass
2017-06-21 08:13:15 -04:00
David Neto
760789f58d
Transform multiple entry points
...
Don't stop just after one because of short-circuiting logical-or.
2017-06-20 15:57:47 -04:00
GregF
0c5722fc01
mem2reg: Add LocalSingleStoreElimPass
...
Eliminate function scope variables with one store, if possible.
2017-06-19 10:43:02 -04:00
GregF
7c8da66bc2
mem2reg: Add pass to eliminate local loads and stores in single block.
2017-06-12 17:03:47 -04:00
GregF
aa7e687ef0
Mem2Reg: Add Local Access Chain Convert pass
...
- Supports OpAccessChain and OpInBoundsAccessChain
- Does not process modules with non-32-bit integer types.
2017-06-04 12:49:27 -04:00
Gabríel Arthúr Pétursson
d71d976875
Fix memory leak in ValidateBinaryUsingContextAndValidationState
2017-06-03 23:08:22 +00:00
rdb
ddf4de61c9
Support building on FreeBSD
2017-05-28 23:20:18 +02:00
Greg Fischer
3bea99d378
CFA: Move TraversalRoots and ComputeAugmentedCFG into CFA
2017-05-25 11:43:24 -06:00
Greg Fischer
d6f2979068
CFA: Pull in CalculateDominators
2017-05-25 12:31:38 -04:00
GregF
df6537cee0
DefUseManager: Fix ReplaceAllUsesWith() to update inst_to_used_ids_
2017-05-25 11:53:50 -04:00
Andrey Tuganov
20fe946666
Added extension SPV_VALIDATOR_ignore_type_decl_unique
...
If extension is present in the module, validator will ignore the "type
declaration must be unique" rule.
2017-05-25 11:36:48 -04:00
Lei Zhang
3492cc63b8
Remove unused this in lambda capture
2017-05-17 14:12:25 -04:00
David Neto
dbc2049aa3
Add SPIR-V 1.2 support, for OpenCL 2.2
2017-05-15 17:10:07 -04:00
Greg Fischer
bba812f4e4
Inline: Inline early return function if no returns in loop.
2017-05-12 17:18:00 -04:00
Andrey Tuganov
3eb716cae4
Added bit stream utils
...
Also added generalized zigzag coding.
- Due to signed integers being mostly non-negative, improved zigzag coding
to favor positive values.
2017-05-12 17:08:33 -04:00
Andrey Tuganov
f5facf842f
Stats analyzer aggregates OpConstant usage
2017-05-09 11:50:15 -04:00
Andrey Tuganov
b4cf371936
Stats analyzer uses validator
...
Stats analyzer calls validator to check the instruction and update
validator state.
Fixed unit tests (validator was failing).
2017-05-09 11:17:23 -04:00
David Neto
01b28750bf
Avoid snprintf warning in GCC 7.1
...
Tries to fix https://github.com/KhronosGroup/SPIRV-Tools/issues/642
See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80655
2017-05-08 15:58:24 -04:00
Greg Fischer
b25b330069
Inline: Create CFA class
...
Create class to encapsulate control flow analysis and share across
validator and optimizer. A WIP. Start with DepthFirstTraversal. Next
pull in CalculateDominators.
2017-05-08 15:02:59 -04:00
Andrey Tuganov
87a3f651e2
Added Markov chain analysis to stats
...
Added data structure to SpirvStats which is used to collect statistics
on opcodes following other opcodes.
Added a simple analysis print-out to spirv-stats.
2017-04-26 02:31:13 -04:00
GregF
a107d349e3
Inline: Do not inline functions with multiple returns (for now)
2017-04-25 16:50:57 -06:00
qining
144f59e451
Add bit pattern interface for setting default value for spec constants
2017-04-21 11:22:47 -04:00
Andrey Tuganov
1e309af80a
Added --compact-ids to /tools/opt
...
The pass remaps ids to a compact set which starts with %1 and
has no gaps.
2017-04-20 10:54:39 -04:00
Andrey Tuganov
b173d1c3cd
Added option --preserve-numeric-ids to tools/spirv-as
...
Added options to tools::Assemble
2017-04-13 14:13:33 -04:00
Andrey Tuganov
4f216402ba
Added statistical analysis tool (tool/stats)
...
Currently analyzes percentages of the following:
- version (how many 1.0 or 1.1)
- generator
- extension
- capability
- opcode prevalence
2017-04-10 17:15:04 -04:00
David Neto
bf68c81426
Support SPV_KHR_storage_buffer_storage_class
...
Includes interaction with SPV_KHR_variable_pointers
TODO: Update capabilitly dependency tests for new capabilities.
2017-04-07 09:54:38 -04:00
Ehsan Nasiri
23af06c3a3
Validator support for Variable Pointer extension.
...
If the variable_pointer extension is used:
* OpLoad's pointer argument may be the result of any of the following:
* OpSelect
* OpPhi
* OpFunctionCall
* OpPtrAccessChain
* OpCopyObject
* OpLoad
* OpConstantNull
* Return value of a function may be a pointer.
* It is valid to use a pointer as the return value of a function.
* OpStore should allow a variable pointer argument.
2017-04-07 09:49:48 -04:00
David Neto
11a867f412
Add FlattenDecoration transform
...
Add --flatten-decorations to spirv-opt
Flattens decoration groups. That is, replace OpDecorationGroup
and its uses in OpGroupDecorate and OpGroupMemberDecorate with
ordinary OpDecorate and OpMemberDecorate instructions.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/602
2017-04-06 11:19:56 -04:00
Lei Zhang
5c3c054c1f
Group targets into folders
...
This plays nicer with IDEs.
2017-04-06 09:44:33 -04:00
David Neto
afc60bbebf
Fix optimizer on when to write the binary
...
The spvtools::Optimizer::Run method should also write the output binary
if optimization succeeds without changes but the output binary vector
does not have exactly the same contents as the input binary.
We have to check both the base pointer of the storage and the size of
the vector
Added a test for this too.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/611
2017-04-03 15:48:50 -04:00
David Neto
4be6abe30d
Fix spelling in SPV_AMD_gcn_shader support
2017-04-03 14:59:18 -04:00
David Neto
58e7a3e607
Fix typo in method name Struct::AddMemberName
...
Also add a method comment for it.
2017-04-01 11:19:40 -04:00
David Neto
ceb1d4f2fd
Avoid inlining calls to external functions
...
External functions don't have bodies to inline anyway.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/605
2017-03-31 10:36:58 -04:00
David Neto
4fc930229d
opt::Function::cbegin and cend are const
2017-03-31 10:36:10 -04:00
Greg Fischer
04fcc66743
Add exhaustive function call inlining to spirv-opt
...
Inlining is done for all functions designated as entry points.
Add optional validation to test fixture method SinglePassRunAndCheck.
2017-03-29 18:02:40 -04:00
David Srbecky
b85997a1df
Add various accessors needed to read and edit SPIRV code.
2017-03-29 14:38:57 +01:00
David Neto
7fe8a57a5b
Support SPV_AMD_gcn_shader
...
Supported in assembler, disassembler, and binary parser.
The validator does not check SPV_AMD_gcn_shader validation rules
beyond parsing the extension.
Adds generic support for generating instruction tables for vendor
extensions.
Adds generic support for extensions the validator should recognize
(but not check) but which aren't derived from the SPIR-V core
grammar file.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/594
2017-03-23 16:32:35 -04:00
David Neto
fa834dea40
Fix validator message for bad logical pointer
...
Affects OpLoad and OpStore validation.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/588
2017-03-23 15:50:45 -04:00
David Neto
c3caa546a0
spirv-val prints warnings
...
Warnings and info messages go to stdout.
Errors still go to stderr.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/568
2017-03-17 12:48:51 -04:00
David Neto
0066a363d6
Add SpirvTools::Validate that takes an options object
...
Add spvtools::ValidatorOptions RAII wrapper around
a spv_validator_options value.
2017-03-17 12:48:51 -04:00
Andrey Tuganov
971ede33b2
Validator dissallows unsupported Vulkan capability
...
If environment is SPV_ENV_VULKAN_1_0, disallow OpCapability operands
which are not supported by Vulkan 1.0.
See https://github.com/KhronosGroup/SPIRV-Tools/issues/572
2017-03-17 10:28:35 -04:00
Andrey Tuganov
c804c125c5
Autogenererating enum-string mappings from grammar
...
Autogenerating the following code:
- extension enum
- extension-to-string
- string-to-extension
- capability-to-string
Capability mapping table will not compile if incomplete.
TODO: Use "spirv-latest-version.h" instead of 1.1.
Added function to generate capability tables for tests.
2017-03-16 15:29:17 -04:00
Andrey Tuganov
b011633171
Validator checks if operands require extension
...
If required extension is not found, returning new error
SPV_ERROR_MISSING_EXTENSION.
2017-03-14 13:39:43 -04:00
Andrey Tuganov
1fb8c37b57
Refactored enum_set
...
- removed forgotten file enum_set.cpp
- added IsEmpty and HasAnyOf
- hidden unsafe functions Add(uint32_t), Contains(uint32_t)
- added new tests
2017-03-10 13:38:32 -05:00
Andrey Tuganov
1c43cb8550
Validator parses and registers OpExtension
...
Known extensions are saved in validation state. Unknown extension
produce a dignostic message, but do not fail the validation.
Moved extension definitions to their own file.
2017-03-09 15:28:33 -05:00
Aliya Pazylbekova
edb52647bd
Validate that SpecId decoration target is a OpSpecConstant instruction
...
on a scalar
Fixes: https://github.com/KhronosGroup/SPIRV-Tools/issues/275
2017-03-07 09:51:16 -05:00