Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h =================================================================== --- llvm/include/llvm/CodeGen/SelectionDAGISel.h +++ llvm/include/llvm/CodeGen/SelectionDAGISel.h @@ -295,7 +295,7 @@ llvm_unreachable("Tblgen should generate this!"); } - void SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable, + void SelectCodeCommon(SDNode *NodeToMatch, const unsigned short *MatcherTable, unsigned TableSize); /// Return true if complex patterns for this target can mutate the Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp =================================================================== --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2420,7 +2420,7 @@ /// GetVBR - decode a vbr encoding whose top bit is set. LLVM_ATTRIBUTE_ALWAYS_INLINE static uint64_t -GetVBR(uint64_t Val, const unsigned char *MatcherTable, unsigned &Idx) { +GetVBR(uint64_t Val, const unsigned short *MatcherTable, unsigned &Idx) { assert(Val >= 128 && "Not a VBR"); Val &= 127; // Remove first vbr bit. @@ -2617,7 +2617,7 @@ /// CheckSame - Implements OP_CheckSame. LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckSame(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, +CheckSame(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N, const SmallVectorImpl> &RecordedNodes) { // Accept if it is exactly the same as a previously recorded node. unsigned RecNo = MatcherTable[MatcherIndex++]; @@ -2627,7 +2627,7 @@ /// CheckChildSame - Implements OP_CheckChildXSame. LLVM_ATTRIBUTE_ALWAYS_INLINE static bool CheckChildSame( - const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, + const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N, const SmallVectorImpl> &RecordedNodes, unsigned ChildNo) { if (ChildNo >= N.getNumOperands()) @@ -2638,20 +2638,20 @@ /// CheckPatternPredicate - Implements OP_CheckPatternPredicate. LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckPatternPredicate(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckPatternPredicate(const unsigned short *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel) { return SDISel.CheckPatternPredicate(MatcherTable[MatcherIndex++]); } /// CheckNodePredicate - Implements OP_CheckNodePredicate. LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckNodePredicate(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckNodePredicate(const unsigned short *MatcherTable, unsigned &MatcherIndex, const SelectionDAGISel &SDISel, SDNode *N) { return SDISel.CheckNodePredicate(N, MatcherTable[MatcherIndex++]); } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckOpcode(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckOpcode(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDNode *N) { uint16_t Opc = MatcherTable[MatcherIndex++]; Opc |= (unsigned short)MatcherTable[MatcherIndex++] << 8; @@ -2659,7 +2659,7 @@ } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckType(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, +CheckType(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, const DataLayout &DL) { MVT::SimpleValueType VT = (MVT::SimpleValueType)MatcherTable[MatcherIndex++]; if (N.getValueType() == VT) return true; @@ -2669,7 +2669,7 @@ } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckChildType(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckChildType(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, const DataLayout &DL, unsigned ChildNo) { if (ChildNo >= N.getNumOperands()) @@ -2679,14 +2679,14 @@ } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckCondCode(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckCondCode(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N) { return cast(N)->get() == (ISD::CondCode)MatcherTable[MatcherIndex++]; } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckChild2CondCode(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckChild2CondCode(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N) { if (2 >= N.getNumOperands()) return false; @@ -2694,7 +2694,7 @@ } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckValueType(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckValueType(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N, const TargetLowering *TLI, const DataLayout &DL) { MVT::SimpleValueType VT = (MVT::SimpleValueType)MatcherTable[MatcherIndex++]; if (cast(N)->getVT() == VT) @@ -2716,7 +2716,7 @@ } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckInteger(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckInteger(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N) { int64_t Val = MatcherTable[MatcherIndex++]; if (Val & 128) @@ -2729,7 +2729,7 @@ } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckChildInteger(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckChildInteger(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N, unsigned ChildNo) { if (ChildNo >= N.getNumOperands()) return false; // Match fails if out of range child #. @@ -2737,7 +2737,7 @@ } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckAndImm(const unsigned char *MatcherTable, unsigned &MatcherIndex, +CheckAndImm(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N, const SelectionDAGISel &SDISel) { int64_t Val = MatcherTable[MatcherIndex++]; if (Val & 128) @@ -2750,7 +2750,7 @@ } LLVM_ATTRIBUTE_ALWAYS_INLINE static bool -CheckOrImm(const unsigned char *MatcherTable, unsigned &MatcherIndex, SDValue N, +CheckOrImm(const unsigned short *MatcherTable, unsigned &MatcherIndex, SDValue N, const SelectionDAGISel &SDISel) { int64_t Val = MatcherTable[MatcherIndex++]; if (Val & 128) @@ -2768,7 +2768,7 @@ /// known to pass, set Result=false and return the MatcherIndex to continue /// with. If the current predicate is unknown, set Result=false and return the /// MatcherIndex to continue with. -static unsigned IsPredicateKnownToFail(const unsigned char *Table, +static unsigned IsPredicateKnownToFail(const unsigned short *Table, unsigned Index, SDValue N, bool &Result, const SelectionDAGISel &SDISel, @@ -2915,7 +2915,7 @@ } // end anonymous namespace void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch, - const unsigned char *MatcherTable, + const unsigned short *MatcherTable, unsigned TableSize) { // FIXME: Should these even be selected? Handle these cases in the caller? switch (NodeToMatch->getOpcode()) { Index: llvm/utils/TableGen/DAGISelMatcherEmitter.cpp =================================================================== --- llvm/utils/TableGen/DAGISelMatcherEmitter.cpp +++ llvm/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -1142,7 +1142,7 @@ OS << " // Some target values are emitted as 2 bytes, TARGET_VAL handles\n"; OS << " // this.\n"; OS << " #define TARGET_VAL(X) X & 255, unsigned(X) >> 8\n"; - OS << " static const unsigned char MatcherTable[] = {\n"; + OS << " static const unsigned short MatcherTable[] = {\n"; TotalSize = MatcherEmitter.EmitMatcherList(TheMatcher, 1, 0, OS); OS << " 0\n }; // Total Array size is " << (TotalSize+1) << " bytes\n\n";