-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RTG] Add context resource interfaces
Co-authored-by: Andrew Lenharth <andrew@lenharth.org>
- Loading branch information
Showing
9 changed files
with
144 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,46 @@ | ||
//===- RTGInterfaces.td - Interfaces used in RTG -----------*- 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_DIALECT_RTG_RTGINTERFACES_TD | ||
#define CIRCT_DIALECT_RTG_RTGINTERFACES_TD | ||
|
||
include "mlir/IR/Interfaces.td" | ||
|
||
def ContextResourceOpInterface : OpInterface<"ContextResourceOpInterface"> { | ||
let description = [{ | ||
This interface should be implemented by operations that define | ||
context resources. The operation should define at least one SSA value of a type | ||
implementing the `ContextResourceTypeInterface`. | ||
}]; | ||
let cppNamespace = "::circt::rtg"; | ||
|
||
let methods = [ | ||
InterfaceMethod<[{ | ||
Provides a unique identifier for the defined context resource at `idx` | ||
(not counting op results that are not of a type implementing the | ||
`ContextResourceTypeInterface`). | ||
For example, if the context resource are CPUs it could be the coreid. | ||
}], | ||
"size_t", "getIdentifier", (ins "size_t":$idx)>, | ||
]; | ||
} | ||
|
||
def ContextResourceTypeInterface : TypeInterface< | ||
"ContextResourceTypeInterface"> { | ||
let description = [{ | ||
This interface should be implemented by types that represent context | ||
resources. The `on_context` operation takes an operand of a type | ||
implementing this interface or a set of such a type. | ||
Any operation that creates a value of a type implementing this interface | ||
must implement the `ContextResourceOpInterface` (does not apply to | ||
operations that just forward a value of such type). | ||
}]; | ||
let cppNamespace = "::circt::rtg"; | ||
} | ||
|
||
#endif // CIRCT_DIALECT_RTG_RTGINTERFACES_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,21 @@ | ||
//===- RTGOpInterfaces.h - Declare RTG op interfaces ------------*- 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 op interfaces for the RTG Dialect. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_DIALECT_RTG_IR_RTGOPINTERFACES_H | ||
#define CIRCT_DIALECT_RTG_IR_RTGOPINTERFACES_H | ||
|
||
#include "circt/Support/LLVM.h" | ||
#include "mlir/IR/OpDefinition.h" | ||
|
||
#include "circt/Dialect/RTG/IR/RTGOpInterfaces.h.inc" | ||
|
||
#endif // CIRCT_DIALECT_RTG_IR_RTGOPINTERFACES_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
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,21 @@ | ||
//===- RTGTypeInterfaces.h - Declare RTG type interfaces --------*- 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 type interfaces for the RTG Dialect. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_DIALECT_RTG_IR_RTGTYPEINTERFACES_H | ||
#define CIRCT_DIALECT_RTG_IR_RTGTYPEINTERFACES_H | ||
|
||
#include "circt/Support/LLVM.h" | ||
#include "mlir/IR/Types.h" | ||
|
||
#include "circt/Dialect/RTG/IR/RTGTypeInterfaces.h.inc" | ||
|
||
#endif // CIRCT_DIALECT_RTG_IR_RTGTYPEINTERFACES_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
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,19 @@ | ||
//===- RTGOpInterfaces.cpp - Implement the RTG op interfaces --------------===// | ||
// | ||
// 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 implements the RTG op interfaces. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "circt/Dialect/RTG/IR/RTGOpInterfaces.h" | ||
|
||
//===----------------------------------------------------------------------===// | ||
// TableGen generated logic. | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "circt/Dialect/RTG/IR/RTGOpInterfaces.cpp.inc" |
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,19 @@ | ||
//===- RTGTypeInterfaces.cpp - Implement the RTG type interfaces ----------===// | ||
// | ||
// 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 implements the RTG type interfaces. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "circt/Dialect/RTG/IR/RTGTypeInterfaces.h" | ||
|
||
//===----------------------------------------------------------------------===// | ||
// TableGen generated logic. | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "circt/Dialect/RTG/IR/RTGTypeInterfaces.cpp.inc" |