Commit Graph

81 Commits

Author SHA1 Message Date
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
qining
d065593404 Add iterator getter interface for types_values_ 2016-08-12 15:10:51 -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
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
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
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
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
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
qining
5be1ee173f Add blurbs for freeze-spec-const pass 2016-08-05 10:39:50 -04:00
Lei Zhang
64ff3c6dc1 Optimization: Add def use analysis. 2016-07-29 15:45:14 -04:00
Lei Zhang
1db4cb456b Use default copy/move constructors/assignments for Instruction. 2016-07-29 00:58:09 -04:00
Lei Zhang
dcf28bf6ce Allow missing memory model instructions in modules. 2016-07-29 00:58:09 -04:00
qining
a24506266b Freeze spec constants to their default values
Add a pass to freeze spec constants to their default values. This pass does
not fold the frozen spec constants and does not handle SpecConstantOp
instructions and SpecConstantComposite instructions.
2016-07-28 15:23:30 -04:00
qining
d503d75cc3 Use friendly disassembly output 2016-07-28 09:39:42 -04:00
Lei Zhang
2c4c73cf37 Add Pass, PassManager, and StripDebugInfoPass. 2016-06-29 17:32:00 -04:00
Lei Zhang
abf8f6413c Promote ir namespace and create draft libspirv.{h|c}pp. 2016-06-28 14:52:34 -04:00
Lei Zhang
8590f9cc81 Add IrBuilder for constructing SPIR-V in-memory representation. 2016-06-27 16:57:42 -04:00
Lei Zhang
3df8f7cebd Add classes for representing SPIR-V language constructs in memory. 2016-06-24 20:54:06 -04:00