summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/FastISelEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-18 06:36:55 +0000
committerChris Lattner <sabre@nondot.org>2011-04-18 06:36:55 +0000
commit80254a53cc428b59bada353ab552af466bc5c63b (patch)
treebd275d48dfab0aa5b26ceae0796c772409f3d5f6 /llvm/utils/TableGen/FastISelEmitter.cpp
parent07add49a4ba2b296ad1da2aa0eeb51e0edbd7ec4 (diff)
downloadbcm5719-llvm-80254a53cc428b59bada353ab552af466bc5c63b.tar.gz
bcm5719-llvm-80254a53cc428b59bada353ab552af466bc5c63b.zip
Add a new bit that ImmLeaf's can opt into, which allows them to duck out of
the generated FastISel. X86 doesn't need to generate code to match ADD16ri8 since ADD16ri will do just fine. This is a small codesize win in the generated instruction selector. llvm-svn: 129692
Diffstat (limited to 'llvm/utils/TableGen/FastISelEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/FastISelEmitter.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp
index ce821765a2c..e3d47aa49a0 100644
--- a/llvm/utils/TableGen/FastISelEmitter.cpp
+++ b/llvm/utils/TableGen/FastISelEmitter.cpp
@@ -190,14 +190,22 @@ struct OperandsSignature {
if (!Op->isLeaf() && Op->getOperator()->getName() == "imm") {
unsigned PredNo = 0;
if (!Op->getPredicateFns().empty()) {
+ TreePredicateFn PredFn = Op->getPredicateFns()[0];
// If there is more than one predicate weighing in on this operand
// then we don't handle it. This doesn't typically happen for
// immediates anyway.
if (Op->getPredicateFns().size() > 1 ||
- !Op->getPredicateFns()[0].isImmediatePattern())
+ !PredFn.isImmediatePattern())
+ return false;
+ // Ignore any instruction with 'FastIselShouldIgnore', these are
+ // not needed and just bloat the fast instruction selector. For
+ // example, X86 doesn't need to generate code to match ADD16ri8 since
+ // ADD16ri will do just fine.
+ Record *Rec = PredFn.getOrigPatFragRecord()->getRecord();
+ if (Rec->getValueAsBit("FastIselShouldIgnore"))
return false;
- PredNo = ImmediatePredicates.getIDFor(Op->getPredicateFns()[0])+1;
+ PredNo = ImmediatePredicates.getIDFor(PredFn)+1;
}
// Handle unmatched immediate sizes here.
OpenPOWER on IntegriCloud