-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from asraa:comb-dialect
PiperOrigin-RevId: 569213837
- Loading branch information
Showing
12 changed files
with
871 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
load("@llvm-project//mlir:tblgen.bzl", "gentbl_cc_library", "td_library") | ||
|
||
package( | ||
default_applicable_licenses = ["@heir//:license"], | ||
default_visibility = ["//visibility:public"], | ||
) | ||
|
||
exports_files( | ||
glob(["*.h"]), | ||
) | ||
|
||
td_library( | ||
name = "td_files", | ||
srcs = [ | ||
"Comb.td", | ||
"Combinational.td", | ||
], | ||
includes = ["include"], | ||
deps = [ | ||
"@llvm-project//mlir:BuiltinDialectTdFiles", | ||
"@llvm-project//mlir:ControlFlowInterfacesTdFiles", | ||
"@llvm-project//mlir:FunctionInterfacesTdFiles", | ||
"@llvm-project//mlir:InferTypeOpInterfaceTdFiles", | ||
"@llvm-project//mlir:OpBaseTdFiles", | ||
"@llvm-project//mlir:SideEffectInterfacesTdFiles", | ||
], | ||
) | ||
|
||
gentbl_cc_library( | ||
name = "dialect_inc_gen", | ||
includes = ["include"], | ||
tbl_outs = [ | ||
( | ||
[ | ||
"-gen-dialect-decls", | ||
"-dialect=comb", | ||
], | ||
"CombDialect.h.inc", | ||
), | ||
( | ||
[ | ||
"-gen-dialect-defs", | ||
"-dialect=comb", | ||
], | ||
"CombDialect.cpp.inc", | ||
), | ||
( | ||
["-gen-dialect-doc"], | ||
"CombDialect.md", | ||
), | ||
], | ||
tblgen = "@llvm-project//mlir:mlir-tblgen", | ||
td_file = "Comb.td", | ||
deps = [ | ||
":td_files", | ||
":type_inc_gen", | ||
], | ||
) | ||
|
||
gentbl_cc_library( | ||
name = "ops_inc_gen", | ||
includes = ["include"], | ||
tbl_outs = [ | ||
( | ||
[ | ||
"-gen-op-decls", | ||
], | ||
"Comb.h.inc", | ||
), | ||
( | ||
[ | ||
"-gen-op-defs", | ||
], | ||
"Comb.cpp.inc", | ||
), | ||
( | ||
["-gen-op-doc"], | ||
"CombOps.md", | ||
), | ||
], | ||
tblgen = "@llvm-project//mlir:mlir-tblgen", | ||
td_file = "Comb.td", | ||
deps = [ | ||
":dialect_inc_gen", | ||
":td_files", | ||
], | ||
) | ||
|
||
gentbl_cc_library( | ||
name = "type_inc_gen", | ||
includes = ["include"], | ||
tbl_outs = [ | ||
( | ||
[ | ||
"-gen-typedef-decls", | ||
], | ||
"CombTypes.h.inc", | ||
), | ||
( | ||
[ | ||
"-gen-typedef-defs", | ||
], | ||
"CombTypes.cpp.inc", | ||
), | ||
( | ||
["-gen-typedef-doc"], | ||
"CombTypes.md", | ||
), | ||
], | ||
tblgen = "@llvm-project//mlir:mlir-tblgen", | ||
td_file = "Comb.td", | ||
deps = [ | ||
":td_files", | ||
], | ||
) | ||
|
||
gentbl_cc_library( | ||
name = "enum_inc_gen", | ||
includes = ["include"], | ||
tbl_outs = [ | ||
( | ||
[ | ||
"-gen-enum-decls", | ||
], | ||
"CombEnums.h.inc", | ||
), | ||
( | ||
[ | ||
"-gen-enum-defs", | ||
], | ||
"CombEnums.cpp.inc", | ||
), | ||
], | ||
tblgen = "@llvm-project//mlir:mlir-tblgen", | ||
td_file = "Comb.td", | ||
deps = [ | ||
":dialect_inc_gen", | ||
":td_files", | ||
], | ||
) |
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,42 @@ | ||
//===- Comb.td - Comb dialect definition --------------------*- 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 is the top level file for the Comb dialect. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef HEIR_INCLUDE_DIALECT_COMB_COMB_TD | ||
#define HEIR_INCLUDE_DIALECT_COMB_COMB_TD | ||
|
||
include "mlir/IR/OpBase.td" | ||
include "mlir/Interfaces/SideEffectInterfaces.td" | ||
include "mlir/IR/OpAsmInterface.td" | ||
include "mlir/IR/SymbolInterfaces.td" | ||
|
||
def CombDialect : Dialect { | ||
let name = "comb"; | ||
|
||
let summary = "Types and operations for comb dialect"; | ||
let description = [{ | ||
This dialect defines the `comb` dialect, which is intended to be a generic | ||
representation of combinational logic outside of a particular use-case. | ||
}]; | ||
let cppNamespace = "::mlir::heir::comb"; | ||
|
||
// This will be the default after next LLVM bump. | ||
let usePropertiesForAttributes = 1; | ||
|
||
} | ||
|
||
// Base class for the operation in this dialect. | ||
class CombOp<string mnemonic, list<Trait> traits = []> : | ||
Op<CombDialect, mnemonic, traits>; | ||
|
||
include "Combinational.td" | ||
|
||
#endif // HEIR_INCLUDE_DIALECT_COMB_COMB_TD |
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,25 @@ | ||
//===- CombDialect.h - Comb dialect declaration -----------------*- C++ -*-===// | ||
// | ||
// 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 defines the Combinational MLIR dialect. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef HEIR_INCLUDE_DIALECT_COMB_COMBDIALECT_H | ||
#define HEIR_INCLUDE_DIALECT_COMB_COMBDIALECT_H | ||
|
||
#include "mlir/include/mlir/IR/BuiltinAttributes.h" // from @llvm-project | ||
#include "mlir/include/mlir/IR/Dialect.h" // from @llvm-project | ||
|
||
// Pull in the Dialect definition. | ||
#include "include/Dialect/Comb/IR/CombDialect.h.inc" | ||
|
||
// Pull in all enum type definitions and utility function declarations. | ||
#include "include/Dialect/Comb/IR/CombEnums.h.inc" | ||
|
||
#endif // HEIR_INCLUDE_DIALECT_COMB_COMBDIALECT_H |
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,36 @@ | ||
//===- CombOps.h - Declare Comb dialect operations --------------*- C++ -*-===// | ||
// | ||
// 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 declares the operation classes for the Comb dialect. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef HEIR_INCLUDE_DIALECT_COMB_COMBOPS_H | ||
#define HEIR_INCLUDE_DIALECT_COMB_COMBOPS_H | ||
|
||
#include "include/Dialect/Comb/IR/CombDialect.h" | ||
#include "mlir/include/mlir/Bytecode/BytecodeOpInterface.h" // from @llvm-project | ||
#include "mlir/include/mlir/IR/BuiltinOps.h" // from @llvm-project | ||
#include "mlir/include/mlir/IR/OpImplementation.h" // from @llvm-project | ||
#include "mlir/include/mlir/Interfaces/FunctionInterfaces.h" // from @llvm-project | ||
#include "mlir/include/mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project | ||
#include "mlir/include/mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project | ||
#include "mlir/include/mlir/Support/LLVM.h" // from @llvm-project | ||
|
||
namespace llvm { | ||
struct KnownBits; | ||
} | ||
|
||
namespace mlir { | ||
class PatternRewriter; | ||
} | ||
|
||
#define GET_OP_CLASSES | ||
#include "include/Dialect/Comb/IR/Comb.h.inc" | ||
|
||
#endif // HEIR_INCLUDE_DIALECT_COMB_COMBOPS_H |
Oops, something went wrong.