-
Notifications
You must be signed in to change notification settings - Fork 318
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NFC][ESI][MSFT] Move AppIDs over to ESI (#6177)
Since AppIDs serve as system identifiers, they classify as a system construction feature. So they should be in the ESI dialect, which will be using them shortly.
- Loading branch information
Showing
25 changed files
with
490 additions
and
656 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
//===- AppID.h - AppID related code -----------------------------*- 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Application IDs are paths through the instance hierarchy with some | ||
// application-specific meaning. They allow designers and users to avoid some of | ||
// the design's implementation details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_DIALECT_ESI_APPID_H | ||
#define CIRCT_DIALECT_ESI_APPID_H | ||
|
||
#include "circt/Dialect/ESI/ESIAttributes.h" | ||
#include "circt/Dialect/HW/HWSymCache.h" | ||
|
||
#include "mlir/IR/Operation.h" | ||
#include "llvm/ADT/DenseMap.h" | ||
|
||
namespace circt { | ||
namespace esi { | ||
|
||
/// An index for resolving AppIDPaths to dynamic instances. | ||
class AppIDIndex { | ||
public: | ||
AppIDIndex(Operation *mlirTop); | ||
~AppIDIndex(); | ||
|
||
// If invalid, construction failed for some reason (which was emitted via an | ||
// error). Since we want to be able to call this class as an analysis, all of | ||
// the index construction occurs in the constructor, which doesn't allow for | ||
// a LogicalResult return. (This is where exceptions would be useful.) | ||
bool isValid() const { return valid; } | ||
|
||
// Return an array of AppIDAttrs which are contained in the module. | ||
ArrayAttr getChildAppIDsOf(hw::HWModuleLike) const; | ||
|
||
/// Return an array of InnerNameRefAttrs representing the relative path to | ||
/// 'appid' from 'fromMod'. | ||
FailureOr<ArrayAttr> getAppIDPathAttr(hw::HWModuleLike fromMod, | ||
AppIDAttr appid, Location loc) const; | ||
|
||
private: | ||
//===--------------------------------------------------------------------===// | ||
// Index construction and storage. | ||
//===--------------------------------------------------------------------===// | ||
class ModuleAppIDs; | ||
|
||
/// Construct the index for a module. | ||
FailureOr<const ModuleAppIDs *> buildIndexFor(hw::HWModuleLike modToProcess); | ||
|
||
// Map modules to their cached child app ID indexes. | ||
DenseMap<hw::HWModuleLike, ModuleAppIDs *> containerAppIDs; | ||
|
||
bool valid; | ||
hw::HWSymbolCache symCache; | ||
}; | ||
|
||
} // namespace esi | ||
} // namespace circt | ||
|
||
#endif // CIRCT_DIALECT_ESI_APPID_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,51 @@ | ||
//===- ESIChannels.td - All ESI ops related to app channels -- 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 where any operations for the ESI dialect live. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_DIALECT_ESI_APPID_TD | ||
#define CIRCT_DIALECT_ESI_APPID_TD | ||
|
||
include "mlir/IR/AttrTypeBase.td" | ||
|
||
def AppIDAttr : ESI_Attr<"AppID"> { | ||
let summary = "An application relevant instance identifier"; | ||
let description = [{ | ||
Identifies an instance which is visible through multiple hierarchy levels. | ||
Indended to make locating an instance easier in the instance hierarchy. | ||
}]; | ||
|
||
let parameters = (ins "StringAttr":$name, "uint64_t":$index); | ||
let mnemonic = "appid"; | ||
let assemblyFormat = [{ | ||
`<` $name `[` $index `]` `>` | ||
}]; | ||
|
||
let extraClassDeclaration = [{ | ||
static constexpr StringRef AppIDAttrName = "esi.appid"; | ||
}]; | ||
} | ||
|
||
def AppIDPathAttr : ESI_Attr<"AppIDPath"> { | ||
let summary = "An application-specific hierarchical path through a design"; | ||
let description = [{ | ||
A list of AppID components which specifies a specific dynamic instance | ||
in the design. | ||
}]; | ||
|
||
let parameters = (ins "FlatSymbolRefAttr":$root, | ||
ArrayRefParameter<"AppIDAttr">:$path); | ||
let mnemonic = "appid_path"; | ||
let assemblyFormat = [{ | ||
`<` $root `[` $path `]` `>` | ||
}]; | ||
} | ||
|
||
#endif // CIRCT_DIALECT_ESI_APPID_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,23 @@ | ||
//===- ESIAttributes.h - attributes for the ESI dialect ---------*- 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_DIALECT_ESI_ESIATTRIBUTES_H | ||
#define CIRCT_DIALECT_ESI_ESIATTRIBUTES_H | ||
|
||
#include "circt/Dialect/HW/HWTypes.h" | ||
#include "circt/Support/LLVM.h" | ||
#include "mlir/IR/Dialect.h" | ||
#include "mlir/IR/Operation.h" | ||
|
||
#include "ESIDialect.h" | ||
|
||
#define GET_ATTRDEF_CLASSES | ||
#include "circt/Dialect/ESI/ESIAttributes.h.inc" | ||
|
||
#endif |
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
Oops, something went wrong.