diff options
author | David Greene <greened@obbligato.org> | 2011-07-29 19:07:26 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2011-07-29 19:07:26 +0000 |
commit | 78621a851ae84520de7d24a6d61e1dcf25749712 (patch) | |
tree | 53287ca098f7a9fc2c3b4dd6f1cdac4f883c8241 /utils/TableGen/Record.h | |
parent | 65bf3ca9aa474db6c5c2a0d3ea0f4a22af514184 (diff) | |
download | external_llvm-78621a851ae84520de7d24a6d61e1dcf25749712.zip external_llvm-78621a851ae84520de7d24a6d61e1dcf25749712.tar.gz external_llvm-78621a851ae84520de7d24a6d61e1dcf25749712.tar.bz2 |
[AVX] Make DagInits Unique
Make sure DagInits are unique and created only once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.h')
-rw-r--r-- | utils/TableGen/Record.h | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h index cbde0e9..351625a 100644 --- a/utils/TableGen/Record.h +++ b/utils/TableGen/Record.h @@ -1252,39 +1252,31 @@ public: /// to have at least one value then a (possibly empty) list of arguments. Each /// argument can have a name associated with it. /// -class DagInit : public TypedInit { +class DagInit : public TypedInit, public FoldingSetNode { const Init *Val; std::string ValName; std::vector<const Init*> Args; std::vector<std::string> ArgNames; DagInit(const Init *V, const std::string &VN, - const std::vector<std::pair<const Init*, std::string> > &args) - : TypedInit(DagRecTy::get()), Val(V), ValName(VN) { - Args.reserve(args.size()); - ArgNames.reserve(args.size()); - for (unsigned i = 0, e = args.size(); i != e; ++i) { - Args.push_back(args[i].first); - ArgNames.push_back(args[i].second); - } - } - DagInit(const Init *V, const std::string &VN, - const std::vector<const Init*> &args, - const std::vector<std::string> &argNames) - : TypedInit(DagRecTy::get()), Val(V), ValName(VN), Args(args), - ArgNames(argNames) { } + ArrayRef<const Init *> ArgRange, + ArrayRef<std::string> NameRange) + : TypedInit(DagRecTy::get()), Val(V), ValName(VN), + Args(ArgRange.begin(), ArgRange.end()), + ArgNames(NameRange.begin(), NameRange.end()) {} DagInit(const DagInit &Other); // Do not define. DagInit &operator=(const DagInit &Other); // Do not define. public: static const DagInit *get(const Init *V, const std::string &VN, + ArrayRef<const Init *> ArgRange, + ArrayRef<std::string> NameRange); + static const DagInit *get(const Init *V, const std::string &VN, const std::vector< std::pair<const Init*, std::string> > &args); - static const DagInit *get(const Init *V, const std::string &VN, - const std::vector<const Init*> &args, - const std::vector<std::string> &argNames); + void Profile(FoldingSetNodeID &ID) const; virtual const Init *convertInitializerTo(RecTy *Ty) const { return Ty->convertValue(this); |