Commit Graph

145 Commits

Author SHA1 Message Date
008966e046 mie: ir: add ir builder interface 2026-01-21 14:40:22 +00:00
83343a5eea mie: ir: block: add function to create block parameters 2026-01-21 14:39:56 +00:00
76166167c9 mie: builtin: improve int attribute print callback 2026-01-21 14:39:12 +00:00
f6f6131f52 mie: builtin: add function to create mie_type_attr instances 2026-01-21 14:38:01 +00:00
33f9ccd871 mie: ir: register: implement moving and cleanup of mie_register_use 2026-01-21 14:36:24 +00:00
0c4ebe7f39 mie: ctx: add function to create ops 2026-01-21 14:17:43 +00:00
72de4ce845 mie: ir: op: add function to add op arguments 2026-01-21 14:15:02 +00:00
937dc57c4e tool: validate: resolve op definitions; run test pass 2026-01-19 14:00:25 +00:00
b8c0d139a8 vim: update type and attribute prefixes 2026-01-19 14:00:04 +00:00
abf43a9022 doc: update ir sample files 2026-01-19 13:59:43 +00:00
4700ce7778 build: bump minimum CMake version 2026-01-19 13:59:14 +00:00
95c51045b6 meta: update clang-format config 2026-01-19 13:59:00 +00:00
e62c9c4775 mie: ir: add stub rewriter interface 2026-01-19 13:58:24 +00:00
a97678a1c2 mie: add stub memref dialect 2026-01-19 13:58:12 +00:00
5e13824706 mie: add parent pointers to region and block; two-way link between a register and its users 2026-01-19 13:57:25 +00:00
da140ed0d1 mie: parse: remove duplicate sub-parsers in parse_generic_op 2026-01-19 13:52:21 +00:00
cb3d37043c mie: update b_bstr usage 2026-01-19 13:51:27 +00:00
55161cd6c8 mie: re-implement vectors of blocks and registers using vector move callbacks
vector move callbacks allow mie_name instances to be stored in movable memory,
as the internal bst pointers can now be fixed during vector resize operations.
2026-01-18 22:58:17 +00:00
759aaf9fd8 mie: vector: add copy- and move-constructor support 2026-01-18 21:52:39 +00:00
04af390fe8 mie: pass: add a group of builtin passes
right now, the group only contains a single pass: prefix-func-with-underscore.
this is a test pass that visits instances of func.func and prepends
an underscore to the func's symbol name.
2026-01-18 21:19:15 +00:00
0add39f304 mie: implement a pass system
passes allow defined units of functionality to be applied
on an IR structure. the pass manager can be used to schedule
passes at certain depths of the IR structure and/or on or within
certain types of ops (or ops that have certain traits/interfaces).
2026-01-18 21:17:44 +00:00
429ec770b5 mie: attribute: map: implement REPLACE flag in put() 2026-01-18 21:16:28 +00:00
092c9969cf mie: add NAME_EXISTS status code 2026-01-18 21:16:10 +00:00
6fcc3c8edd mie: ir: op: add functions to query a certain trait or interface 2026-01-18 21:14:50 +00:00
d335cd9823 mie: ir: walk: walk is no longer recursive by default 2026-01-18 20:27:55 +00:00
c014895051 mie: func: add return op 2026-01-17 10:31:52 +00:00
76477be5bd mie: arith: add cmpi and constant ops 2026-01-17 10:31:39 +00:00
ee9e2d3050 mie: arith: implement op printer callbacks 2026-01-17 10:31:08 +00:00
e5ecdd40e8 mie: cf: implement op printer callbacks 2026-01-17 10:29:47 +00:00
c410e0a6e3 mie: builtin: implement op printer callbacks 2026-01-17 10:28:51 +00:00
3ba20e5ed4 mie: print: add more functions to printer interface 2026-01-17 10:27:23 +00:00
f19dfaa050 mie: ctx: fix mie_ctx_resolve_op not checking op-definition pointer properly 2026-01-17 10:26:37 +00:00
2869e98556 mie: builtin: add function to get int/float value from an attribute 2026-01-17 10:25:49 +00:00
b289c6e2de mie: ir: op: add function to get type from mie_op_arg 2026-01-17 10:22:38 +00:00
fd72d217f6 mie: ir: implement a walker interface for traversing ir structures 2026-01-17 10:21:58 +00:00
e1f7f46d3e mie: ir: replace mie_module ir object with a builtin generic "module" op
the builtin.module op behaves exactly like any other op, and is designed
to be a container for other ops of any type. it can be used as the
top-level container for other ops (other top-level containers can be used
instead).

this also changes the file format. now, an ir file can only contain a
single top-level op. any other ops in the ir must be contained
directly or indirectly by this top-level op.
2026-01-16 10:01:19 +00:00
65905bc55b mie: implement support for custom op print formats 2026-01-15 14:20:13 +00:00
3c4af9c26e mie: builtin: initial implementation of a symbol system
the symbol system will allow ops to reference each other via symbolic
names, rather than just via their SSA output registers. this will
allow for links between ops that are less strict than SSA.

the two parts of the system are:
- the symbol-table trait. ops with this trait can contain symbol ops.
- the symbol interface. ops with this interface have the necessary attributes
  to be treated as symbols.
2026-01-14 18:21:28 +00:00
11fc7a6ca9 mie: implement an interface system for ops
this system allows dialects to register named interfaces, which are collections of function
pointers. an op can then implement this interface, providing callbacks for the interface's
virtual function pointers.

C code can request a pointer to an op's implementation of a given interface and call
virtual functions with no knowledge required about the op itself. this functonality
will also be extended to types, attributes, and dialects themselves.
2026-01-14 18:17:38 +00:00
50f4be621b mie: move all builtin types (int, float, index, etc) and attributes to the builtin dialect 2026-01-14 09:45:14 +00:00
da630ce382 mie: replace fixed value system with an extensible attribute interface
under this new system, dialects can define their own custom attributes,
complete with their own print() and parse() callbacks, which can then be
used as values in an op's attribute dictionary.

alongside custom dialect attributes, the former int, float, and string
constant values have been converted to attributes provided by the
arith and builtin dialects respectively. the caches for these attributes
have also been moved from mie_ctx to their respective dialect data
structures.

this system will allow new types of attributes to be implemented,
including dictionaries, arrays, and references to types themselves
(rather than just particular values of a given type).
2026-01-13 22:37:43 +00:00
d19e8626da mie: stop using movable memory for mie_name instances.
any struct that contains a mie_name cannot be stored in movable memory
(i.e. any memory that may be re-allocated using realloc(), or whose
contents may be moved to a different buffer).

mie_names form part of a bst when they are added to a mie_name_map,
and moving them after this happens will result in the bst pointers
being invalidated. this causes some obscure and hard-to-debug
memory errors.

all structs that contain a mie_name (including named IR objects like
mie_register and mie_block) are no longer stored directly in vectors.
rather, vectors of pointers are used instead.
2026-01-12 10:40:57 +00:00
0fdadb3250 mie: trait: fix trait definitions not being initialised correctly 2026-01-12 10:40:14 +00:00
2d903f4a94 mie: type: fix type definitions not being initialised correctly 2026-01-12 10:37:49 +00:00
3aad8fd4a3 mie: index: cache: fix cache entries not being initialised correctly 2026-01-12 10:36:32 +00:00
49df8616a8 mie: implement a printer system for converting IR to textual form 2026-01-12 10:33:08 +00:00
826380ea34 mie: ctx: fix new mie_trait instances not being fully initialised 2026-01-12 10:05:12 +00:00
9df79f90a6 meta: add clang-format config 2026-01-11 14:51:49 +00:00
c9c9cdf544 tool: add temporary parsing and ctx tests to validate subcommand 2026-01-11 14:51:37 +00:00
3253c4cac9 vim: add support for mach-registers, graph instructions, etc 2026-01-11 14:51:09 +00:00