Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-07-22 06:32:12 +0400
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-07-22 06:32:12 +0400
commita0cc1654ced43274ae31bf5a0f9d23301e53bbf3 (patch)
treeff41d294ecd021638732a47bbb27d965cab52e2c
parent202aac174abaaab0fcd1616f4728d11111441efa (diff)
Revert of r213521. This change introduced a non-hermetic test (depending on a
file not in the test/ area). Backing out now so that this test isn't part of the 3.5 branch. Original commit message: "TableGen: Allow AddedComplexity values to be negative [...]" llvm-svn: 213596
-rw-r--r--llvm/test/TableGen/NegativeAddedComplexity.ll41
-rw-r--r--llvm/utils/TableGen/CodeGenDAGPatterns.cpp2
-rw-r--r--llvm/utils/TableGen/CodeGenDAGPatterns.h8
-rw-r--r--llvm/utils/TableGen/DAGISelEmitter.cpp4
4 files changed, 7 insertions, 48 deletions
diff --git a/llvm/test/TableGen/NegativeAddedComplexity.ll b/llvm/test/TableGen/NegativeAddedComplexity.ll
deleted file mode 100644
index 54c52ab3b649..000000000000
--- a/llvm/test/TableGen/NegativeAddedComplexity.ll
+++ /dev/null
@@ -1,41 +0,0 @@
-// RUN: llvm-tblgen -I../../include -gen-dag-isel %s | FileCheck %s
-// XFAIL: vg_leak
-
-include "llvm/Target/Target.td"
-
-// Make sure the higher complexity pattern comes first
-// CHECK: TARGET_VAL(::ADD0)
-// CHECK: Complexity = {{[^-]}}
-// Make sure the ADD1 pattern has a negative complexity
-// CHECK: TARGET_VAL(::ADD1)
-// CHECK: Complexity = -{{[0-9]+}}
-
-def TestRC : RegisterClass<"TEST", [i32], 32, (add)>;
-
-def TestInstrInfo : InstrInfo;
-
-def Test : Target {
- let InstructionSet = TestInstrInfo;
-}
-
-def ADD0 : Instruction {
- let OutOperandList = (outs TestRC:$dst);
- let InOperandList = (ins TestRC:$src0, TestRC:$src1);
-}
-
-def ADD1 : Instruction {
- let OutOperandList = (outs TestRC:$dst);
- let InOperandList = (ins TestRC:$src0, TestRC:$src1);
-}
-
-def : Pat <
- (add i32:$src0, i32:$src1),
- (ADD1 $src0, $src1)
-> {
- let AddedComplexity = -1000;
-}
-
-def : Pat <
- (add i32:$src0, i32:$src1),
- (ADD0 $src0, $src1)
->;
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index d195ba823b5b..2602bbcf6f61 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -771,7 +771,7 @@ static unsigned getPatternSize(const TreePatternNode *P,
/// Compute the complexity metric for the input pattern. This roughly
/// corresponds to the number of nodes that are covered.
-int PatternToMatch::
+unsigned PatternToMatch::
getPatternComplexity(const CodeGenDAGPatterns &CGP) const {
return getPatternSize(getSrcPattern(), CGP) + getAddedComplexity();
}
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h
index ef6c787c3e08..fb30cdd94853 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -667,7 +667,7 @@ public:
PatternToMatch(Record *srcrecord, ListInit *preds,
TreePatternNode *src, TreePatternNode *dst,
const std::vector<Record*> &dstregs,
- int complexity, unsigned uid)
+ unsigned complexity, unsigned uid)
: SrcRecord(srcrecord), Predicates(preds), SrcPattern(src), DstPattern(dst),
Dstregs(dstregs), AddedComplexity(complexity), ID(uid) {}
@@ -676,7 +676,7 @@ public:
TreePatternNode *SrcPattern; // Source pattern to match.
TreePatternNode *DstPattern; // Resulting pattern.
std::vector<Record*> Dstregs; // Physical register defs being matched.
- int AddedComplexity; // Add to matching pattern complexity.
+ unsigned AddedComplexity; // Add to matching pattern complexity.
unsigned ID; // Unique ID for the record.
Record *getSrcRecord() const { return SrcRecord; }
@@ -684,13 +684,13 @@ public:
TreePatternNode *getSrcPattern() const { return SrcPattern; }
TreePatternNode *getDstPattern() const { return DstPattern; }
const std::vector<Record*> &getDstRegs() const { return Dstregs; }
- int getAddedComplexity() const { return AddedComplexity; }
+ unsigned getAddedComplexity() const { return AddedComplexity; }
std::string getPredicateCheck() const;
/// Compute the complexity metric for the input pattern. This roughly
/// corresponds to the number of nodes that are covered.
- int getPatternComplexity(const CodeGenDAGPatterns &CGP) const;
+ unsigned getPatternComplexity(const CodeGenDAGPatterns &CGP) const;
};
class CodeGenDAGPatterns {
diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp
index e2e6ab19cba4..82682cd5a5ad 100644
--- a/llvm/utils/TableGen/DAGISelEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelEmitter.cpp
@@ -94,8 +94,8 @@ struct PatternSortingPredicate {
// Otherwise, if the patterns might both match, sort based on complexity,
// which means that we prefer to match patterns that cover more nodes in the
// input over nodes that cover fewer.
- int LHSSize = LHS->getPatternComplexity(CGP);
- int RHSSize = RHS->getPatternComplexity(CGP);
+ unsigned LHSSize = LHS->getPatternComplexity(CGP);
+ unsigned RHSSize = RHS->getPatternComplexity(CGP);
if (LHSSize > RHSSize) return true; // LHS -> bigger -> less cost
if (LHSSize < RHSSize) return false;