Skip to content

Commit 6aafd64

Browse files
opti-mixfacebook-github-bot
authored andcommitted
Make FXIRWrapper a sub-class of glow::Function (#5962)
Summary: Pull Request resolved: #5962 This allows for adding FXIRWrapper objects to the list of glow::Module functions, so that glow::Modules owns them. Reviewed By: jaybean-dev, yuhc Differential Revision: D36917134 fbshipit-source-id: e02f1970858ae5eb7bc45fed365ac81295bb3c6b
1 parent 8feabcd commit 6aafd64

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

include/glow/Graph/FXIRWrapper.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@ using FXWeight = folly::dynamic;
3131

3232
/// A thin wrapper around FX IR to provides common APIs. This is not mean to be
3333
/// yet another IR, e.g., Glow high level graph IR.
34-
class FXIRWrapper final : public IRContainer {
34+
class FXIRWrapper final : public Function {
3535
/// Mapping from constant name to a void pointer points to where the constant
3636
/// is actually stored.
3737
const llvm::StringMap<const void *> &constants_;
3838

39-
/// A reference to the owner of the function.
40-
Module *parent_;
41-
4239
/// Mapping from getattrs to the underlying name of the constants they alias.
4340
llvm::StringMap<const std::string> getattrs_;
4441

@@ -52,7 +49,7 @@ class FXIRWrapper final : public IRContainer {
5249
FXIRWrapper(const FXModule &FXIR, const std::string &submod,
5350
const llvm::StringMap<const void *> &constants,
5451
Module *glowModule, llvm::StringRef name = {})
55-
: IRContainer(name), constants_(constants), parent_(glowModule) {
52+
: Function(glowModule, name), constants_(constants) {
5653
fx_mod_ = submod == "" ? &FXIR : &(FXIR["modules"][submod]);
5754
// Create mapping from getattrs to the underlying name of the constants they
5855
// alias.
@@ -70,7 +67,7 @@ class FXIRWrapper final : public IRContainer {
7067
}
7168
}
7269

73-
~FXIRWrapper() = default;
70+
~FXIRWrapper() override = default;
7471

7572
/// A map to store (key) node name to (value) placeholder/constant.
7673
llvm::StringMap<const Storage *> mapNodeNameToStorage_ = {};
@@ -117,10 +114,6 @@ class FXIRWrapper final : public IRContainer {
117114
/// \returns the nodes of the graph.
118115
const FXNodeList &getNodes() const;
119116

120-
/// \returns parent module that owns this graph.
121-
Module *getParent() override { return parent_; }
122-
const Module *getParent() const override { return parent_; }
123-
124117
/// \returns fx module.
125118
const FXModule &getFXModule() const { return *fx_mod_; }
126119

0 commit comments

Comments
 (0)