[llvm-commits] [llvm] r96663 - in /llvm/trunk: include/llvm/CodeGen/DAGISelHeader.h utils/TableGen/DAGISelMatcher.h utils/TableGen/DAGISelMatcherEmitter.cpp
Chris Lattner
sabre at nondot.org
Thu Feb 18 23:49:56 PST 2010
Author: lattner
Date: Fri Feb 19 01:49:56 2010
New Revision: 96663
URL: http://llvm.org/viewvc/llvm-project?rev=96663&view=rev
Log:
add emitter support for integer constants and simple physreg references.
Modified:
llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h
llvm/trunk/utils/TableGen/DAGISelMatcher.h
llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=96663&r1=96662&r2=96663&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Fri Feb 19 01:49:56 2010
@@ -172,6 +172,11 @@
return true;
}
+void EmitInteger(int64_t Val, MVT::SimpleValueType VT,
+ SmallVectorImpl<SDValue> &RecordedNodes) {
+ RecordedNodes.push_back(CurDAG->getTargetConstant(Val, VT));
+}
+
// These functions are marked always inline so that Idx doesn't get pinned to
// the stack.
ALWAYS_INLINE static int8_t
@@ -218,7 +223,10 @@
OPC_CheckAndImm1, OPC_CheckAndImm2, OPC_CheckAndImm4, OPC_CheckAndImm8,
OPC_CheckOrImm1, OPC_CheckOrImm2, OPC_CheckOrImm4, OPC_CheckOrImm8,
OPC_CheckFoldableChainNode,
- OPC_CheckChainCompatible
+ OPC_CheckChainCompatible,
+
+ OPC_EmitInteger1, OPC_EmitInteger2, OPC_EmitInteger4, OPC_EmitInteger8,
+ OPC_EmitRegister
};
struct MatchScope {
@@ -417,6 +425,39 @@
break;
continue;
}
+
+ case OPC_EmitRegister: {
+ unsigned RegNo = MatcherTable[MatcherIndex++];
+ MVT::SimpleValueType VT =
+ (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+ SDValue Reg = CurDAG->getRegister(RegNo, VT);
+ RecordedNodes.push_back(N);
+ continue;
+ }
+ case OPC_EmitInteger1: {
+ MVT::SimpleValueType VT =
+ (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+ EmitInteger(GetInt1(MatcherTable, MatcherIndex), VT, RecordedNodes);
+ continue;
+ }
+ case OPC_EmitInteger2: {
+ MVT::SimpleValueType VT =
+ (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+ EmitInteger(GetInt2(MatcherTable, MatcherIndex), VT, RecordedNodes);
+ continue;
+ }
+ case OPC_EmitInteger4: {
+ MVT::SimpleValueType VT =
+ (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+ EmitInteger(GetInt4(MatcherTable, MatcherIndex), VT, RecordedNodes);
+ continue;
+ }
+ case OPC_EmitInteger8: {
+ MVT::SimpleValueType VT =
+ (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+ EmitInteger(GetInt8(MatcherTable, MatcherIndex), VT, RecordedNodes);
+ continue;
+ }
}
// If the code reached this point, then the match failed pop out to the next
Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.h?rev=96663&r1=96662&r2=96663&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.h (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.h Fri Feb 19 01:49:56 2010
@@ -386,7 +386,7 @@
EmitIntegerMatcherNode(int64_t val, MVT::SimpleValueType vt)
: MatcherNode(EmitInteger), Val(val), VT(vt) {}
- int64_t getVal() const { return Val; }
+ int64_t getValue() const { return Val; }
MVT::SimpleValueType getVT() const { return VT; }
static inline bool classof(const MatcherNode *N) {
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=96663&r1=96662&r2=96663&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp Fri Feb 19 01:49:56 2010
@@ -213,10 +213,21 @@
<< cast<CheckChainCompatibleMatcherNode>(N)->getPreviousOp() << ",\n";
return 2;
- case MatcherNode::EmitInteger:
+ case MatcherNode::EmitInteger: {
+ int64_t Val = cast<EmitIntegerMatcherNode>(N)->getValue();
+ OS << "OPC_EmitInteger" << ClassifyInt(Val) << ", "
+ << getEnumName(cast<EmitIntegerMatcherNode>(N)->getVT()) << ", ";
+ return EmitInt(Val, OS)+2;
+ }
+
case MatcherNode::EmitRegister:
- // FIXME: Implement.
- return 0;
+ OS << "OPC_EmitRegister, "
+ << getEnumName(cast<EmitRegisterMatcherNode>(N)->getVT()) << ", ";
+ if (Record *R = cast<EmitRegisterMatcherNode>(N)->getReg())
+ OS << getQualifiedName(R) << ",\n";
+ else
+ OS << "0 /*zero_reg*/,\n";
+ return 3;
}
assert(0 && "Unreachable");
return 0;
More information about the llvm-commits
mailing list