[all-commits] [llvm/llvm-project] 855b42: [IntegerAttr] Add helpers for working with LLVM's ...

Chris Lattner via All-commits all-commits at lists.llvm.org
Tue May 18 10:52:15 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 855b42ddd0117055477546e9cc16667a62ffdedf
      https://github.com/llvm/llvm-project/commit/855b42ddd0117055477546e9cc16667a62ffdedf
  Author: Chris Lattner <clattner at nondot.org>
  Date:   2021-05-18 (Tue, 18 May 2021)

  Changed paths:
    M mlir/include/mlir/IR/BuiltinAttributes.td
    M mlir/include/mlir/Support/LLVM.h
    M mlir/lib/IR/BuiltinAttributes.cpp

  Log Message:
  -----------
  [IntegerAttr] Add helpers for working with LLVM's APSInt type.

The FIRRTL dialect in CIRCT uses inherently signful types, and APSInt
is the best way to model that.  Add a couple of helpers that make it
easier to work with an IntegerAttr that carries a sign.

This follows the example of getZExt() and getSExt() which assert when
the underlying type of the attribute is unexpected.  In this case
we assert fail when the underlying type of the attribute is signless.

This is strictly additive, so it is NFC.  It is tested in the CIRCT
repo.

Differential Revision: https://reviews.llvm.org/D102701




More information about the All-commits mailing list