Documentation

SSA.Projects.InstCombine.Base

InstCombine Dialect #

This file defines a dialect of basic arithmetic and bitwise operations on bitvectors.

The dialect supports types of arbitrary-width bitvectors. Thus, some definitions wil be parameterized by φ, the number of width meta-variables there are. This parameter will usually be either 0, indicating that all widths are known, concrete values, or 1, indicating there is exactly one distinct width meta-variable.

In particular, we only define a denotational semantics for concrete programs (i.e., where φ = 0)

see https://releases.llvm.org/14.0.0/docs/LangRef.html#bitwise-binary-operations

@[reducible, inline]
abbrev InstCombine.Width (φ : ) :
Equations
Instances For
    inductive InstCombine.MTy (φ : ) :
    Instances For
      Equations
      • InstCombine.instDecidableEqMTy = InstCombine.decEqMTy✝
      Equations
      @[reducible, inline]
      Equations
      Instances For
        @[reducible, match_pattern, inline]
        Equations
        Instances For
          Equations
          • One or more equations did not get rendered due to their size.
          Equations
          • InstCombine.instToFormatMTy = { format := repr }
          Equations
          Equations
          Instances For
            Equations
            • InstCombine.instReprBitVec_sSA = { reprPrec := fun (x : BitVec n) (x_1 : ) => match x, x_1 with | v, n_1 => reprPrec v.toInt n_1 }

            Homogeneous, unary operations

            Instances For

              If both the nuw and nsw flags are the default value (false,false), then we should not print them. This should be the default behavior in Lean, but it isn't

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                inductive InstCombine.MOp (φ : ) :
                Instances For
                  Equations
                  • InstCombine.instReprMOp = { reprPrec := InstCombine.reprMOp✝ }
                  Equations
                  • InstCombine.instDecidableEqMOp = InstCombine.decEqMOp✝
                  Equations
                  @[match_pattern]
                  def InstCombine.MOp.or {φ : } (w : InstCombine.Width φ) (DisjointFlag : optParam LLVM.DisjointFlag { disjoint := false }) :
                  Equations
                  Instances For
                    @[match_pattern]
                    def InstCombine.MOp.shl {φ : } (w : InstCombine.Width φ) (NoWrapFlags : optParam LLVM.NoWrapFlags { nsw := false, nuw := false }) :
                    Equations
                    Instances For
                      @[match_pattern]
                      def InstCombine.MOp.add {φ : } (w : InstCombine.Width φ) (NoWrapFlags : optParam LLVM.NoWrapFlags { nsw := false, nuw := false }) :
                      Equations
                      Instances For
                        @[match_pattern]
                        def InstCombine.MOp.mul {φ : } (w : InstCombine.Width φ) (NoWrapFlags : optParam LLVM.NoWrapFlags { nsw := false, nuw := false }) :
                        Equations
                        Instances For
                          @[match_pattern]
                          def InstCombine.MOp.sub {φ : } (w : InstCombine.Width φ) (NoWrapFlags : optParam LLVM.NoWrapFlags { nsw := false, nuw := false }) :
                          Equations
                          Instances For
                            @[match_pattern]
                            def InstCombine.MOp.lshr {φ : } (w : InstCombine.Width φ) (ExactFlag : optParam LLVM.ExactFlag { exact := false }) :
                            Equations
                            Instances For
                              @[match_pattern]
                              def InstCombine.MOp.ashr {φ : } (w : InstCombine.Width φ) (ExactFlag : optParam LLVM.ExactFlag { exact := false }) :
                              Equations
                              Instances For
                                @[match_pattern]
                                def InstCombine.MOp.sdiv {φ : } (w : InstCombine.Width φ) (ExactFlag : optParam LLVM.ExactFlag { exact := false }) :
                                Equations
                                Instances For
                                  @[match_pattern]
                                  def InstCombine.MOp.udiv {φ : } (w : InstCombine.Width φ) (ExactFlag : optParam LLVM.ExactFlag { exact := false }) :
                                  Equations
                                  Instances For
                                    def InstCombine.MOp.deepCasesOn {motive : {φ : } → InstCombine.MOp φSort u_1} (neg : {φ : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.neg w)) (not : {φ : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.not w)) (copy : {φ : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.copy w)) (and : {φ : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.and w)) (or : {φ : } → {DisjointFlag : LLVM.DisjointFlag} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.or w DisjointFlag)) (xor : {φ : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.xor w)) (shl : {φ : } → {NoWrapFlags : LLVM.NoWrapFlags} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.shl w NoWrapFlags)) (lshr : {φ : } → {ExactFlag : LLVM.ExactFlag} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.lshr w ExactFlag)) (ashr : {φ : } → {ExactFlag : LLVM.ExactFlag} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.ashr w ExactFlag)) (urem : {φ : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.urem w)) (srem : {φ : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.srem w)) (add : {φ : } → {NoWrapFlags : LLVM.NoWrapFlags} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.add w NoWrapFlags)) (mul : {φ : } → {NoWrapFlags : LLVM.NoWrapFlags} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.mul w NoWrapFlags)) (sub : {φ : } → {NoWrapFlags : LLVM.NoWrapFlags} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.sub w NoWrapFlags)) (sdiv : {φ : } → {ExactFlag : LLVM.ExactFlag} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.sdiv w ExactFlag)) (udiv : {φ : } → {ExactFlag : LLVM.ExactFlag} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.udiv w ExactFlag)) (select : {φ : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.select w)) (icmp : {φ : } → {c : LLVM.IntPredicate} → {w : InstCombine.Width φ} → motive (InstCombine.MOp.icmp c w)) (const : {φ : } → {v : } → {w : InstCombine.Width φ} → motive (InstCombine.MOp.const w v)) {φ : } (op : InstCombine.MOp φ) :
                                    motive op

                                    Recursion principle in terms of individual operations, rather than unary or binary

                                    Equations
                                    Instances For
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      @[reducible, inline]
                                      Equations
                                      Instances For
                                        @[reducible, match_pattern, inline]
                                        Equations
                                        Instances For
                                          @[reducible, match_pattern, inline]
                                          Equations
                                          Instances For
                                            @[reducible, match_pattern, inline]
                                            Equations
                                            Instances For
                                              @[reducible, match_pattern, inline]
                                              Equations
                                              Instances For
                                                @[reducible, match_pattern, inline]
                                                Equations
                                                Instances For
                                                  @[reducible, match_pattern, inline]
                                                  Equations
                                                  Instances For
                                                    @[reducible, match_pattern, inline]
                                                    Equations
                                                    Instances For
                                                      @[reducible, match_pattern, inline]
                                                      Equations
                                                      Instances For
                                                        @[reducible, match_pattern, inline]
                                                        Equations
                                                        Instances For
                                                          @[reducible, match_pattern, inline]
                                                          Equations
                                                          Instances For
                                                            @[reducible, match_pattern, inline]
                                                            Equations
                                                            Instances For
                                                              @[reducible, match_pattern, inline]
                                                              Equations
                                                              Instances For
                                                                @[reducible, match_pattern, inline]
                                                                abbrev InstCombine.Op.or (w : ) (flag : optParam LLVM.DisjointFlag { disjoint := false }) :
                                                                Equations
                                                                Instances For
                                                                  @[reducible, match_pattern, inline]
                                                                  abbrev InstCombine.Op.shl (w : ) (flags : optParam LLVM.NoWrapFlags { nsw := false, nuw := false }) :
                                                                  Equations
                                                                  Instances For
                                                                    @[reducible, match_pattern, inline]
                                                                    abbrev InstCombine.Op.add (w : ) (flags : optParam LLVM.NoWrapFlags { nsw := false, nuw := false }) :
                                                                    Equations
                                                                    Instances For
                                                                      @[reducible, match_pattern, inline]
                                                                      abbrev InstCombine.Op.mul (w : ) (flags : optParam LLVM.NoWrapFlags { nsw := false, nuw := false }) :
                                                                      Equations
                                                                      Instances For
                                                                        @[reducible, match_pattern, inline]
                                                                        abbrev InstCombine.Op.sub (w : ) (flags : optParam LLVM.NoWrapFlags { nsw := false, nuw := false }) :
                                                                        Equations
                                                                        Instances For
                                                                          @[reducible, match_pattern, inline]
                                                                          Equations
                                                                          Instances For
                                                                            @[reducible, match_pattern, inline]
                                                                            Equations
                                                                            Instances For
                                                                              @[reducible, match_pattern, inline]
                                                                              Equations
                                                                              Instances For
                                                                                @[reducible, match_pattern, inline]
                                                                                Equations
                                                                                Instances For
                                                                                  @[reducible, inline]

                                                                                  MetaLLVM φ is the LLVM dialect with at most φ metavariables

                                                                                  Equations
                                                                                  Instances For
                                                                                    @[reducible, inline]
                                                                                    Equations
                                                                                    Instances For
                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.