2010-02-15 08:04:42 +00:00
|
|
|
//===- DAGISelMatcher.h - Representation of DAG pattern matcher -----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef TBLGEN_DAGISELMATCHER_H
|
|
|
|
#define TBLGEN_DAGISELMATCHER_H
|
|
|
|
|
2010-02-16 07:21:10 +00:00
|
|
|
#include "llvm/CodeGen/ValueTypes.h"
|
2010-02-15 08:04:42 +00:00
|
|
|
#include "llvm/ADT/OwningPtr.h"
|
|
|
|
#include "llvm/ADT/StringRef.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 03:22:59 +00:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2010-02-16 07:21:10 +00:00
|
|
|
#include "llvm/Support/Casting.h"
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class CodeGenDAGPatterns;
|
|
|
|
class MatcherNode;
|
|
|
|
class PatternToMatch;
|
|
|
|
class raw_ostream;
|
|
|
|
class ComplexPattern;
|
2010-02-18 22:03:03 +00:00
|
|
|
class Record;
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
MatcherNode *ConvertPatternToMatcher(const PatternToMatch &Pattern,
|
|
|
|
const CodeGenDAGPatterns &CGP);
|
2010-02-24 07:31:45 +00:00
|
|
|
MatcherNode *OptimizeMatcher(MatcherNode *Matcher);
|
2010-02-15 08:04:42 +00:00
|
|
|
void EmitMatcherTable(const MatcherNode *Matcher, raw_ostream &OS);
|
|
|
|
|
|
|
|
|
|
|
|
/// MatcherNode - Base class for all the the DAG ISel Matcher representation
|
|
|
|
/// nodes.
|
|
|
|
class MatcherNode {
|
2010-02-18 02:53:41 +00:00
|
|
|
// The next matcher node that is executed after this one. Null if this is the
|
|
|
|
// last stage of a match.
|
|
|
|
OwningPtr<MatcherNode> Next;
|
2010-02-15 08:04:42 +00: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 03:22:59 +00:00
|
|
|
// Matcher state manipulation.
|
|
|
|
Push, // Push a checking scope.
|
|
|
|
RecordNode, // Record the current node.
|
2010-02-24 07:31:45 +00: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 03:22:59 +00:00
|
|
|
RecordMemRef, // Record the memref in the current node.
|
|
|
|
CaptureFlagInput, // If the current node has an input flag, save it.
|
|
|
|
MoveChild, // Move current node to specified child.
|
|
|
|
MoveParent, // Move current node to parent.
|
2010-02-15 08:04:42 +00:00
|
|
|
|
2010-02-18 22:03:03 +00: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 03:22:59 +00:00
|
|
|
CheckSame, // Fail if not same as prev match.
|
2010-02-15 08:04:42 +00: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 03:22:59 +00:00
|
|
|
CheckPredicate, // Fail if node predicate fails.
|
|
|
|
CheckOpcode, // Fail if not opcode.
|
2010-02-22 22:30:37 +00:00
|
|
|
CheckMultiOpcode, // Fail if not in opcode list.
|
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 03:22:59 +00:00
|
|
|
CheckType, // Fail if not correct type.
|
|
|
|
CheckInteger, // Fail if wrong val.
|
|
|
|
CheckCondCode, // Fail if not condcode.
|
2010-02-15 08:04:42 +00:00
|
|
|
CheckValueType,
|
|
|
|
CheckComplexPat,
|
|
|
|
CheckAndImm,
|
2010-02-16 06:10:58 +00:00
|
|
|
CheckOrImm,
|
2010-02-17 06:23:39 +00:00
|
|
|
CheckFoldableChainNode,
|
2010-02-18 22:03:03 +00:00
|
|
|
CheckChainCompatible,
|
|
|
|
|
|
|
|
// 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 03:22:59 +00: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-24 05:33:42 +00:00
|
|
|
MarkFlagResults, // Indicate which interior nodes have flag results.
|
2010-02-21 06:03:07 +00:00
|
|
|
CompleteMatch // Finish a match and update the results.
|
2010-02-15 08:04:42 +00:00
|
|
|
};
|
|
|
|
const KindTy Kind;
|
2010-02-18 02:49:24 +00:00
|
|
|
|
2010-02-15 08:04:42 +00:00
|
|
|
protected:
|
|
|
|
MatcherNode(KindTy K) : Kind(K) {}
|
|
|
|
public:
|
|
|
|
virtual ~MatcherNode() {}
|
|
|
|
|
|
|
|
KindTy getKind() const { return Kind; }
|
2010-02-18 02:49:24 +00:00
|
|
|
|
2010-02-18 02:53:41 +00:00
|
|
|
MatcherNode *getNext() { return Next.get(); }
|
|
|
|
const MatcherNode *getNext() const { return Next.get(); }
|
|
|
|
void setNext(MatcherNode *C) { Next.reset(C); }
|
2010-02-24 07:31:45 +00:00
|
|
|
MatcherNode *takeNext() { return Next.take(); }
|
|
|
|
|
|
|
|
OwningPtr<MatcherNode> &getNextPtr() { return Next; }
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *) { return true; }
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const = 0;
|
|
|
|
void dump() const;
|
2010-02-18 02:49:24 +00:00
|
|
|
protected:
|
2010-02-18 02:53:41 +00:00
|
|
|
void printNext(raw_ostream &OS, unsigned indent) const;
|
2010-02-15 08:04:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// PushMatcherNode - This pushes a failure scope on the stack and evaluates
|
2010-02-18 02:53:41 +00:00
|
|
|
/// 'Next'. If 'Next' fails to match, it pops its scope and attempts to
|
2010-02-15 08:04:42 +00:00
|
|
|
/// match 'Failure'.
|
2010-02-18 02:49:24 +00:00
|
|
|
class PushMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
OwningPtr<MatcherNode> Failure;
|
|
|
|
public:
|
2010-02-18 02:53:41 +00:00
|
|
|
PushMatcherNode(MatcherNode *next = 0, MatcherNode *failure = 0)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(Push), Failure(failure) {
|
2010-02-18 02:53:41 +00:00
|
|
|
setNext(next);
|
2010-02-15 08:04:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MatcherNode *getFailure() { return Failure.get(); }
|
|
|
|
const MatcherNode *getFailure() const { return Failure.get(); }
|
|
|
|
void setFailure(MatcherNode *N) { Failure.reset(N); }
|
2010-02-24 07:31:45 +00:00
|
|
|
OwningPtr<MatcherNode> &getFailurePtr() { return Failure; }
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == Push;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// RecordMatcherNode - Save the current node in the operand list.
|
2010-02-18 02:49:24 +00:00
|
|
|
class RecordMatcherNode : public MatcherNode {
|
2010-02-17 01:03:09 +00: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-02-15 08:04:42 +00:00
|
|
|
public:
|
2010-02-17 01:27:29 +00:00
|
|
|
RecordMatcherNode(const std::string &whatfor)
|
2010-02-18 22:03:03 +00:00
|
|
|
: MatcherNode(RecordNode), WhatFor(whatfor) {}
|
2010-02-17 01:03:09 +00:00
|
|
|
|
2010-02-17 01:27:29 +00:00
|
|
|
const std::string &getWhatFor() const { return WhatFor; }
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
2010-02-18 22:03:03 +00:00
|
|
|
return N->getKind() == RecordNode;
|
2010-02-15 08:04:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
2010-02-24 07:31:45 +00:00
|
|
|
/// RecordChildMatcherNode - Save a numbered child of the current node, or fail
|
|
|
|
/// the match if it doesn't exist. This is logically equivalent to:
|
|
|
|
/// MoveChild N + RecordNode + MoveParent.
|
|
|
|
class RecordChildMatcherNode : public MatcherNode {
|
|
|
|
unsigned ChildNo;
|
|
|
|
|
|
|
|
/// 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;
|
|
|
|
public:
|
|
|
|
RecordChildMatcherNode(unsigned childno, const std::string &whatfor)
|
|
|
|
: MatcherNode(RecordChild), ChildNo(childno), WhatFor(whatfor) {}
|
|
|
|
|
|
|
|
unsigned getChildNo() const { return ChildNo; }
|
|
|
|
const std::string &getWhatFor() const { return WhatFor; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == RecordChild;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
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 03:22:59 +00:00
|
|
|
/// RecordMemRefMatcherNode - Save the current node's memref.
|
|
|
|
class RecordMemRefMatcherNode : public MatcherNode {
|
|
|
|
public:
|
|
|
|
RecordMemRefMatcherNode() : MatcherNode(RecordMemRef) {}
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == RecordMemRef;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// CaptureFlagInputMatcherNode - If the current record has a flag input, record
|
|
|
|
/// it so that it is used as an input to the generated code.
|
|
|
|
class CaptureFlagInputMatcherNode : public MatcherNode {
|
|
|
|
public:
|
|
|
|
CaptureFlagInputMatcherNode()
|
|
|
|
: MatcherNode(CaptureFlagInput) {}
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CaptureFlagInput;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
2010-02-15 08:04:42 +00:00
|
|
|
/// MoveChildMatcherNode - This tells the interpreter to move into the
|
|
|
|
/// specified child node.
|
2010-02-18 02:49:24 +00:00
|
|
|
class MoveChildMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
unsigned ChildNo;
|
|
|
|
public:
|
|
|
|
MoveChildMatcherNode(unsigned childNo)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(MoveChild), ChildNo(childNo) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
unsigned getChildNo() const { return ChildNo; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == MoveChild;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// MoveParentMatcherNode - This tells the interpreter to move to the parent
|
|
|
|
/// of the current node.
|
2010-02-18 02:49:24 +00:00
|
|
|
class MoveParentMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
public:
|
|
|
|
MoveParentMatcherNode()
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(MoveParent) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == MoveParent;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// CheckSameMatcherNode - This checks to see if this 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)'.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckSameMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
unsigned MatchNumber;
|
|
|
|
public:
|
|
|
|
CheckSameMatcherNode(unsigned matchnumber)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckSame), MatchNumber(matchnumber) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
unsigned getMatchNumber() const { return MatchNumber; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckSame;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// CheckPatternPredicateMatcherNode - This checks the target-specific predicate
|
|
|
|
/// 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-18 02:49:24 +00:00
|
|
|
class CheckPatternPredicateMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
std::string Predicate;
|
|
|
|
public:
|
|
|
|
CheckPatternPredicateMatcherNode(StringRef predicate)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckPatternPredicate), Predicate(predicate) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
StringRef getPredicate() const { return Predicate; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckPatternPredicate;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// CheckPredicateMatcherNode - This checks the target-specific predicate to
|
|
|
|
/// see if the node is acceptable.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckPredicateMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
StringRef PredName;
|
|
|
|
public:
|
|
|
|
CheckPredicateMatcherNode(StringRef predname)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckPredicate), PredName(predname) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
StringRef getPredicateName() const { return PredName; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckPredicate;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// CheckOpcodeMatcherNode - This checks to see if the current node has the
|
|
|
|
/// specified opcode, if not it fails to match.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckOpcodeMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
StringRef OpcodeName;
|
|
|
|
public:
|
|
|
|
CheckOpcodeMatcherNode(StringRef opcodename)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckOpcode), OpcodeName(opcodename) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
StringRef getOpcodeName() const { return OpcodeName; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckOpcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
2010-02-22 22:30:37 +00:00
|
|
|
/// CheckMultiOpcodeMatcherNode - This checks to see if the current node has one
|
|
|
|
/// of the specified opcode, if not it fails to match.
|
|
|
|
class CheckMultiOpcodeMatcherNode : public MatcherNode {
|
|
|
|
SmallVector<StringRef, 4> OpcodeNames;
|
|
|
|
public:
|
|
|
|
CheckMultiOpcodeMatcherNode(const StringRef *opcodes, unsigned numops)
|
|
|
|
: MatcherNode(CheckMultiOpcode), OpcodeNames(opcodes, opcodes+numops) {}
|
|
|
|
|
|
|
|
unsigned getNumOpcodeNames() const { return OpcodeNames.size(); }
|
|
|
|
StringRef getOpcodeName(unsigned i) const { return OpcodeNames[i]; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckMultiOpcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-15 08:04:42 +00:00
|
|
|
/// CheckTypeMatcherNode - This checks to see if the current node has the
|
|
|
|
/// specified type, if not it fails to match.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckTypeMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
MVT::SimpleValueType Type;
|
|
|
|
public:
|
|
|
|
CheckTypeMatcherNode(MVT::SimpleValueType type)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckType), Type(type) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
MVT::SimpleValueType getType() const { return Type; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckType;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// CheckIntegerMatcherNode - This checks to see if the current node is a
|
|
|
|
/// ConstantSDNode with the specified integer value, if not it fails to match.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckIntegerMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
int64_t Value;
|
|
|
|
public:
|
|
|
|
CheckIntegerMatcherNode(int64_t value)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckInteger), Value(value) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
int64_t getValue() const { return Value; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckInteger;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// CheckCondCodeMatcherNode - This checks to see if the current node is a
|
|
|
|
/// CondCodeSDNode with the specified condition, if not it fails to match.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckCondCodeMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
StringRef CondCodeName;
|
|
|
|
public:
|
|
|
|
CheckCondCodeMatcherNode(StringRef condcodename)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckCondCode), CondCodeName(condcodename) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
StringRef getCondCodeName() const { return CondCodeName; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckCondCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// CheckValueTypeMatcherNode - This checks to see if the current node is a
|
|
|
|
/// VTSDNode with the specified type, if not it fails to match.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckValueTypeMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
StringRef TypeName;
|
|
|
|
public:
|
|
|
|
CheckValueTypeMatcherNode(StringRef type_name)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckValueType), TypeName(type_name) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
StringRef getTypeName() const { return TypeName; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckValueType;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// CheckComplexPatMatcherNode - This node runs the specified ComplexPattern on
|
|
|
|
/// the current node.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckComplexPatMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
const ComplexPattern &Pattern;
|
|
|
|
public:
|
|
|
|
CheckComplexPatMatcherNode(const ComplexPattern &pattern)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckComplexPat), Pattern(pattern) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
2010-02-17 00:31:50 +00:00
|
|
|
const ComplexPattern &getPattern() const { return Pattern; }
|
|
|
|
|
2010-02-15 08:04:42 +00:00
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckComplexPat;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// CheckAndImmMatcherNode - This checks to see if the current node is an 'and'
|
|
|
|
/// with something equivalent to the specified immediate.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckAndImmMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
int64_t Value;
|
|
|
|
public:
|
|
|
|
CheckAndImmMatcherNode(int64_t value)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckAndImm), Value(value) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
int64_t getValue() const { return Value; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckAndImm;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// CheckOrImmMatcherNode - This checks to see if the current node is an 'and'
|
|
|
|
/// with something equivalent to the specified immediate.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckOrImmMatcherNode : public MatcherNode {
|
2010-02-15 08:04:42 +00:00
|
|
|
int64_t Value;
|
|
|
|
public:
|
|
|
|
CheckOrImmMatcherNode(int64_t value)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckOrImm), Value(value) {}
|
2010-02-15 08:04:42 +00:00
|
|
|
|
|
|
|
int64_t getValue() const { return Value; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckOrImm;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
2010-02-16 06:10:58 +00:00
|
|
|
|
2010-02-16 19:15:55 +00:00
|
|
|
/// CheckFoldableChainNodeMatcherNode - This checks to see if the current node
|
|
|
|
/// (which defines a chain operand) is safe to fold into a larger pattern.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckFoldableChainNodeMatcherNode : public MatcherNode {
|
2010-02-16 06:10:58 +00:00
|
|
|
public:
|
2010-02-16 19:15:55 +00:00
|
|
|
CheckFoldableChainNodeMatcherNode()
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckFoldableChainNode) {}
|
2010-02-16 06:10:58 +00:00
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
2010-02-16 19:15:55 +00:00
|
|
|
return N->getKind() == CheckFoldableChainNode;
|
2010-02-16 06:10:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
2010-02-17 06:23:39 +00:00
|
|
|
/// CheckChainCompatibleMatcherNode - Verify that the current node's chain
|
|
|
|
/// operand is 'compatible' with the specified recorded node's.
|
2010-02-18 02:49:24 +00:00
|
|
|
class CheckChainCompatibleMatcherNode : public MatcherNode {
|
2010-02-17 06:23:39 +00:00
|
|
|
unsigned PreviousOp;
|
|
|
|
public:
|
|
|
|
CheckChainCompatibleMatcherNode(unsigned previousop)
|
2010-02-18 02:49:24 +00:00
|
|
|
: MatcherNode(CheckChainCompatible), PreviousOp(previousop) {}
|
2010-02-17 06:23:39 +00:00
|
|
|
|
|
|
|
unsigned getPreviousOp() const { return PreviousOp; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == CheckChainCompatible;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
2010-02-18 22:03:03 +00:00
|
|
|
/// EmitIntegerMatcherNode - This creates a new TargetConstant.
|
|
|
|
class EmitIntegerMatcherNode : public MatcherNode {
|
|
|
|
int64_t Val;
|
|
|
|
MVT::SimpleValueType VT;
|
|
|
|
public:
|
|
|
|
EmitIntegerMatcherNode(int64_t val, MVT::SimpleValueType vt)
|
|
|
|
: MatcherNode(EmitInteger), Val(val), VT(vt) {}
|
|
|
|
|
2010-02-19 07:49:56 +00:00
|
|
|
int64_t getValue() const { return Val; }
|
2010-02-18 22:03:03 +00:00
|
|
|
MVT::SimpleValueType getVT() const { return VT; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == EmitInteger;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
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 03:22:59 +00:00
|
|
|
|
|
|
|
/// EmitStringIntegerMatcherNode - A target constant whose value is represented
|
|
|
|
/// by a string.
|
|
|
|
class EmitStringIntegerMatcherNode : public MatcherNode {
|
|
|
|
std::string Val;
|
|
|
|
MVT::SimpleValueType VT;
|
|
|
|
public:
|
|
|
|
EmitStringIntegerMatcherNode(const std::string &val, MVT::SimpleValueType vt)
|
|
|
|
: MatcherNode(EmitStringInteger), Val(val), VT(vt) {}
|
|
|
|
|
|
|
|
const std::string &getValue() const { return Val; }
|
|
|
|
MVT::SimpleValueType getVT() const { return VT; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == EmitStringInteger;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
2010-02-18 22:03:03 +00:00
|
|
|
|
|
|
|
/// EmitRegisterMatcherNode - This creates a new TargetConstant.
|
|
|
|
class EmitRegisterMatcherNode : public MatcherNode {
|
|
|
|
/// Reg - The def for the register that we're emitting. If this is null, then
|
|
|
|
/// this is a reference to zero_reg.
|
|
|
|
Record *Reg;
|
|
|
|
MVT::SimpleValueType VT;
|
|
|
|
public:
|
|
|
|
EmitRegisterMatcherNode(Record *reg, MVT::SimpleValueType vt)
|
|
|
|
: MatcherNode(EmitRegister), Reg(reg), VT(vt) {}
|
|
|
|
|
|
|
|
Record *getReg() const { return Reg; }
|
|
|
|
MVT::SimpleValueType getVT() const { return VT; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == EmitRegister;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
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 03:22:59 +00:00
|
|
|
|
|
|
|
/// EmitConvertToTargetMatcherNode - Emit an operation that reads a specified
|
|
|
|
/// recorded node and converts it from being a ISD::Constant to
|
|
|
|
/// ISD::TargetConstant, likewise for ConstantFP.
|
|
|
|
class EmitConvertToTargetMatcherNode : public MatcherNode {
|
|
|
|
unsigned Slot;
|
|
|
|
public:
|
|
|
|
EmitConvertToTargetMatcherNode(unsigned slot)
|
|
|
|
: MatcherNode(EmitConvertToTarget), Slot(slot) {}
|
|
|
|
|
|
|
|
unsigned getSlot() const { return Slot; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == EmitConvertToTarget;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// EmitMergeInputChainsMatcherNode - Emit a node that merges a list of input
|
|
|
|
/// 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.
|
|
|
|
class EmitMergeInputChainsMatcherNode : public MatcherNode {
|
|
|
|
SmallVector<unsigned, 3> ChainNodes;
|
|
|
|
public:
|
|
|
|
EmitMergeInputChainsMatcherNode(const unsigned *nodes, unsigned NumNodes)
|
|
|
|
: MatcherNode(EmitMergeInputChains), ChainNodes(nodes, nodes+NumNodes) {}
|
|
|
|
|
|
|
|
unsigned getNumNodes() const { return ChainNodes.size(); }
|
|
|
|
|
|
|
|
unsigned getNode(unsigned i) const {
|
|
|
|
assert(i < ChainNodes.size());
|
|
|
|
return ChainNodes[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == EmitMergeInputChains;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// EmitCopyToRegMatcherNode - Emit a CopyToReg node from a value to a physreg,
|
|
|
|
/// pushing the chain and flag results.
|
|
|
|
///
|
|
|
|
class EmitCopyToRegMatcherNode : public MatcherNode {
|
|
|
|
unsigned SrcSlot; // Value to copy into the physreg.
|
|
|
|
Record *DestPhysReg;
|
|
|
|
public:
|
|
|
|
EmitCopyToRegMatcherNode(unsigned srcSlot, Record *destPhysReg)
|
|
|
|
: MatcherNode(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {}
|
|
|
|
|
|
|
|
unsigned getSrcSlot() const { return SrcSlot; }
|
|
|
|
Record *getDestPhysReg() const { return DestPhysReg; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == EmitCopyToReg;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// EmitNodeXFormMatcherNode - Emit an operation that runs an SDNodeXForm on a
|
|
|
|
/// recorded node and records the result.
|
|
|
|
class EmitNodeXFormMatcherNode : public MatcherNode {
|
|
|
|
unsigned Slot;
|
|
|
|
Record *NodeXForm;
|
|
|
|
public:
|
|
|
|
EmitNodeXFormMatcherNode(unsigned slot, Record *nodeXForm)
|
|
|
|
: MatcherNode(EmitNodeXForm), Slot(slot), NodeXForm(nodeXForm) {}
|
|
|
|
|
|
|
|
unsigned getSlot() const { return Slot; }
|
|
|
|
Record *getNodeXForm() const { return NodeXForm; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == EmitNodeXForm;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
2010-02-18 22:03:03 +00:00
|
|
|
|
|
|
|
/// EmitNodeMatcherNode - This signals a successful match and generates a node.
|
|
|
|
class EmitNodeMatcherNode : public MatcherNode {
|
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 03:22:59 +00:00
|
|
|
std::string OpcodeName;
|
|
|
|
const SmallVector<MVT::SimpleValueType, 3> VTs;
|
|
|
|
const SmallVector<unsigned, 6> Operands;
|
|
|
|
bool HasChain, HasFlag, HasMemRefs;
|
|
|
|
|
|
|
|
/// 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:
|
|
|
|
EmitNodeMatcherNode(const std::string &opcodeName,
|
|
|
|
const MVT::SimpleValueType *vts, unsigned numvts,
|
|
|
|
const unsigned *operands, unsigned numops,
|
|
|
|
bool hasChain, bool hasFlag, bool hasmemrefs,
|
|
|
|
int numfixedarityoperands)
|
|
|
|
: MatcherNode(EmitNode), OpcodeName(opcodeName),
|
|
|
|
VTs(vts, vts+numvts), Operands(operands, operands+numops),
|
|
|
|
HasChain(hasChain), HasFlag(hasFlag), HasMemRefs(hasmemrefs),
|
|
|
|
NumFixedArityOperands(numfixedarityoperands) {}
|
|
|
|
|
|
|
|
const std::string &getOpcodeName() const { return OpcodeName; }
|
|
|
|
|
|
|
|
unsigned getNumVTs() const { return VTs.size(); }
|
|
|
|
MVT::SimpleValueType getVT(unsigned i) const {
|
|
|
|
assert(i < VTs.size());
|
|
|
|
return VTs[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned getNumOperands() const { return Operands.size(); }
|
|
|
|
unsigned getOperand(unsigned i) const {
|
|
|
|
assert(i < Operands.size());
|
|
|
|
return Operands[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
bool hasChain() const { return HasChain; }
|
|
|
|
bool hasFlag() const { return HasFlag; }
|
|
|
|
bool hasMemRefs() const { return HasMemRefs; }
|
|
|
|
int getNumFixedArityOperands() const { return NumFixedArityOperands; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == EmitNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
2010-02-21 06:03:07 +00:00
|
|
|
|
2010-02-24 05:33:42 +00:00
|
|
|
/// MarkFlagResultsMatcherNode - This node indicates which non-root nodes in the
|
|
|
|
/// pattern produce flags. This allows CompleteMatchMatcherNode to update them
|
|
|
|
/// with the output flag of the resultant code.
|
|
|
|
class MarkFlagResultsMatcherNode : public MatcherNode {
|
|
|
|
SmallVector<unsigned, 3> FlagResultNodes;
|
|
|
|
public:
|
|
|
|
MarkFlagResultsMatcherNode(const unsigned *nodes, unsigned NumNodes)
|
|
|
|
: MatcherNode(MarkFlagResults), FlagResultNodes(nodes, nodes+NumNodes) {}
|
|
|
|
|
|
|
|
unsigned getNumNodes() const { return FlagResultNodes.size(); }
|
|
|
|
|
|
|
|
unsigned getNode(unsigned i) const {
|
|
|
|
assert(i < FlagResultNodes.size());
|
|
|
|
return FlagResultNodes[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
|
|
|
return N->getKind() == MarkFlagResults;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
|
|
|
|
2010-02-21 06:03:07 +00:00
|
|
|
/// CompleteMatchMatcherNode - Complete a match by replacing the results of the
|
|
|
|
/// pattern with the newly generated nodes. This also prints a comment
|
|
|
|
/// indicating the source and dest patterns.
|
|
|
|
class CompleteMatchMatcherNode : public MatcherNode {
|
|
|
|
SmallVector<unsigned, 2> Results;
|
2010-02-18 22:03:03 +00:00
|
|
|
const PatternToMatch &Pattern;
|
|
|
|
public:
|
2010-02-21 06:03:07 +00:00
|
|
|
CompleteMatchMatcherNode(const unsigned *results, unsigned numresults,
|
|
|
|
const PatternToMatch &pattern)
|
|
|
|
: MatcherNode(CompleteMatch), Results(results, results+numresults),
|
|
|
|
Pattern(pattern) {}
|
|
|
|
|
|
|
|
unsigned getNumResults() const { return Results.size(); }
|
|
|
|
unsigned getResult(unsigned R) const { return Results[R]; }
|
2010-02-18 22:03:03 +00:00
|
|
|
const PatternToMatch &getPattern() const { return Pattern; }
|
|
|
|
|
|
|
|
static inline bool classof(const MatcherNode *N) {
|
2010-02-21 06:03:07 +00:00
|
|
|
return N->getKind() == CompleteMatch;
|
2010-02-18 22:03:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void print(raw_ostream &OS, unsigned indent = 0) const;
|
|
|
|
};
|
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 03:22:59 +00:00
|
|
|
|
2010-02-17 06:23:39 +00:00
|
|
|
|
2010-02-15 08:04:42 +00:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|