-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TableGen] Factor common defs out into common
Types.td
(#2120)
Create a CIRCT-wide `include/circt/Types.td` file that can collect the common type, attribute, and constraint definitions used throughout the CIRCT project, which may not be specific to one of the given dialects. Things that land here would generally be candidates for upstreaming to MLIR, but it's better to have a common place in CIRCT first where they can incubate. While we're at it, get rid of some of the type definitions which have since appeared in upstream MLIR, and factor some first commonalities out into `Types.td`. There will be quite a few more in the future.
- Loading branch information
1 parent
aa3405b
commit 3c08741
Showing
7 changed files
with
50 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//===- Types.td - Common type predicates and definitions ---*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file collects type predicates and definitions commonly used in the CIRCT | ||
// dialects. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_TYPES | ||
#define CIRCT_TYPES | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Attributes | ||
//===----------------------------------------------------------------------===// | ||
|
||
def APSIntAttr : Attr<CPred<"$_self.isa<::mlir::IntegerAttr>()">, | ||
"arbitrary integer attribute with sign"> { | ||
let storageType = [{ ::mlir::IntegerAttr }]; | ||
let returnType = [{ ::llvm::APSInt }]; | ||
let constBuilderCall = "IntegerAttr::get($_builder.getContext(), $0)"; | ||
let convertFromStorage = "APSInt($_self.getValue(), !getType().isSigned())"; | ||
} | ||
|
||
#endif // CIRCT_TYPES |