diff options
| author | Craig Topper <craig.topper@gmail.com> | 2012-04-21 18:58:38 +0000 | 
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2012-04-21 18:58:38 +0000 | 
| commit | 6eadae8e60aa0b3fcbae420ab2494a859ba804dc (patch) | |
| tree | 9de3a9c4f9313d42d98cdf49bd58fc53395e7ca1 /llvm/lib | |
| parent | 84973e56e3094d4b93d0f1eab9e251c239d6455c (diff) | |
| download | bcm5719-llvm-6eadae8e60aa0b3fcbae420ab2494a859ba804dc.tar.gz bcm5719-llvm-6eadae8e60aa0b3fcbae420ab2494a859ba804dc.zip  | |
Make some fixed arrays const. Use array_lengthof in a couple places instead of a hardcoded number.
llvm-svn: 155294
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 16 | 
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index ca26f7ed798..a03b97f3215 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -162,7 +162,7 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)    TD = getTargetData();    // Set up the TargetLowering object. -  static MVT IntVTs[] = { MVT::i8, MVT::i16, MVT::i32, MVT::i64 }; +  static const MVT IntVTs[] = { MVT::i8, MVT::i16, MVT::i32, MVT::i64 };    // X86 is weird, it always uses i8 for shift amounts and setcc results.    setBooleanContents(ZeroOrOneBooleanContent); @@ -345,7 +345,7 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)    // (low) operations are left as Legal, as there are single-result    // instructions for this in x86. Using the two-result multiply instructions    // when both high and low results are needed must be arranged by dagcombine. -  for (unsigned i = 0, e = 4; i != e; ++i) { +  for (unsigned i = 0; i != array_lengthof(IntVTs); ++i) {      MVT VT = IntVTs[i];      setOperationAction(ISD::MULHS, VT, Expand);      setOperationAction(ISD::MULHU, VT, Expand); @@ -492,7 +492,7 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)    setShouldFoldAtomicFences(true);    // Expand certain atomics -  for (unsigned i = 0, e = 4; i != e; ++i) { +  for (unsigned i = 0; i != array_lengthof(IntVTs); ++i) {      MVT VT = IntVTs[i];      setOperationAction(ISD::ATOMIC_CMP_SWAP, VT, Custom);      setOperationAction(ISD::ATOMIC_LOAD_SUB, VT, Custom); @@ -13043,7 +13043,7 @@ SDValue X86TargetLowering::PerformTruncateCombine(SDNode *N, SelectionDAG &DAG,      OpHi = DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, OpHi);      // PSHUFD -    int ShufMask1[] = {0, 2, 0, 0}; +    static const int ShufMask1[] = {0, 2, 0, 0};      OpLo = DAG.getVectorShuffle(VT, dl, OpLo, DAG.getUNDEF(VT),                                  ShufMask1); @@ -13051,7 +13051,7 @@ SDValue X86TargetLowering::PerformTruncateCombine(SDNode *N, SelectionDAG &DAG,                                  ShufMask1);      // MOVLHPS -    int ShufMask2[] = {0, 1, 4, 5}; +    static const int ShufMask2[] = {0, 1, 4, 5};      return DAG.getVectorShuffle(VT, dl, OpLo, OpHi, ShufMask2);    } @@ -13067,8 +13067,8 @@ SDValue X86TargetLowering::PerformTruncateCombine(SDNode *N, SelectionDAG &DAG,      OpHi = DAG.getNode(ISD::BITCAST, dl, MVT::v16i8, OpHi);      // PSHUFB -    int ShufMask1[] = {0,  1,  4,  5,  8,  9, 12, 13,  -                      -1, -1, -1, -1, -1, -1, -1, -1}; +    static const int ShufMask1[] = {0,  1,  4,  5,  8,  9, 12, 13, +                                   -1, -1, -1, -1, -1, -1, -1, -1};      OpLo = DAG.getVectorShuffle(MVT::v16i8, dl, OpLo,                                  DAG.getUNDEF(MVT::v16i8), @@ -13081,7 +13081,7 @@ SDValue X86TargetLowering::PerformTruncateCombine(SDNode *N, SelectionDAG &DAG,      OpHi = DAG.getNode(ISD::BITCAST, dl, MVT::v4i32, OpHi);      // MOVLHPS -    int ShufMask2[] = {0, 1, 4, 5}; +    static const int ShufMask2[] = {0, 1, 4, 5};      SDValue res = DAG.getVectorShuffle(MVT::v4i32, dl, OpLo, OpHi, ShufMask2);      return DAG.getNode(ISD::BITCAST, dl, MVT::v8i16, res);  | 

