AnyDSL / MimIR

MimIR is my Intermediate Representation
https://anydsl.github.io/MimIR/
MIT License
46 stars 9 forks source link

Refactor/set2 #206

Closed leissa closed 1 year ago

leissa commented 1 year ago

Changes

Restricting Write Access for Mutables

I'm currently working on (implicitly) maintaining the nesting structure of a Thorin program. One major headache is that right now, you can arbitrarily change the ops of a mutable. With this patch you can still change the ops of a mutable, but you have to obey certain rules:

  1. If Def::is_set() is ...
    1. ... false, Def::set the operands from left (i == 0) to right (i == num_ops() - 1).
    2. ... true, Def::reset the operands from left to right as in 1i.
  2. In addition, you can invoke Def::unset() at any time to start over with 1i:
    mut->unset()->set({a, b, c}); // This will always work, but should be your last resort.

    Violating these rule will raise an assertion.

Putting aside that these rules will help me to keep track of some infos in a much more efficient way, having these rules in place will also help to prevent you from doing really questionable things - to say at least.

Other Changes