aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-28 22:14:32 +0000
committerChris Lattner <sabre@nondot.org>2010-02-28 22:14:32 +0000
commit5310654dc56c64b726bba7da82d568137ec81bbc (patch)
treea38406fd7ba32ae30c984fc1b20fe18c0704a14b /include
parentaa6d70802844ee17fc38ab99850faf4d02a8b76a (diff)
downloadexternal_llvm-5310654dc56c64b726bba7da82d568137ec81bbc.zip
external_llvm-5310654dc56c64b726bba7da82d568137ec81bbc.tar.gz
external_llvm-5310654dc56c64b726bba7da82d568137ec81bbc.tar.bz2
change a few opcodes to use VBRs instead of embedding
immediate sizes into the opcode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97423 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/DAGISelHeader.h106
-rw-r--r--include/llvm/CodeGen/SelectionDAGISel.h7
2 files changed, 30 insertions, 83 deletions
diff --git a/include/llvm/CodeGen/DAGISelHeader.h b/include/llvm/CodeGen/DAGISelHeader.h
index f30e41b..4183580 100644
--- a/include/llvm/CodeGen/DAGISelHeader.h
+++ b/include/llvm/CodeGen/DAGISelHeader.h
@@ -167,11 +167,6 @@ bool CheckOrImmediate(SDValue V, int64_t Val) {
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
@@ -186,28 +181,14 @@ GetInt2(const unsigned char *MatcherTable, unsigned &Idx) {
return Val;
}
-ALWAYS_INLINE static int32_t
-GetInt4(const unsigned char *MatcherTable, unsigned &Idx) {
- int32_t Val = (uint16_t)GetInt2(MatcherTable, Idx);
- Val |= int32_t(GetInt2(MatcherTable, Idx)) << 16;
- return Val;
-}
-
-ALWAYS_INLINE static int64_t
-GetInt8(const unsigned char *MatcherTable, unsigned &Idx) {
- int64_t Val = (uint32_t)GetInt4(MatcherTable, Idx);
- Val |= int64_t(GetInt4(MatcherTable, Idx)) << 32;
- return Val;
-}
-
/// GetVBR - decode a vbr encoding whose top bit is set.
-ALWAYS_INLINE static unsigned
-GetVBR(unsigned Val, const unsigned char *MatcherTable, unsigned &Idx) {
+ALWAYS_INLINE static uint64_t
+GetVBR(uint64_t Val, const unsigned char *MatcherTable, unsigned &Idx) {
assert(Val >= 128 && "Not a VBR");
Val &= 127; // Remove first vbr bit.
unsigned Shift = 7;
- unsigned NextBits;
+ uint64_t NextBits;
do {
NextBits = GetInt1(MatcherTable, Idx);
Val |= (NextBits&127) << Shift;
@@ -501,44 +482,27 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
}
continue;
}
- case OPC_CheckInteger1:
- if (CheckInteger(N, GetInt1(MatcherTable, MatcherIndex))) break;
- continue;
- case OPC_CheckInteger2:
- if (CheckInteger(N, GetInt2(MatcherTable, MatcherIndex))) break;
- continue;
- case OPC_CheckInteger4:
- if (CheckInteger(N, GetInt4(MatcherTable, MatcherIndex))) break;
- continue;
- case OPC_CheckInteger8:
- if (CheckInteger(N, GetInt8(MatcherTable, MatcherIndex))) break;
- continue;
-
- case OPC_CheckAndImm1:
- if (CheckAndImmediate(N, GetInt1(MatcherTable, MatcherIndex))) break;
- continue;
- case OPC_CheckAndImm2:
- if (CheckAndImmediate(N, GetInt2(MatcherTable, MatcherIndex))) break;
- continue;
- case OPC_CheckAndImm4:
- if (CheckAndImmediate(N, GetInt4(MatcherTable, MatcherIndex))) break;
- continue;
- case OPC_CheckAndImm8:
- if (CheckAndImmediate(N, GetInt8(MatcherTable, MatcherIndex))) break;
- continue;
-
- case OPC_CheckOrImm1:
- if (CheckOrImmediate(N, GetInt1(MatcherTable, MatcherIndex))) break;
- continue;
- case OPC_CheckOrImm2:
- if (CheckOrImmediate(N, GetInt2(MatcherTable, MatcherIndex))) break;
- continue;
- case OPC_CheckOrImm4:
- if (CheckOrImmediate(N, GetInt4(MatcherTable, MatcherIndex))) break;
+ case OPC_CheckInteger: {
+ int64_t Val = MatcherTable[MatcherIndex++];
+ if (Val & 128)
+ Val = GetVBR(Val, MatcherTable, MatcherIndex);
+ if (CheckInteger(N, Val)) break;
+ continue;
+ }
+ case OPC_CheckAndImm: {
+ int64_t Val = MatcherTable[MatcherIndex++];
+ if (Val & 128)
+ Val = GetVBR(Val, MatcherTable, MatcherIndex);
+ if (CheckAndImmediate(N, Val)) break;
continue;
- case OPC_CheckOrImm8:
- if (CheckOrImmediate(N, GetInt8(MatcherTable, MatcherIndex))) break;
+ }
+ case OPC_CheckOrImm: {
+ int64_t Val = MatcherTable[MatcherIndex++];
+ if (Val & 128)
+ Val = GetVBR(Val, MatcherTable, MatcherIndex);
+ if (CheckOrImmediate(N, Val)) break;
continue;
+ }
case OPC_CheckFoldableChainNode: {
assert(NodeStack.size() != 1 && "No parent node");
@@ -581,31 +545,15 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
continue;
}
- case OPC_EmitInteger1: {
- MVT::SimpleValueType VT =
- (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
- EmitInteger(GetInt1(MatcherTable, MatcherIndex), VT, RecordedNodes);
- continue;
- }
- case OPC_EmitInteger2: {
+ case OPC_EmitInteger: {
MVT::SimpleValueType VT =
(MVT::SimpleValueType)MatcherTable[MatcherIndex++];
- EmitInteger(GetInt2(MatcherTable, MatcherIndex), VT, RecordedNodes);
+ int64_t Val = MatcherTable[MatcherIndex++];
+ if (Val & 128)
+ Val = GetVBR(Val, MatcherTable, MatcherIndex);
+ RecordedNodes.push_back(CurDAG->getTargetConstant(Val, VT));
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;
- }
-
case OPC_EmitRegister: {
MVT::SimpleValueType VT =
(MVT::SimpleValueType)MatcherTable[MatcherIndex++];
diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h
index 4e2b4d5..8da16bf 100644
--- a/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/include/llvm/CodeGen/SelectionDAGISel.h
@@ -117,16 +117,15 @@ public:
OPC_CheckChild0Type, OPC_CheckChild1Type, OPC_CheckChild2Type,
OPC_CheckChild3Type, OPC_CheckChild4Type, OPC_CheckChild5Type,
OPC_CheckChild6Type, OPC_CheckChild7Type,
- OPC_CheckInteger1, OPC_CheckInteger2, OPC_CheckInteger4, OPC_CheckInteger8,
+ OPC_CheckInteger,
OPC_CheckCondCode,
OPC_CheckValueType,
OPC_CheckComplexPat,
- OPC_CheckAndImm1, OPC_CheckAndImm2, OPC_CheckAndImm4, OPC_CheckAndImm8,
- OPC_CheckOrImm1, OPC_CheckOrImm2, OPC_CheckOrImm4, OPC_CheckOrImm8,
+ OPC_CheckAndImm, OPC_CheckOrImm,
OPC_CheckFoldableChainNode,
OPC_CheckChainCompatible,
- OPC_EmitInteger1, OPC_EmitInteger2, OPC_EmitInteger4, OPC_EmitInteger8,
+ OPC_EmitInteger,
OPC_EmitRegister,
OPC_EmitConvertToTarget,
OPC_EmitMergeInputChains,