2014-11-03 00:46:44 +01:00
|
|
|
//===- DAGISelMatcher.h - Representation of DAG pattern matcher -*- C++ -*-===//
|
2010-02-15 09:04:42 +01:00
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-02-15 09:04:42 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#ifndef LLVM_UTILS_TABLEGEN_DAGISELMATCHER_H
|
|
|
|
#define LLVM_UTILS_TABLEGEN_DAGISELMATCHER_H
|
2010-02-15 09:04:42 +01:00
|
|
|
|
2014-01-21 08:20:05 +01:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2012-12-04 11:37:14 +01:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2010-02-16 08:21:10 +01:00
|
|
|
#include "llvm/Support/Casting.h"
|
2018-03-24 00:58:25 +01:00
|
|
|
#include "llvm/Support/MachineValueType.h"
|
2010-02-15 09:04:42 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
2011-03-11 03:19:02 +01:00
|
|
|
struct CodeGenRegister;
|
2010-02-15 09:04:42 +01:00
|
|
|
class CodeGenDAGPatterns;
|
2010-02-25 03:04:40 +01:00
|
|
|
class Matcher;
|
2010-02-15 09:04:42 +01:00
|
|
|
class PatternToMatch;
|
|
|
|
class raw_ostream;
|
|
|
|
class ComplexPattern;
|
2010-02-18 23:03:03 +01:00
|
|
|
class Record;
|
2010-02-27 22:48:43 +01:00
|
|
|
class SDNodeInfo;
|
2011-04-17 23:38:24 +02:00
|
|
|
class TreePredicateFn;
|
|
|
|
class TreePattern;
|
2010-02-15 09:04:42 +01:00
|
|
|
|
2010-03-01 08:17:40 +01:00
|
|
|
Matcher *ConvertPatternToMatcher(const PatternToMatch &Pattern,unsigned Variant,
|
2010-02-25 03:04:40 +01:00
|
|
|
const CodeGenDAGPatterns &CGP);
|
2014-12-15 01:40:07 +01:00
|
|
|
void OptimizeMatcher(std::unique_ptr<Matcher> &Matcher,
|
|
|
|
const CodeGenDAGPatterns &CGP);
|
2020-11-16 20:24:25 +01:00
|
|
|
void EmitMatcherTable(Matcher *Matcher, const CodeGenDAGPatterns &CGP,
|
2011-03-11 03:19:02 +01:00
|
|
|
raw_ostream &OS);
|
2010-02-15 09:04:42 +01:00
|
|
|
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2012-07-23 10:51:15 +02:00
|
|
|
/// Matcher - Base class for all the DAG ISel Matcher representation
|
2010-02-15 09:04:42 +01:00
|
|
|
/// nodes.
|
2010-02-25 03:04:40 +01:00
|
|
|
class Matcher {
|
2010-02-18 03:53:41 +01:00
|
|
|
// The next matcher node that is executed after this one. Null if this is the
|
|
|
|
// last stage of a match.
|
2014-03-06 06:51:42 +01:00
|
|
|
std::unique_ptr<Matcher> Next;
|
2020-11-16 20:24:25 +01:00
|
|
|
size_t Size; // Size in bytes of matcher and all its children (if any).
|
2011-12-20 03:50:00 +01:00
|
|
|
virtual void anchor();
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
|
|
|
enum KindTy {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
// Matcher state manipulation.
|
2010-02-25 02:56:48 +01:00
|
|
|
Scope, // Push a checking scope.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
RecordNode, // Record the current node.
|
2010-02-24 08:31:45 +01:00
|
|
|
RecordChild, // Record a child of the current node.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
RecordMemRef, // Record the memref in the current node.
|
2010-12-23 18:03:20 +01:00
|
|
|
CaptureGlueInput, // If the current node has an input glue, save it.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
MoveChild, // Move current node to specified child.
|
|
|
|
MoveParent, // Move current node to parent.
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-18 23:03:03 +01:00
|
|
|
// Predicate checking.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
CheckSame, // Fail if not same as prev match.
|
2013-10-05 07:38:16 +02:00
|
|
|
CheckChildSame, // Fail if child not same as prev match.
|
2010-02-15 09:04:42 +01:00
|
|
|
CheckPatternPredicate,
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
CheckPredicate, // Fail if node predicate fails.
|
|
|
|
CheckOpcode, // Fail if not opcode.
|
2010-03-01 07:59:22 +01:00
|
|
|
SwitchOpcode, // Dispatch based on opcode.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
CheckType, // Fail if not correct type.
|
2010-03-03 07:28:15 +01:00
|
|
|
SwitchType, // Dispatch based on type.
|
2010-02-24 21:15:25 +01:00
|
|
|
CheckChildType, // Fail if child has wrong type.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
CheckInteger, // Fail if wrong val.
|
2014-02-05 06:44:28 +01:00
|
|
|
CheckChildInteger, // Fail if child is wrong val.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
CheckCondCode, // Fail if not condcode.
|
2019-02-25 04:11:44 +01:00
|
|
|
CheckChild2CondCode, // Fail if child is wrong condcode.
|
2010-02-15 09:04:42 +01:00
|
|
|
CheckValueType,
|
|
|
|
CheckComplexPat,
|
|
|
|
CheckAndImm,
|
2010-02-16 07:10:58 +01:00
|
|
|
CheckOrImm,
|
2019-03-10 06:21:52 +01:00
|
|
|
CheckImmAllOnesV,
|
|
|
|
CheckImmAllZerosV,
|
2010-02-17 07:23:39 +01:00
|
|
|
CheckFoldableChainNode,
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-18 23:03:03 +01:00
|
|
|
// Node creation/emisssion.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
EmitInteger, // Create a TargetConstant
|
|
|
|
EmitStringInteger, // Create a TargetConstant from a string.
|
|
|
|
EmitRegister, // Create a register.
|
|
|
|
EmitConvertToTarget, // Convert a imm/fpimm to target imm/fpimm
|
|
|
|
EmitMergeInputChains, // Merge together a chains for an input.
|
|
|
|
EmitCopyToReg, // Emit a copytoreg into a physreg.
|
|
|
|
EmitNode, // Create a DAG node
|
|
|
|
EmitNodeXForm, // Run a SDNodeXForm
|
2010-02-28 03:31:26 +01:00
|
|
|
CompleteMatch, // Finish a match and update the results.
|
2020-11-16 20:24:25 +01:00
|
|
|
MorphNodeTo, // Build a node, finish a match and update results.
|
|
|
|
|
|
|
|
// Highest enum value; watch out when adding more.
|
|
|
|
HighestKind = MorphNodeTo
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
|
|
|
const KindTy Kind;
|
2010-02-18 03:49:24 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
protected:
|
2010-02-25 03:04:40 +01:00
|
|
|
Matcher(KindTy K) : Kind(K) {}
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
virtual ~Matcher() {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2020-11-16 20:24:25 +01:00
|
|
|
unsigned getSize() const { return Size; }
|
|
|
|
void setSize(unsigned sz) { Size = sz; }
|
2010-02-15 09:04:42 +01:00
|
|
|
KindTy getKind() const { return Kind; }
|
2010-02-18 03:49:24 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
Matcher *getNext() { return Next.get(); }
|
|
|
|
const Matcher *getNext() const { return Next.get(); }
|
|
|
|
void setNext(Matcher *C) { Next.reset(C); }
|
2014-03-05 11:19:29 +01:00
|
|
|
Matcher *takeNext() { return Next.release(); }
|
2010-02-24 08:31:45 +01:00
|
|
|
|
2014-03-06 06:51:42 +01:00
|
|
|
std::unique_ptr<Matcher> &getNextPtr() { return Next; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
bool isEqual(const Matcher *M) const {
|
|
|
|
if (getKind() != M->getKind()) return false;
|
|
|
|
return isEqualImpl(M);
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-07 07:29:26 +01:00
|
|
|
/// isSimplePredicateNode - Return true if this is a simple predicate that
|
|
|
|
/// operates on the node or its children without potential side effects or a
|
|
|
|
/// change of the current node.
|
|
|
|
bool isSimplePredicateNode() const {
|
|
|
|
switch (getKind()) {
|
|
|
|
default: return false;
|
|
|
|
case CheckSame:
|
2013-10-05 07:38:16 +02:00
|
|
|
case CheckChildSame:
|
2010-03-07 07:29:26 +01:00
|
|
|
case CheckPatternPredicate:
|
|
|
|
case CheckPredicate:
|
|
|
|
case CheckOpcode:
|
|
|
|
case CheckType:
|
|
|
|
case CheckChildType:
|
|
|
|
case CheckInteger:
|
2014-02-05 06:44:28 +01:00
|
|
|
case CheckChildInteger:
|
2010-03-07 07:29:26 +01:00
|
|
|
case CheckCondCode:
|
2019-02-25 04:11:44 +01:00
|
|
|
case CheckChild2CondCode:
|
2010-03-07 07:29:26 +01:00
|
|
|
case CheckValueType:
|
|
|
|
case CheckAndImm:
|
|
|
|
case CheckOrImm:
|
2019-03-10 06:21:52 +01:00
|
|
|
case CheckImmAllOnesV:
|
|
|
|
case CheckImmAllZerosV:
|
2010-03-07 07:29:26 +01:00
|
|
|
case CheckFoldableChainNode:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-07 07:29:26 +01:00
|
|
|
/// isSimplePredicateOrRecordNode - Return true if this is a record node or
|
|
|
|
/// a simple predicate.
|
|
|
|
bool isSimplePredicateOrRecordNode() const {
|
|
|
|
return isSimplePredicateNode() ||
|
|
|
|
getKind() == RecordNode || getKind() == RecordChild;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-07 07:29:26 +01:00
|
|
|
/// unlinkNode - Unlink the specified node from this chain. If Other == this,
|
|
|
|
/// we unlink the next pointer and return it. Otherwise we unlink Other from
|
|
|
|
/// the list and return this.
|
|
|
|
Matcher *unlinkNode(Matcher *Other);
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-07 07:29:26 +01:00
|
|
|
/// canMoveBefore - Return true if this matcher is the same as Other, or if
|
|
|
|
/// we can move this matcher past all of the nodes in-between Other and this
|
|
|
|
/// node. Other must be equal to or before this.
|
|
|
|
bool canMoveBefore(const Matcher *Other) const;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2013-09-25 08:40:22 +02:00
|
|
|
/// canMoveBeforeNode - Return true if it is safe to move the current matcher
|
2010-03-07 07:29:26 +01:00
|
|
|
/// across the specified one.
|
|
|
|
bool canMoveBeforeNode(const Matcher *Other) const;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-27 08:49:13 +01:00
|
|
|
/// isContradictory - Return true of these two matchers could never match on
|
|
|
|
/// the same node.
|
|
|
|
bool isContradictory(const Matcher *Other) const {
|
|
|
|
// Since this predicate is reflexive, we canonicalize the ordering so that
|
|
|
|
// we always match a node against nodes with kinds that are greater or equal
|
|
|
|
// to them. For example, we'll pass in a CheckType node as an argument to
|
|
|
|
// the CheckOpcode method, not the other way around.
|
|
|
|
if (getKind() < Other->getKind())
|
|
|
|
return isContradictoryImpl(Other);
|
|
|
|
return Other->isContradictoryImpl(this);
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:53:39 +01:00
|
|
|
void print(raw_ostream &OS, unsigned indent = 0) const;
|
2010-02-27 08:49:13 +01:00
|
|
|
void printOne(raw_ostream &OS) const;
|
2010-02-15 09:04:42 +01:00
|
|
|
void dump() const;
|
2010-02-18 03:49:24 +01:00
|
|
|
protected:
|
2010-02-25 07:53:39 +01:00
|
|
|
virtual void printImpl(raw_ostream &OS, unsigned indent) const = 0;
|
2010-02-25 07:49:58 +01:00
|
|
|
virtual bool isEqualImpl(const Matcher *M) const = 0;
|
2010-02-27 08:49:13 +01:00
|
|
|
virtual bool isContradictoryImpl(const Matcher *M) const { return false; }
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 20:00:39 +01:00
|
|
|
/// ScopeMatcher - This attempts to match each of its children to find the first
|
|
|
|
/// one that successfully matches. If one child fails, it tries the next child.
|
|
|
|
/// If none of the children match then this check fails. It never has a 'next'.
|
2010-02-25 03:04:40 +01:00
|
|
|
class ScopeMatcher : public Matcher {
|
2010-02-25 20:00:39 +01:00
|
|
|
SmallVector<Matcher*, 4> Children;
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
2014-01-21 08:20:05 +01:00
|
|
|
ScopeMatcher(ArrayRef<Matcher *> children)
|
|
|
|
: Matcher(Scope), Children(children.begin(), children.end()) {
|
2010-02-15 09:04:42 +01:00
|
|
|
}
|
2015-04-11 04:11:45 +02:00
|
|
|
~ScopeMatcher() override;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 20:00:39 +01:00
|
|
|
unsigned getNumChildren() const { return Children.size(); }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 20:00:39 +01:00
|
|
|
Matcher *getChild(unsigned i) { return Children[i]; }
|
|
|
|
const Matcher *getChild(unsigned i) const { return Children[i]; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 20:00:39 +01:00
|
|
|
void resetChild(unsigned i, Matcher *N) {
|
|
|
|
delete Children[i];
|
|
|
|
Children[i] = N;
|
|
|
|
}
|
|
|
|
|
|
|
|
Matcher *takeChild(unsigned i) {
|
|
|
|
Matcher *Res = Children[i];
|
2014-04-16 06:21:27 +02:00
|
|
|
Children[i] = nullptr;
|
2010-02-25 20:00:39 +01:00
|
|
|
return Res;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-26 08:35:27 +01:00
|
|
|
void setNumChildren(unsigned NC) {
|
|
|
|
if (NC < Children.size()) {
|
|
|
|
// delete any children we're about to lose pointers to.
|
|
|
|
for (unsigned i = NC, e = Children.size(); i != e; ++i)
|
|
|
|
delete Children[i];
|
|
|
|
}
|
|
|
|
Children.resize(NC);
|
|
|
|
}
|
2010-02-15 09:04:42 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-25 02:56:48 +01:00
|
|
|
return N->getKind() == Scope;
|
2010-02-15 09:04:42 +01:00
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return false; }
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// RecordMatcher - Save the current node in the operand list.
|
|
|
|
class RecordMatcher : public Matcher {
|
2010-02-17 02:03:09 +01:00
|
|
|
/// WhatFor - This is a string indicating why we're recording this. This
|
|
|
|
/// should only be used for comment generation not anything semantic.
|
|
|
|
std::string WhatFor;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-01 03:24:17 +01:00
|
|
|
/// ResultNo - The slot number in the RecordedNodes vector that this will be,
|
|
|
|
/// just printed as a comment.
|
|
|
|
unsigned ResultNo;
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
2010-03-01 03:24:17 +01:00
|
|
|
RecordMatcher(const std::string &whatfor, unsigned resultNo)
|
|
|
|
: Matcher(RecordNode), WhatFor(whatfor), ResultNo(resultNo) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-17 02:27:29 +01:00
|
|
|
const std::string &getWhatFor() const { return WhatFor; }
|
2010-03-01 03:24:17 +01:00
|
|
|
unsigned getResultNo() const { return ResultNo; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-18 23:03:03 +01:00
|
|
|
return N->getKind() == RecordNode;
|
2010-02-15 09:04:42 +01:00
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return true; }
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// RecordChildMatcher - Save a numbered child of the current node, or fail
|
2010-02-24 08:31:45 +01:00
|
|
|
/// the match if it doesn't exist. This is logically equivalent to:
|
|
|
|
/// MoveChild N + RecordNode + MoveParent.
|
2010-02-25 03:04:40 +01:00
|
|
|
class RecordChildMatcher : public Matcher {
|
2010-02-24 08:31:45 +01:00
|
|
|
unsigned ChildNo;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-24 08:31:45 +01:00
|
|
|
/// WhatFor - This is a string indicating why we're recording this. This
|
|
|
|
/// should only be used for comment generation not anything semantic.
|
|
|
|
std::string WhatFor;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-01 03:24:17 +01:00
|
|
|
/// ResultNo - The slot number in the RecordedNodes vector that this will be,
|
|
|
|
/// just printed as a comment.
|
|
|
|
unsigned ResultNo;
|
2010-02-24 08:31:45 +01:00
|
|
|
public:
|
2010-03-01 03:24:17 +01:00
|
|
|
RecordChildMatcher(unsigned childno, const std::string &whatfor,
|
|
|
|
unsigned resultNo)
|
|
|
|
: Matcher(RecordChild), ChildNo(childno), WhatFor(whatfor),
|
|
|
|
ResultNo(resultNo) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-24 08:31:45 +01:00
|
|
|
unsigned getChildNo() const { return ChildNo; }
|
|
|
|
const std::string &getWhatFor() const { return WhatFor; }
|
2010-03-01 03:24:17 +01:00
|
|
|
unsigned getResultNo() const { return ResultNo; }
|
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-24 08:31:45 +01:00
|
|
|
return N->getKind() == RecordChild;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<RecordChildMatcher>(M)->getChildNo() == getChildNo();
|
|
|
|
}
|
2010-02-24 08:31:45 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// RecordMemRefMatcher - Save the current node's memref.
|
|
|
|
class RecordMemRefMatcher : public Matcher {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
RecordMemRefMatcher() : Matcher(RecordMemRef) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
return N->getKind() == RecordMemRef;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return true; }
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
};
|
|
|
|
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-12-23 18:03:20 +01:00
|
|
|
/// CaptureGlueInputMatcher - If the current record has a glue input, record
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
/// it so that it is used as an input to the generated code.
|
2010-12-23 18:03:20 +01:00
|
|
|
class CaptureGlueInputMatcher : public Matcher {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
public:
|
2010-12-23 18:03:20 +01:00
|
|
|
CaptureGlueInputMatcher() : Matcher(CaptureGlueInput) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-12-23 18:03:20 +01:00
|
|
|
return N->getKind() == CaptureGlueInput;
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return true; }
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// MoveChildMatcher - This tells the interpreter to move into the
|
2010-02-15 09:04:42 +01:00
|
|
|
/// specified child node.
|
2010-02-25 03:04:40 +01:00
|
|
|
class MoveChildMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
unsigned ChildNo;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
MoveChildMatcher(unsigned childNo) : Matcher(MoveChild), ChildNo(childNo) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
unsigned getChildNo() const { return ChildNo; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == MoveChild;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<MoveChildMatcher>(M)->getChildNo() == getChildNo();
|
|
|
|
}
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// MoveParentMatcher - This tells the interpreter to move to the parent
|
2010-02-15 09:04:42 +01:00
|
|
|
/// of the current node.
|
2010-02-25 03:04:40 +01:00
|
|
|
class MoveParentMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
MoveParentMatcher() : Matcher(MoveParent) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == MoveParent;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return true; }
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckSameMatcher - This checks to see if this node is exactly the same
|
2010-02-15 09:04:42 +01:00
|
|
|
/// node as the specified match that was recorded with 'Record'. This is used
|
|
|
|
/// when patterns have the same name in them, like '(mul GPR:$in, GPR:$in)'.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckSameMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
unsigned MatchNumber;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckSameMatcher(unsigned matchnumber)
|
2010-02-25 07:49:58 +01:00
|
|
|
: Matcher(CheckSame), MatchNumber(matchnumber) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
unsigned getMatchNumber() const { return MatchNumber; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckSame;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CheckSameMatcher>(M)->getMatchNumber() == getMatchNumber();
|
|
|
|
}
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2013-10-05 07:38:16 +02:00
|
|
|
/// CheckChildSameMatcher - This checks to see if child node is exactly the same
|
|
|
|
/// node as the specified match that was recorded with 'Record'. This is used
|
|
|
|
/// when patterns have the same name in them, like '(mul GPR:$in, GPR:$in)'.
|
|
|
|
class CheckChildSameMatcher : public Matcher {
|
|
|
|
unsigned ChildNo;
|
|
|
|
unsigned MatchNumber;
|
|
|
|
public:
|
|
|
|
CheckChildSameMatcher(unsigned childno, unsigned matchnumber)
|
|
|
|
: Matcher(CheckChildSame), ChildNo(childno), MatchNumber(matchnumber) {}
|
|
|
|
|
|
|
|
unsigned getChildNo() const { return ChildNo; }
|
|
|
|
unsigned getMatchNumber() const { return MatchNumber; }
|
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2013-10-05 07:38:16 +02:00
|
|
|
return N->getKind() == CheckChildSame;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2013-10-05 07:38:16 +02:00
|
|
|
return cast<CheckChildSameMatcher>(M)->ChildNo == ChildNo &&
|
|
|
|
cast<CheckChildSameMatcher>(M)->MatchNumber == MatchNumber;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckPatternPredicateMatcher - This checks the target-specific predicate
|
2010-02-15 09:04:42 +01:00
|
|
|
/// to see if the entire pattern is capable of matching. This predicate does
|
|
|
|
/// not take a node as input. This is used for subtarget feature checks etc.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckPatternPredicateMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
std::string Predicate;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckPatternPredicateMatcher(StringRef predicate)
|
2010-02-25 07:49:58 +01:00
|
|
|
: Matcher(CheckPatternPredicate), Predicate(predicate) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
StringRef getPredicate() const { return Predicate; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckPatternPredicate;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CheckPatternPredicateMatcher>(M)->getPredicate() == Predicate;
|
|
|
|
}
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckPredicateMatcher - This checks the target-specific predicate to
|
2010-02-15 09:04:42 +01:00
|
|
|
/// see if the node is acceptable.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckPredicateMatcher : public Matcher {
|
2011-04-17 23:38:24 +02:00
|
|
|
TreePattern *Pred;
|
TableGen/ISel: Allow PatFrag predicate code to access captured operands
Summary:
This simplifies writing predicates for pattern fragments that are
automatically re-associated or commuted.
For example, a followup patch adds patterns for fragments of the form
(add (shl $x, $y), $z) to the AMDGPU backend. Such patterns are
automatically commuted to (add $z, (shl $x, $y)), which makes it basically
impossible to refer to $x, $y, and $z generically in the PredicateCode.
With this change, the PredicateCode can refer to $x, $y, and $z simply
as `Operands[i]`.
Test confirmed that there are no changes to any of the generated files
when building all (non-experimental) targets.
Change-Id: I61c00ace7eed42c1d4edc4c5351174b56b77a79c
Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand
Subscribers: wdng, tpr, llvm-commits
Differential Revision: https://reviews.llvm.org/D51994
llvm-svn: 347992
2018-11-30 15:15:13 +01:00
|
|
|
const SmallVector<unsigned, 4> Operands;
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
TableGen/ISel: Allow PatFrag predicate code to access captured operands
Summary:
This simplifies writing predicates for pattern fragments that are
automatically re-associated or commuted.
For example, a followup patch adds patterns for fragments of the form
(add (shl $x, $y), $z) to the AMDGPU backend. Such patterns are
automatically commuted to (add $z, (shl $x, $y)), which makes it basically
impossible to refer to $x, $y, and $z generically in the PredicateCode.
With this change, the PredicateCode can refer to $x, $y, and $z simply
as `Operands[i]`.
Test confirmed that there are no changes to any of the generated files
when building all (non-experimental) targets.
Change-Id: I61c00ace7eed42c1d4edc4c5351174b56b77a79c
Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand
Subscribers: wdng, tpr, llvm-commits
Differential Revision: https://reviews.llvm.org/D51994
llvm-svn: 347992
2018-11-30 15:15:13 +01:00
|
|
|
CheckPredicateMatcher(const TreePredicateFn &pred,
|
|
|
|
const SmallVectorImpl<unsigned> &Operands);
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2011-04-17 23:38:24 +02:00
|
|
|
TreePredicateFn getPredicate() const;
|
TableGen/ISel: Allow PatFrag predicate code to access captured operands
Summary:
This simplifies writing predicates for pattern fragments that are
automatically re-associated or commuted.
For example, a followup patch adds patterns for fragments of the form
(add (shl $x, $y), $z) to the AMDGPU backend. Such patterns are
automatically commuted to (add $z, (shl $x, $y)), which makes it basically
impossible to refer to $x, $y, and $z generically in the PredicateCode.
With this change, the PredicateCode can refer to $x, $y, and $z simply
as `Operands[i]`.
Test confirmed that there are no changes to any of the generated files
when building all (non-experimental) targets.
Change-Id: I61c00ace7eed42c1d4edc4c5351174b56b77a79c
Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand
Subscribers: wdng, tpr, llvm-commits
Differential Revision: https://reviews.llvm.org/D51994
llvm-svn: 347992
2018-11-30 15:15:13 +01:00
|
|
|
unsigned getNumOperands() const;
|
|
|
|
unsigned getOperandNo(unsigned i) const;
|
2010-02-15 09:04:42 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckPredicate;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2011-04-17 23:38:24 +02:00
|
|
|
return cast<CheckPredicateMatcher>(M)->Pred == Pred;
|
2010-02-25 07:49:58 +01:00
|
|
|
}
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckOpcodeMatcher - This checks to see if the current node has the
|
2010-02-15 09:04:42 +01:00
|
|
|
/// specified opcode, if not it fails to match.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckOpcodeMatcher : public Matcher {
|
2010-02-27 22:48:43 +01:00
|
|
|
const SDNodeInfo &Opcode;
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
2010-02-27 22:48:43 +01:00
|
|
|
CheckOpcodeMatcher(const SDNodeInfo &opcode)
|
|
|
|
: Matcher(CheckOpcode), Opcode(opcode) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-27 22:48:43 +01:00
|
|
|
const SDNodeInfo &getOpcode() const { return Opcode; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckOpcode;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override;
|
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-03-01 07:59:22 +01:00
|
|
|
|
|
|
|
/// SwitchOpcodeMatcher - Switch based on the current node's opcode, dispatching
|
|
|
|
/// to one matcher per opcode. If the opcode doesn't match any of the cases,
|
|
|
|
/// then the match fails. This is semantically equivalent to a Scope node where
|
|
|
|
/// every child does a CheckOpcode, but is much faster.
|
|
|
|
class SwitchOpcodeMatcher : public Matcher {
|
|
|
|
SmallVector<std::pair<const SDNodeInfo*, Matcher*>, 8> Cases;
|
|
|
|
public:
|
2014-01-21 08:20:05 +01:00
|
|
|
SwitchOpcodeMatcher(ArrayRef<std::pair<const SDNodeInfo*, Matcher*> > cases)
|
|
|
|
: Matcher(SwitchOpcode), Cases(cases.begin(), cases.end()) {}
|
2015-04-11 04:11:45 +02:00
|
|
|
~SwitchOpcodeMatcher() override;
|
2010-03-01 07:59:22 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-03-01 07:59:22 +01:00
|
|
|
return N->getKind() == SwitchOpcode;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-01 07:59:22 +01:00
|
|
|
unsigned getNumCases() const { return Cases.size(); }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-01 07:59:22 +01:00
|
|
|
const SDNodeInfo &getCaseOpcode(unsigned i) const { return *Cases[i].first; }
|
|
|
|
Matcher *getCaseMatcher(unsigned i) { return Cases[i].second; }
|
|
|
|
const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-01 07:59:22 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return false; }
|
2010-03-01 07:59:22 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckTypeMatcher - This checks to see if the current node has the
|
2010-03-24 01:41:19 +01:00
|
|
|
/// specified type at the specified result, if not it fails to match.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckTypeMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
MVT::SimpleValueType Type;
|
2010-03-24 01:41:19 +01:00
|
|
|
unsigned ResNo;
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
2010-03-24 01:41:19 +01:00
|
|
|
CheckTypeMatcher(MVT::SimpleValueType type, unsigned resno)
|
|
|
|
: Matcher(CheckType), Type(type), ResNo(resno) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
MVT::SimpleValueType getType() const { return Type; }
|
2010-03-24 01:41:19 +01:00
|
|
|
unsigned getResNo() const { return ResNo; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckType;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-26 09:05:36 +01:00
|
|
|
return cast<CheckTypeMatcher>(M)->Type == Type;
|
2010-02-25 07:49:58 +01:00
|
|
|
}
|
2014-03-05 06:17:42 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-03 07:28:15 +01:00
|
|
|
/// SwitchTypeMatcher - Switch based on the current node's type, dispatching
|
|
|
|
/// to one matcher per case. If the type doesn't match any of the cases,
|
|
|
|
/// then the match fails. This is semantically equivalent to a Scope node where
|
|
|
|
/// every child does a CheckType, but is much faster.
|
|
|
|
class SwitchTypeMatcher : public Matcher {
|
|
|
|
SmallVector<std::pair<MVT::SimpleValueType, Matcher*>, 8> Cases;
|
|
|
|
public:
|
2014-01-21 08:20:05 +01:00
|
|
|
SwitchTypeMatcher(ArrayRef<std::pair<MVT::SimpleValueType, Matcher*> > cases)
|
|
|
|
: Matcher(SwitchType), Cases(cases.begin(), cases.end()) {}
|
2015-04-11 04:11:45 +02:00
|
|
|
~SwitchTypeMatcher() override;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-03-03 07:28:15 +01:00
|
|
|
return N->getKind() == SwitchType;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-03 07:28:15 +01:00
|
|
|
unsigned getNumCases() const { return Cases.size(); }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-03 07:28:15 +01:00
|
|
|
MVT::SimpleValueType getCaseType(unsigned i) const { return Cases[i].first; }
|
|
|
|
Matcher *getCaseMatcher(unsigned i) { return Cases[i].second; }
|
|
|
|
const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-03 07:28:15 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return false; }
|
2010-03-03 07:28:15 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckChildTypeMatcher - This checks to see if a child node has the
|
2010-02-24 21:15:25 +01:00
|
|
|
/// specified type, if not it fails to match.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckChildTypeMatcher : public Matcher {
|
2010-02-24 21:15:25 +01:00
|
|
|
unsigned ChildNo;
|
|
|
|
MVT::SimpleValueType Type;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckChildTypeMatcher(unsigned childno, MVT::SimpleValueType type)
|
|
|
|
: Matcher(CheckChildType), ChildNo(childno), Type(type) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-24 21:15:25 +01:00
|
|
|
unsigned getChildNo() const { return ChildNo; }
|
|
|
|
MVT::SimpleValueType getType() const { return Type; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-24 21:15:25 +01:00
|
|
|
return N->getKind() == CheckChildType;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CheckChildTypeMatcher>(M)->ChildNo == ChildNo &&
|
|
|
|
cast<CheckChildTypeMatcher>(M)->Type == Type;
|
|
|
|
}
|
2014-03-05 06:17:42 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2010-02-24 21:15:25 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckIntegerMatcher - This checks to see if the current node is a
|
2010-02-15 09:04:42 +01:00
|
|
|
/// ConstantSDNode with the specified integer value, if not it fails to match.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckIntegerMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
int64_t Value;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckIntegerMatcher(int64_t value)
|
|
|
|
: Matcher(CheckInteger), Value(value) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
int64_t getValue() const { return Value; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckInteger;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CheckIntegerMatcher>(M)->Value == Value;
|
|
|
|
}
|
2014-03-05 06:17:42 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2014-02-05 06:44:28 +01:00
|
|
|
/// CheckChildIntegerMatcher - This checks to see if the child node is a
|
|
|
|
/// ConstantSDNode with a specified integer value, if not it fails to match.
|
|
|
|
class CheckChildIntegerMatcher : public Matcher {
|
|
|
|
unsigned ChildNo;
|
|
|
|
int64_t Value;
|
|
|
|
public:
|
|
|
|
CheckChildIntegerMatcher(unsigned childno, int64_t value)
|
|
|
|
: Matcher(CheckChildInteger), ChildNo(childno), Value(value) {}
|
|
|
|
|
|
|
|
unsigned getChildNo() const { return ChildNo; }
|
|
|
|
int64_t getValue() const { return Value; }
|
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2014-02-05 06:44:28 +01:00
|
|
|
return N->getKind() == CheckChildInteger;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2014-02-05 06:44:28 +01:00
|
|
|
return cast<CheckChildIntegerMatcher>(M)->ChildNo == ChildNo &&
|
|
|
|
cast<CheckChildIntegerMatcher>(M)->Value == Value;
|
|
|
|
}
|
2014-03-05 06:17:42 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2014-02-05 06:44:28 +01:00
|
|
|
};
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckCondCodeMatcher - This checks to see if the current node is a
|
2010-02-15 09:04:42 +01:00
|
|
|
/// CondCodeSDNode with the specified condition, if not it fails to match.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckCondCodeMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
StringRef CondCodeName;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckCondCodeMatcher(StringRef condcodename)
|
|
|
|
: Matcher(CheckCondCode), CondCodeName(condcodename) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
StringRef getCondCodeName() const { return CondCodeName; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckCondCode;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CheckCondCodeMatcher>(M)->CondCodeName == CondCodeName;
|
|
|
|
}
|
2021-01-27 04:41:52 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2019-02-25 04:11:44 +01:00
|
|
|
/// CheckChild2CondCodeMatcher - This checks to see if child 2 node is a
|
|
|
|
/// CondCodeSDNode with the specified condition, if not it fails to match.
|
|
|
|
class CheckChild2CondCodeMatcher : public Matcher {
|
|
|
|
StringRef CondCodeName;
|
|
|
|
public:
|
|
|
|
CheckChild2CondCodeMatcher(StringRef condcodename)
|
|
|
|
: Matcher(CheckChild2CondCode), CondCodeName(condcodename) {}
|
|
|
|
|
|
|
|
StringRef getCondCodeName() const { return CondCodeName; }
|
|
|
|
|
|
|
|
static bool classof(const Matcher *N) {
|
|
|
|
return N->getKind() == CheckChild2CondCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
|
|
|
return cast<CheckChild2CondCodeMatcher>(M)->CondCodeName == CondCodeName;
|
|
|
|
}
|
2021-01-27 04:41:52 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2019-02-25 04:11:44 +01:00
|
|
|
};
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckValueTypeMatcher - This checks to see if the current node is a
|
2010-02-15 09:04:42 +01:00
|
|
|
/// VTSDNode with the specified type, if not it fails to match.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckValueTypeMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
StringRef TypeName;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckValueTypeMatcher(StringRef type_name)
|
|
|
|
: Matcher(CheckValueType), TypeName(type_name) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
StringRef getTypeName() const { return TypeName; }
|
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckValueType;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CheckValueTypeMatcher>(M)->TypeName == TypeName;
|
|
|
|
}
|
2014-03-05 06:17:42 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckComplexPatMatcher - This node runs the specified ComplexPattern on
|
2010-02-15 09:04:42 +01:00
|
|
|
/// the current node.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckComplexPatMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
const ComplexPattern &Pattern;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
|
|
|
/// MatchNumber - This is the recorded nodes slot that contains the node we
|
|
|
|
/// want to match against.
|
2010-03-04 02:23:08 +01:00
|
|
|
unsigned MatchNumber;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-04 02:23:08 +01:00
|
|
|
/// Name - The name of the node we're matching, for comment emission.
|
|
|
|
std::string Name;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-03-04 01:28:05 +01:00
|
|
|
/// FirstResult - This is the first slot in the RecordedNodes list that the
|
|
|
|
/// result of the match populates.
|
|
|
|
unsigned FirstResult;
|
2010-02-15 09:04:42 +01:00
|
|
|
public:
|
2010-03-04 02:23:08 +01:00
|
|
|
CheckComplexPatMatcher(const ComplexPattern &pattern, unsigned matchnumber,
|
|
|
|
const std::string &name, unsigned firstresult)
|
|
|
|
: Matcher(CheckComplexPat), Pattern(pattern), MatchNumber(matchnumber),
|
|
|
|
Name(name), FirstResult(firstresult) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-17 01:31:50 +01:00
|
|
|
const ComplexPattern &getPattern() const { return Pattern; }
|
2010-03-04 02:23:08 +01:00
|
|
|
unsigned getMatchNumber() const { return MatchNumber; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2021-01-17 19:39:48 +01:00
|
|
|
std::string getName() const { return Name; }
|
2010-03-04 01:28:05 +01:00
|
|
|
unsigned getFirstResult() const { return FirstResult; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckComplexPat;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-03-04 02:23:08 +01:00
|
|
|
return &cast<CheckComplexPatMatcher>(M)->Pattern == &Pattern &&
|
|
|
|
cast<CheckComplexPatMatcher>(M)->MatchNumber == MatchNumber;
|
2010-02-25 07:49:58 +01:00
|
|
|
}
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckAndImmMatcher - This checks to see if the current node is an 'and'
|
2010-02-15 09:04:42 +01:00
|
|
|
/// with something equivalent to the specified immediate.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckAndImmMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
int64_t Value;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckAndImmMatcher(int64_t value)
|
|
|
|
: Matcher(CheckAndImm), Value(value) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
int64_t getValue() const { return Value; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckAndImm;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CheckAndImmMatcher>(M)->Value == Value;
|
|
|
|
}
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckOrImmMatcher - This checks to see if the current node is an 'and'
|
2010-02-15 09:04:42 +01:00
|
|
|
/// with something equivalent to the specified immediate.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckOrImmMatcher : public Matcher {
|
2010-02-15 09:04:42 +01:00
|
|
|
int64_t Value;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckOrImmMatcher(int64_t value)
|
|
|
|
: Matcher(CheckOrImm), Value(value) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
int64_t getValue() const { return Value; }
|
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-15 09:04:42 +01:00
|
|
|
return N->getKind() == CheckOrImm;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CheckOrImmMatcher>(M)->Value == Value;
|
|
|
|
}
|
2010-02-15 09:04:42 +01:00
|
|
|
};
|
2010-02-16 07:10:58 +01:00
|
|
|
|
2021-01-06 09:07:41 +01:00
|
|
|
/// CheckImmAllOnesVMatcher - This checks if the current node is a build_vector
|
|
|
|
/// or splat_vector of all ones.
|
2019-03-10 06:21:52 +01:00
|
|
|
class CheckImmAllOnesVMatcher : public Matcher {
|
|
|
|
public:
|
|
|
|
CheckImmAllOnesVMatcher() : Matcher(CheckImmAllOnesV) {}
|
|
|
|
|
|
|
|
static bool classof(const Matcher *N) {
|
|
|
|
return N->getKind() == CheckImmAllOnesV;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return true; }
|
2019-03-10 07:44:09 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2019-03-10 06:21:52 +01:00
|
|
|
};
|
|
|
|
|
2021-01-06 09:07:41 +01:00
|
|
|
/// CheckImmAllZerosVMatcher - This checks if the current node is a
|
|
|
|
/// build_vector or splat_vector of all zeros.
|
2019-03-10 06:21:52 +01:00
|
|
|
class CheckImmAllZerosVMatcher : public Matcher {
|
|
|
|
public:
|
|
|
|
CheckImmAllZerosVMatcher() : Matcher(CheckImmAllZerosV) {}
|
|
|
|
|
|
|
|
static bool classof(const Matcher *N) {
|
|
|
|
return N->getKind() == CheckImmAllZerosV;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return true; }
|
2019-03-10 07:44:09 +01:00
|
|
|
bool isContradictoryImpl(const Matcher *M) const override;
|
2019-03-10 06:21:52 +01:00
|
|
|
};
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CheckFoldableChainNodeMatcher - This checks to see if the current node
|
2010-02-16 20:15:55 +01:00
|
|
|
/// (which defines a chain operand) is safe to fold into a larger pattern.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CheckFoldableChainNodeMatcher : public Matcher {
|
2010-02-16 07:10:58 +01:00
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
CheckFoldableChainNodeMatcher()
|
|
|
|
: Matcher(CheckFoldableChainNode) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-16 20:15:55 +01:00
|
|
|
return N->getKind() == CheckFoldableChainNode;
|
2010-02-16 07:10:58 +01:00
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override { return true; }
|
2010-02-16 07:10:58 +01:00
|
|
|
};
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// EmitIntegerMatcher - This creates a new TargetConstant.
|
|
|
|
class EmitIntegerMatcher : public Matcher {
|
2010-02-18 23:03:03 +01:00
|
|
|
int64_t Val;
|
|
|
|
MVT::SimpleValueType VT;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
EmitIntegerMatcher(int64_t val, MVT::SimpleValueType vt)
|
|
|
|
: Matcher(EmitInteger), Val(val), VT(vt) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-19 08:49:56 +01:00
|
|
|
int64_t getValue() const { return Val; }
|
2010-02-18 23:03:03 +01:00
|
|
|
MVT::SimpleValueType getVT() const { return VT; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-18 23:03:03 +01:00
|
|
|
return N->getKind() == EmitInteger;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<EmitIntegerMatcher>(M)->Val == Val &&
|
|
|
|
cast<EmitIntegerMatcher>(M)->VT == VT;
|
|
|
|
}
|
2010-02-18 23:03:03 +01:00
|
|
|
};
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// EmitStringIntegerMatcher - A target constant whose value is represented
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
/// by a string.
|
2010-02-25 03:04:40 +01:00
|
|
|
class EmitStringIntegerMatcher : public Matcher {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
std::string Val;
|
|
|
|
MVT::SimpleValueType VT;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
EmitStringIntegerMatcher(const std::string &val, MVT::SimpleValueType vt)
|
|
|
|
: Matcher(EmitStringInteger), Val(val), VT(vt) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
const std::string &getValue() const { return Val; }
|
|
|
|
MVT::SimpleValueType getVT() const { return VT; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
return N->getKind() == EmitStringInteger;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<EmitStringIntegerMatcher>(M)->Val == Val &&
|
|
|
|
cast<EmitStringIntegerMatcher>(M)->VT == VT;
|
|
|
|
}
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// EmitRegisterMatcher - This creates a new TargetConstant.
|
|
|
|
class EmitRegisterMatcher : public Matcher {
|
2010-02-18 23:03:03 +01:00
|
|
|
/// Reg - The def for the register that we're emitting. If this is null, then
|
|
|
|
/// this is a reference to zero_reg.
|
2011-03-11 03:19:02 +01:00
|
|
|
const CodeGenRegister *Reg;
|
2010-02-18 23:03:03 +01:00
|
|
|
MVT::SimpleValueType VT;
|
|
|
|
public:
|
2011-03-11 03:19:02 +01:00
|
|
|
EmitRegisterMatcher(const CodeGenRegister *reg, MVT::SimpleValueType vt)
|
2010-02-25 03:04:40 +01:00
|
|
|
: Matcher(EmitRegister), Reg(reg), VT(vt) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2011-03-11 03:19:02 +01:00
|
|
|
const CodeGenRegister *getReg() const { return Reg; }
|
2010-02-18 23:03:03 +01:00
|
|
|
MVT::SimpleValueType getVT() const { return VT; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-18 23:03:03 +01:00
|
|
|
return N->getKind() == EmitRegister;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<EmitRegisterMatcher>(M)->Reg == Reg &&
|
|
|
|
cast<EmitRegisterMatcher>(M)->VT == VT;
|
|
|
|
}
|
2010-02-18 23:03:03 +01:00
|
|
|
};
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// EmitConvertToTargetMatcher - Emit an operation that reads a specified
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
/// recorded node and converts it from being a ISD::Constant to
|
|
|
|
/// ISD::TargetConstant, likewise for ConstantFP.
|
2010-02-25 03:04:40 +01:00
|
|
|
class EmitConvertToTargetMatcher : public Matcher {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned Slot;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
EmitConvertToTargetMatcher(unsigned slot)
|
|
|
|
: Matcher(EmitConvertToTarget), Slot(slot) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned getSlot() const { return Slot; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
return N->getKind() == EmitConvertToTarget;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<EmitConvertToTargetMatcher>(M)->Slot == Slot;
|
|
|
|
}
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// EmitMergeInputChainsMatcher - Emit a node that merges a list of input
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
/// chains together with a token factor. The list of nodes are the nodes in the
|
|
|
|
/// matched pattern that have chain input/outputs. This node adds all input
|
|
|
|
/// chains of these nodes if they are not themselves a node in the pattern.
|
2010-02-25 03:04:40 +01:00
|
|
|
class EmitMergeInputChainsMatcher : public Matcher {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
SmallVector<unsigned, 3> ChainNodes;
|
|
|
|
public:
|
2014-01-21 08:20:05 +01:00
|
|
|
EmitMergeInputChainsMatcher(ArrayRef<unsigned> nodes)
|
|
|
|
: Matcher(EmitMergeInputChains), ChainNodes(nodes.begin(), nodes.end()) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned getNumNodes() const { return ChainNodes.size(); }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned getNode(unsigned i) const {
|
|
|
|
assert(i < ChainNodes.size());
|
|
|
|
return ChainNodes[i];
|
2010-12-21 17:16:00 +01:00
|
|
|
}
|
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
return N->getKind() == EmitMergeInputChains;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<EmitMergeInputChainsMatcher>(M)->ChainNodes == ChainNodes;
|
|
|
|
}
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// EmitCopyToRegMatcher - Emit a CopyToReg node from a value to a physreg,
|
2010-12-23 18:03:20 +01:00
|
|
|
/// pushing the chain and glue results.
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
///
|
2010-02-25 03:04:40 +01:00
|
|
|
class EmitCopyToRegMatcher : public Matcher {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned SrcSlot; // Value to copy into the physreg.
|
2019-07-22 17:02:34 +02:00
|
|
|
const CodeGenRegister *DestPhysReg;
|
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
public:
|
2019-07-22 17:02:34 +02:00
|
|
|
EmitCopyToRegMatcher(unsigned srcSlot,
|
|
|
|
const CodeGenRegister *destPhysReg)
|
2010-02-25 03:04:40 +01:00
|
|
|
: Matcher(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned getSrcSlot() const { return SrcSlot; }
|
2019-07-22 17:02:34 +02:00
|
|
|
const CodeGenRegister *getDestPhysReg() const { return DestPhysReg; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
return N->getKind() == EmitCopyToReg;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<EmitCopyToRegMatcher>(M)->SrcSlot == SrcSlot &&
|
2010-12-21 17:16:00 +01:00
|
|
|
cast<EmitCopyToRegMatcher>(M)->DestPhysReg == DestPhysReg;
|
2010-02-25 07:49:58 +01:00
|
|
|
}
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// EmitNodeXFormMatcher - Emit an operation that runs an SDNodeXForm on a
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
/// recorded node and records the result.
|
2010-02-25 03:04:40 +01:00
|
|
|
class EmitNodeXFormMatcher : public Matcher {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned Slot;
|
|
|
|
Record *NodeXForm;
|
|
|
|
public:
|
2010-02-25 03:04:40 +01:00
|
|
|
EmitNodeXFormMatcher(unsigned slot, Record *nodeXForm)
|
|
|
|
: Matcher(EmitNodeXForm), Slot(slot), NodeXForm(nodeXForm) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned getSlot() const { return Slot; }
|
|
|
|
Record *getNodeXForm() const { return NodeXForm; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
return N->getKind() == EmitNodeXForm;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<EmitNodeXFormMatcher>(M)->Slot == Slot &&
|
2010-12-21 17:16:00 +01:00
|
|
|
cast<EmitNodeXFormMatcher>(M)->NodeXForm == NodeXForm;
|
2010-02-25 07:49:58 +01:00
|
|
|
}
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-28 03:31:26 +01:00
|
|
|
/// EmitNodeMatcherCommon - Common class shared between EmitNode and
|
2010-02-28 21:55:18 +01:00
|
|
|
/// MorphNodeTo.
|
2010-02-28 03:31:26 +01:00
|
|
|
class EmitNodeMatcherCommon : public Matcher {
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
std::string OpcodeName;
|
|
|
|
const SmallVector<MVT::SimpleValueType, 3> VTs;
|
|
|
|
const SmallVector<unsigned, 6> Operands;
|
2010-12-23 19:28:41 +01:00
|
|
|
bool HasChain, HasInGlue, HasOutGlue, HasMemRefs;
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
/// NumFixedArityOperands - If this is a fixed arity node, this is set to -1.
|
|
|
|
/// If this is a varidic node, this is set to the number of fixed arity
|
|
|
|
/// operands in the root of the pattern. The rest are appended to this node.
|
|
|
|
int NumFixedArityOperands;
|
|
|
|
public:
|
2010-02-28 03:31:26 +01:00
|
|
|
EmitNodeMatcherCommon(const std::string &opcodeName,
|
2014-01-21 08:20:05 +01:00
|
|
|
ArrayRef<MVT::SimpleValueType> vts,
|
|
|
|
ArrayRef<unsigned> operands,
|
2010-12-23 18:03:20 +01:00
|
|
|
bool hasChain, bool hasInGlue, bool hasOutGlue,
|
2010-02-28 22:53:42 +01:00
|
|
|
bool hasmemrefs,
|
2010-02-28 21:55:18 +01:00
|
|
|
int numfixedarityoperands, bool isMorphNodeTo)
|
|
|
|
: Matcher(isMorphNodeTo ? MorphNodeTo : EmitNode), OpcodeName(opcodeName),
|
2014-01-21 08:20:05 +01:00
|
|
|
VTs(vts.begin(), vts.end()), Operands(operands.begin(), operands.end()),
|
2010-12-23 19:28:41 +01:00
|
|
|
HasChain(hasChain), HasInGlue(hasInGlue), HasOutGlue(hasOutGlue),
|
2010-02-28 22:53:42 +01:00
|
|
|
HasMemRefs(hasmemrefs), NumFixedArityOperands(numfixedarityoperands) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
const std::string &getOpcodeName() const { return OpcodeName; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned getNumVTs() const { return VTs.size(); }
|
|
|
|
MVT::SimpleValueType getVT(unsigned i) const {
|
|
|
|
assert(i < VTs.size());
|
|
|
|
return VTs[i];
|
|
|
|
}
|
2010-02-28 21:49:53 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
unsigned getNumOperands() const { return Operands.size(); }
|
|
|
|
unsigned getOperand(unsigned i) const {
|
|
|
|
assert(i < Operands.size());
|
|
|
|
return Operands[i];
|
2010-02-28 21:49:53 +01:00
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-28 21:49:53 +01:00
|
|
|
const SmallVectorImpl<MVT::SimpleValueType> &getVTList() const { return VTs; }
|
|
|
|
const SmallVectorImpl<unsigned> &getOperandList() const { return Operands; }
|
|
|
|
|
2010-12-21 17:16:00 +01:00
|
|
|
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
bool hasChain() const { return HasChain; }
|
2010-12-23 19:28:41 +01:00
|
|
|
bool hasInFlag() const { return HasInGlue; }
|
|
|
|
bool hasOutFlag() const { return HasOutGlue; }
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
bool hasMemRefs() const { return HasMemRefs; }
|
|
|
|
int getNumFixedArityOperands() const { return NumFixedArityOperands; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-28 21:55:18 +01:00
|
|
|
return N->getKind() == EmitNode || N->getKind() == MorphNodeTo;
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override;
|
Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization
etc).
More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.
In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.
llvm-svn: 96716
2010-02-21 04:22:59 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-28 03:31:26 +01:00
|
|
|
/// EmitNodeMatcher - This signals a successful match and generates a node.
|
|
|
|
class EmitNodeMatcher : public EmitNodeMatcherCommon {
|
2014-03-05 06:17:42 +01:00
|
|
|
void anchor() override;
|
2010-02-28 03:41:25 +01:00
|
|
|
unsigned FirstResultSlot;
|
2010-02-28 03:31:26 +01:00
|
|
|
public:
|
|
|
|
EmitNodeMatcher(const std::string &opcodeName,
|
2014-01-21 08:20:05 +01:00
|
|
|
ArrayRef<MVT::SimpleValueType> vts,
|
|
|
|
ArrayRef<unsigned> operands,
|
2010-02-28 22:53:42 +01:00
|
|
|
bool hasChain, bool hasInFlag, bool hasOutFlag,
|
|
|
|
bool hasmemrefs,
|
2010-02-28 03:41:25 +01:00
|
|
|
int numfixedarityoperands, unsigned firstresultslot)
|
2014-01-21 08:20:05 +01:00
|
|
|
: EmitNodeMatcherCommon(opcodeName, vts, operands, hasChain,
|
2010-02-28 22:53:42 +01:00
|
|
|
hasInFlag, hasOutFlag, hasmemrefs,
|
|
|
|
numfixedarityoperands, false),
|
2010-02-28 03:41:25 +01:00
|
|
|
FirstResultSlot(firstresultslot) {}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-28 03:41:25 +01:00
|
|
|
unsigned getFirstResultSlot() const { return FirstResultSlot; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-28 03:31:26 +01:00
|
|
|
return N->getKind() == EmitNode;
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-28 03:31:26 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-28 21:55:18 +01:00
|
|
|
class MorphNodeToMatcher : public EmitNodeMatcherCommon {
|
2014-03-05 06:17:42 +01:00
|
|
|
void anchor() override;
|
2010-02-28 03:31:26 +01:00
|
|
|
const PatternToMatch &Pattern;
|
|
|
|
public:
|
2010-02-28 21:55:18 +01:00
|
|
|
MorphNodeToMatcher(const std::string &opcodeName,
|
2014-01-21 08:20:05 +01:00
|
|
|
ArrayRef<MVT::SimpleValueType> vts,
|
|
|
|
ArrayRef<unsigned> operands,
|
2010-02-28 22:53:42 +01:00
|
|
|
bool hasChain, bool hasInFlag, bool hasOutFlag,
|
|
|
|
bool hasmemrefs,
|
2010-02-28 21:55:18 +01:00
|
|
|
int numfixedarityoperands, const PatternToMatch &pattern)
|
2014-01-21 08:20:05 +01:00
|
|
|
: EmitNodeMatcherCommon(opcodeName, vts, operands, hasChain,
|
2010-02-28 22:53:42 +01:00
|
|
|
hasInFlag, hasOutFlag, hasmemrefs,
|
|
|
|
numfixedarityoperands, true),
|
2010-02-28 03:31:26 +01:00
|
|
|
Pattern(pattern) {
|
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-28 03:31:26 +01:00
|
|
|
const PatternToMatch &getPattern() const { return Pattern; }
|
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-28 21:55:18 +01:00
|
|
|
return N->getKind() == MorphNodeTo;
|
2010-02-28 03:31:26 +01:00
|
|
|
}
|
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 03:04:40 +01:00
|
|
|
/// CompleteMatchMatcher - Complete a match by replacing the results of the
|
2010-02-21 07:03:07 +01:00
|
|
|
/// pattern with the newly generated nodes. This also prints a comment
|
|
|
|
/// indicating the source and dest patterns.
|
2010-02-25 03:04:40 +01:00
|
|
|
class CompleteMatchMatcher : public Matcher {
|
2010-02-21 07:03:07 +01:00
|
|
|
SmallVector<unsigned, 2> Results;
|
2010-02-18 23:03:03 +01:00
|
|
|
const PatternToMatch &Pattern;
|
|
|
|
public:
|
2014-01-21 08:20:05 +01:00
|
|
|
CompleteMatchMatcher(ArrayRef<unsigned> results,
|
2010-02-28 21:49:53 +01:00
|
|
|
const PatternToMatch &pattern)
|
2014-01-21 08:20:05 +01:00
|
|
|
: Matcher(CompleteMatch), Results(results.begin(), results.end()),
|
2010-02-21 07:03:07 +01:00
|
|
|
Pattern(pattern) {}
|
|
|
|
|
|
|
|
unsigned getNumResults() const { return Results.size(); }
|
|
|
|
unsigned getResult(unsigned R) const { return Results[R]; }
|
2010-02-18 23:03:03 +01:00
|
|
|
const PatternToMatch &getPattern() const { return Pattern; }
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2017-06-29 21:35:17 +02:00
|
|
|
static bool classof(const Matcher *N) {
|
2010-02-21 07:03:07 +01:00
|
|
|
return N->getKind() == CompleteMatch;
|
2010-02-18 23:03:03 +01:00
|
|
|
}
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-25 07:49:58 +01:00
|
|
|
private:
|
2014-03-05 06:17:42 +01:00
|
|
|
void printImpl(raw_ostream &OS, unsigned indent) const override;
|
|
|
|
bool isEqualImpl(const Matcher *M) const override {
|
2010-02-25 07:49:58 +01:00
|
|
|
return cast<CompleteMatchMatcher>(M)->Results == Results &&
|
|
|
|
&cast<CompleteMatchMatcher>(M)->Pattern == &Pattern;
|
|
|
|
}
|
2010-02-18 23:03:03 +01:00
|
|
|
};
|
2010-12-21 17:16:00 +01:00
|
|
|
|
2010-02-15 09:04:42 +01:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|