diff options
author | Juergen Ributzka <juergen@apple.com> | 2013-11-15 22:34:48 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2013-11-15 22:34:48 +0000 |
commit | 5a364c5561ec04e33a6f5d52c14f1bac6f247ea0 (patch) | |
tree | 2fcdad4351006993fd039cba47193d98cdfc5ae3 /utils/TableGen/CodeGenSchedule.cpp | |
parent | 17d4ac8c461fb3c32483cf7a37bc52937caeb650 (diff) | |
download | llvm-5a364c5561ec04e33a6f5d52c14f1bac6f247ea0.tar.gz llvm-5a364c5561ec04e33a6f5d52c14f1bac6f247ea0.tar.bz2 llvm-5a364c5561ec04e33a6f5d52c14f1bac6f247ea0.tar.xz |
[weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file.
Differential Revision: http://llvm-reviews.chandlerc.com/D2068
Reviewed by Andy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194865 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenSchedule.cpp')
-rw-r--r-- | utils/TableGen/CodeGenSchedule.cpp | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/utils/TableGen/CodeGenSchedule.cpp b/utils/TableGen/CodeGenSchedule.cpp index 001e97d1e1..a857a20417 100644 --- a/utils/TableGen/CodeGenSchedule.cpp +++ b/utils/TableGen/CodeGenSchedule.cpp @@ -38,12 +38,15 @@ static void dumpIdxVec(const SmallVectorImpl<unsigned> &V) { // (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp. struct InstrsOp : public SetTheory::Operator { - void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef<SMLoc> Loc) { - ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc); - } + virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> Loc); }; +void InstrsOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> Loc) { + ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc); +} + // (instregex "OpcPat",...) Find all instructions matching an opcode pattern. // // TODO: Since this is a prefix match, perform a binary search over the @@ -56,34 +59,37 @@ struct InstRegexOp : public SetTheory::Operator { const CodeGenTarget &Target; InstRegexOp(const CodeGenTarget &t): Target(t) {} - void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef<SMLoc> Loc) { - SmallVector<Regex*, 4> RegexList; - for (DagInit::const_arg_iterator - AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) { - StringInit *SI = dyn_cast<StringInit>(*AI); - if (!SI) - PrintFatalError(Loc, "instregex requires pattern string: " - + Expr->getAsString()); - std::string pat = SI->getValue(); - // Implement a python-style prefix match. - if (pat[0] != '^') { - pat.insert(0, "^("); - pat.insert(pat.end(), ')'); - } - RegexList.push_back(new Regex(pat)); - } - for (CodeGenTarget::inst_iterator I = Target.inst_begin(), - E = Target.inst_end(); I != E; ++I) { - for (SmallVectorImpl<Regex*>::iterator - RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) { - if ((*RI)->match((*I)->TheDef->getName())) - Elts.insert((*I)->TheDef); - } + virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> Loc); +}; + +void InstRegexOp::apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef<SMLoc> Loc) { + SmallVector<Regex*, 4> RegexList; + for (DagInit::const_arg_iterator + AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) { + StringInit *SI = dyn_cast<StringInit>(*AI); + if (!SI) + PrintFatalError(Loc, "instregex requires pattern string: " + + Expr->getAsString()); + std::string pat = SI->getValue(); + // Implement a python-style prefix match. + if (pat[0] != '^') { + pat.insert(0, "^("); + pat.insert(pat.end(), ')'); + } + RegexList.push_back(new Regex(pat)); + } + for (CodeGenTarget::inst_iterator I = Target.inst_begin(), + E = Target.inst_end(); I != E; ++I) { + for (SmallVectorImpl<Regex*>::iterator + RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) { + if ((*RI)->match((*I)->TheDef->getName())) + Elts.insert((*I)->TheDef); } - DeleteContainerPointers(RegexList); } -}; + DeleteContainerPointers(RegexList); +} /// CodeGenModels ctor interprets machine model records and populates maps. CodeGenSchedModels::CodeGenSchedModels(RecordKeeper &RK, |