Lei Zhang
9747d33d08
Derive iterator from std::iterator to reap standarad algorithms.
...
By deriving from std::iterator, iterator_traits will be properly
set up for our custom iterator type, thus we can use algorithms
from STL with our custom iterators.
2016-08-15 16:29:56 -04:00
Lei Zhang
1eec0ed4b9
Make analyses RAII-like and turn disable copy/move constructors.
2016-08-15 13:41:47 -04:00
David Neto
4dd4c14b80
Avoid integer modulo by 1, to avoid warning
...
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/349
2016-08-15 11:27:13 -04:00
David Neto
033b7d00f0
Avoid race on mkdir
...
Should fix https://github.com/KhronosGroup/SPIRV-Tools/issues/340
2016-08-15 11:14:34 -04:00
Lei Zhang
097ff25ea7
Allow OpUndef appearing in the type and global variable section.
...
Also clean up API functions for adding instructions into the
type and global values section.
2016-08-15 10:44:14 -04:00
qining
c814911904
Add another construtor for opt::ir::Instruction
2016-08-13 11:17:11 -04:00
David Neto
4987ae6549
Test INotEqual for OpSpecConstantOp in asm, disasm
2016-08-12 16:00:46 -04:00
qining
d065593404
Add iterator getter interface for types_values_
2016-08-12 15:10:51 -04:00
Umar Arshad
b01755a5e2
OpUndef can appear in type declaration section
2016-08-12 14:28:17 -04:00
Lei Zhang
94912ad1ba
Turn off modifying methods for const iterators.
2016-08-12 14:05:41 -04:00
qining
81532584cb
Clear old def-use record when re-analyze an ID
2016-08-12 13:04:07 -04:00
Lei Zhang
95dc16d1ec
Add make_range() & make_const_range() for creating iterator ranges.
2016-08-12 10:34:47 -04:00
Lei Zhang
4b3247feba
Avoid non-oneliner definition in class and add missing iterators.
2016-08-12 10:34:47 -04:00
qining
7a94e66433
Move the def-use analysis for single inst to public
2016-08-12 10:25:37 -04:00
qining
e5bb46d274
Add getter for pointee, element type
2016-08-11 20:53:57 -04:00
Lei Zhang
645ee1d9e0
Create an iterator class for in-memory representation.
2016-08-11 18:35:12 -04:00
qining
f949e321f2
Make the lookup up of type id accepts const arg
2016-08-11 18:21:57 -04:00
David Neto
82405cf499
Reuse the iterator on Id and type lookup
2016-08-11 18:18:12 -04:00
qining
f4e3a905d4
Add the const version of AsXXtype() interface.
2016-08-11 17:13:43 -04:00
qining
cd6d6c0ccf
Add GetId(Type* type) API to the type manager
2016-08-11 15:10:09 -04:00
David Neto
892239b7cc
Avoid double-copy of NameMapper object.
2016-08-11 12:11:36 -04:00
David Neto
8a5ce18f12
Use friendly names for Ids
2016-08-11 11:30:18 -04:00
David Neto
996a814ae3
Add spirv-cfg to dump a GraphViz graph of the CFG
...
This is experimental, and has not tests.
It's been used to debug validation of structured control flow.
- Has a legend describing special arcs to merge blocks and continue
targets.
- Labels the function entry block, with the Id of the function.
2016-08-11 11:24:51 -04:00
qining
23266c9b56
Add back the missing msg about --eliminate-dead-const
2016-08-10 19:44:18 -04:00
Lei Zhang
75d4316280
Fix build error about passing initializer-list to constructor.
...
VS2013 is not happy with using initializer-list to initialize
vector parameters to explicit constructors taking one vector.
2016-08-10 16:10:14 -04:00
Lei Zhang
dda9de965d
Make type manager RAII-like w.r.t. the module to be analyzed.
2016-08-10 12:53:17 -04:00
Lei Zhang
c562e231e3
Optimization: Add type manager.
...
Type manager will construct a map of types gradually from
instructions.
2016-08-10 12:53:17 -04:00
Lei Zhang
6d4d15b9d0
Optimization: Add type class hierarchy.
2016-08-10 12:53:17 -04:00
Lei Zhang
478d96aac4
Appveyor: also test on Visual Studio 2013.
2016-08-10 12:52:11 -04:00
David Neto
75c6db0746
Fix paths in the README.
2016-08-10 12:18:22 -04:00
Lei Zhang
80c94a4fa8
Change the interfaces of in-memory representation to use pointers.
...
Previously we use vectors of objects and move semantics to handle
ownership. That approach has the flaw that inserting an object into
the middle of a vector, which may trigger a vector reallocation,
can invalidate some addresses taken from instructions.
Now the in-memory representation internally uses vector of unique
pointers to handle ownership. Since objects are explicitly heap-
allocated now, pointers to them won't be invalidated by vector
resizing anymore.
2016-08-10 12:11:33 -04:00
David Neto
7784829b3a
Update CHANGES to say issue 288 is fixed
2016-08-10 10:40:59 -04:00
Andrew Woloszyn
38c9471a0e
Fixed the build for MSVC.
...
assembly_builder was missing an include for cstdint.
2016-08-10 09:45:15 -04:00
Lei Zhang
485f513a29
Manually create move the constructor/assignment for Instruction.
...
This is because some old visual studio versions (e.g., 2013) do
not support automatically generating move constructors/assignments.
2016-08-09 19:27:13 -04:00
David Neto
677ae7fbe8
Fix compilation. My bad
...
The API changed, and I forgot to submit this patch.
2016-08-09 18:23:40 -04:00
Umar Arshad
489204cf03
Check dominance of OpPhi parent and variable pairs
2016-08-09 18:19:47 -04:00
Umar Arshad
8ea1268f84
Removed dead code/const_casts/lists
2016-08-09 18:09:38 -04:00
qining
60461428f4
Separate pass.h from passes.h
...
Future pass implementations should only need to include pass.h
2016-08-09 17:16:52 -04:00
Lei Zhang
190b0d3162
Use NEW behavior for policy CMP0054.
...
The NEW behavior is to not dereference variables or interpret keywords
that have been quoted or bracketed.
For more information, see
https://cmake.org/cmake/help/v3.1/policy/CMP0054.html .
This is to suppress a warning when using CMake 3.1.3+.
2016-08-09 16:09:59 -04:00
Umar Arshad
816f29805b
Refactor Id -> Instruction
2016-08-09 15:50:03 -04:00
qining
d49928f0cc
Fix minor mistakes in the tests of dead-const-elim
2016-08-09 14:37:58 -04:00
qining
a90fc84779
Print the shader when module building failed
2016-08-08 17:19:47 -04:00
qining
51a2484b36
Dead constant elimination
...
A pass to remove dead constants, including both front-end constants and spec
constants.
This pass does not handle dead variables and types.
2016-08-08 17:17:15 -04:00
Umar Arshad
fd965c9e7e
Remove unnecessary headers
2016-08-07 10:11:49 -04:00
Umar Arshad
ffa42994fd
Remove needless copies. Delete copy constructor.
...
* Deletes the ValidationState_t copy constructor
* Removes needless copies of the copy constructor
2016-08-06 12:24:19 -04:00
David Neto
c296701964
Add target envs for OpenCL, OpenGL
...
Covers: OpenCL 2.1, OpenCL 2.2
Covers: OpenGL 4.0, OpenGL 4.1, OpenGL 4.2, OpenGL 4.3, OpenGL 4.5.
The OpenGL environments assume the use of GL_ARB_gl_spirv, of course.
2016-08-05 18:19:30 -04:00
David Neto
aa3031273f
Start v2016.3-dev
2016-08-05 17:10:36 -04:00
David Neto
8e3ac3ca58
Finalize v2016.2
...
Document recently fixed bugs.
2016-08-05 17:08:20 -04:00
David Neto
e712f826b6
Hide implementations of BasicBlock::dominates,postdominates
2016-08-05 16:55:21 -04:00
David Neto
605847f15b
Track a construct by its entry block.
2016-08-05 16:05:44 -04:00