Make some non-constant static variables non-static or fully const.

Otherwise we have to emit thread-safe initialization for them. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230894 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2015-03-01 18:09:56 +00:00
parent bf4d9a8aaf
commit 30fa873958
4 changed files with 12 additions and 40 deletions

View File

@ -1186,7 +1186,7 @@ getUncompressedData(MCAsmLayout &Layout,
static bool static bool
prependCompressionHeader(uint64_t Size, prependCompressionHeader(uint64_t Size,
SmallVectorImpl<char> &CompressedContents) { SmallVectorImpl<char> &CompressedContents) {
static const StringRef Magic = "ZLIB"; const StringRef Magic = "ZLIB";
if (Size <= Magic.size() + sizeof(Size) + CompressedContents.size()) if (Size <= Magic.size() + sizeof(Size) + CompressedContents.size())
return false; return false;
if (sys::IsLittleEndianHost) if (sys::IsLittleEndianHost)

View File

@ -352,7 +352,7 @@ unsigned AArch64TTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
// We don't lower vector selects well that are wider than the register width. // We don't lower vector selects well that are wider than the register width.
if (ValTy->isVectorTy() && ISD == ISD::SELECT) { if (ValTy->isVectorTy() && ISD == ISD::SELECT) {
// We would need this many instructions to hide the scalarization happening. // We would need this many instructions to hide the scalarization happening.
unsigned AmortizationCost = 20; const unsigned AmortizationCost = 20;
static const TypeConversionCostTblEntry<MVT::SimpleValueType> static const TypeConversionCostTblEntry<MVT::SimpleValueType>
VectorSelectTbl[] = { VectorSelectTbl[] = {
{ ISD::SELECT, MVT::v16i1, MVT::v16i16, 16 * AmortizationCost }, { ISD::SELECT, MVT::v16i1, MVT::v16i16, 16 * AmortizationCost },

View File

@ -2443,27 +2443,16 @@ bool llvm::CC_PPC32_SVR4_Custom_AlignFPArgRegs(unsigned &ValNo, MVT &ValVT,
return false; return false;
} }
/// GetFPR - Get the set of FP registers that should be allocated for arguments, /// FPR - The set of FP registers that should be allocated for arguments,
/// on Darwin. /// on Darwin.
static const MCPhysReg *GetFPR() { static const MCPhysReg FPR[] = {PPC::F1, PPC::F2, PPC::F3, PPC::F4, PPC::F5,
static const MCPhysReg FPR[] = { PPC::F6, PPC::F7, PPC::F8, PPC::F9, PPC::F10,
PPC::F1, PPC::F2, PPC::F3, PPC::F4, PPC::F5, PPC::F6, PPC::F7, PPC::F11, PPC::F12, PPC::F13};
PPC::F8, PPC::F9, PPC::F10, PPC::F11, PPC::F12, PPC::F13
};
return FPR; /// QFPR - The set of QPX registers that should be allocated for arguments.
} static const MCPhysReg QFPR[] = {
PPC::QF1, PPC::QF2, PPC::QF3, PPC::QF4, PPC::QF5, PPC::QF6, PPC::QF7,
/// GetQFPR - Get the set of QPX registers that should be allocated for PPC::QF8, PPC::QF9, PPC::QF10, PPC::QF11, PPC::QF12, PPC::QF13};
/// arguments.
static const MCPhysReg *GetQFPR() {
static const MCPhysReg QFPR[] = {
PPC::QF1, PPC::QF2, PPC::QF3, PPC::QF4, PPC::QF5, PPC::QF6, PPC::QF7,
PPC::QF8, PPC::QF9, PPC::QF10, PPC::QF11, PPC::QF12, PPC::QF13
};
return QFPR;
}
/// CalculateStackSlotSize - Calculates the size reserved for this argument on /// CalculateStackSlotSize - Calculates the size reserved for this argument on
/// the stack. /// the stack.
@ -2887,9 +2876,6 @@ PPCTargetLowering::LowerFormalArguments_64SVR4(
PPC::X3, PPC::X4, PPC::X5, PPC::X6, PPC::X3, PPC::X4, PPC::X5, PPC::X6,
PPC::X7, PPC::X8, PPC::X9, PPC::X10, PPC::X7, PPC::X8, PPC::X9, PPC::X10,
}; };
static const MCPhysReg *FPR = GetFPR();
static const MCPhysReg VR[] = { static const MCPhysReg VR[] = {
PPC::V2, PPC::V3, PPC::V4, PPC::V5, PPC::V6, PPC::V7, PPC::V8, PPC::V2, PPC::V3, PPC::V4, PPC::V5, PPC::V6, PPC::V7, PPC::V8,
PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
@ -2899,8 +2885,6 @@ PPCTargetLowering::LowerFormalArguments_64SVR4(
PPC::VSH9, PPC::VSH10, PPC::VSH11, PPC::VSH12, PPC::VSH13 PPC::VSH9, PPC::VSH10, PPC::VSH11, PPC::VSH12, PPC::VSH13
}; };
static const MCPhysReg *QFPR = GetQFPR();
const unsigned Num_GPR_Regs = array_lengthof(GPR); const unsigned Num_GPR_Regs = array_lengthof(GPR);
const unsigned Num_FPR_Regs = 13; const unsigned Num_FPR_Regs = 13;
const unsigned Num_VR_Regs = array_lengthof(VR); const unsigned Num_VR_Regs = array_lengthof(VR);
@ -3298,9 +3282,6 @@ PPCTargetLowering::LowerFormalArguments_Darwin(
PPC::X3, PPC::X4, PPC::X5, PPC::X6, PPC::X3, PPC::X4, PPC::X5, PPC::X6,
PPC::X7, PPC::X8, PPC::X9, PPC::X10, PPC::X7, PPC::X8, PPC::X9, PPC::X10,
}; };
static const MCPhysReg *FPR = GetFPR();
static const MCPhysReg VR[] = { static const MCPhysReg VR[] = {
PPC::V2, PPC::V3, PPC::V4, PPC::V5, PPC::V6, PPC::V7, PPC::V8, PPC::V2, PPC::V3, PPC::V4, PPC::V5, PPC::V6, PPC::V7, PPC::V8,
PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
@ -4589,8 +4570,6 @@ PPCTargetLowering::LowerCall_64SVR4(SDValue Chain, SDValue Callee,
PPC::X3, PPC::X4, PPC::X5, PPC::X6, PPC::X3, PPC::X4, PPC::X5, PPC::X6,
PPC::X7, PPC::X8, PPC::X9, PPC::X10, PPC::X7, PPC::X8, PPC::X9, PPC::X10,
}; };
static const MCPhysReg *FPR = GetFPR();
static const MCPhysReg VR[] = { static const MCPhysReg VR[] = {
PPC::V2, PPC::V3, PPC::V4, PPC::V5, PPC::V6, PPC::V7, PPC::V8, PPC::V2, PPC::V3, PPC::V4, PPC::V5, PPC::V6, PPC::V7, PPC::V8,
PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
@ -4600,8 +4579,6 @@ PPCTargetLowering::LowerCall_64SVR4(SDValue Chain, SDValue Callee,
PPC::VSH9, PPC::VSH10, PPC::VSH11, PPC::VSH12, PPC::VSH13 PPC::VSH9, PPC::VSH10, PPC::VSH11, PPC::VSH12, PPC::VSH13
}; };
static const MCPhysReg *QFPR = GetQFPR();
const unsigned NumGPRs = array_lengthof(GPR); const unsigned NumGPRs = array_lengthof(GPR);
const unsigned NumFPRs = 13; const unsigned NumFPRs = 13;
const unsigned NumVRs = array_lengthof(VR); const unsigned NumVRs = array_lengthof(VR);
@ -5287,8 +5264,6 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
PPC::X3, PPC::X4, PPC::X5, PPC::X6, PPC::X3, PPC::X4, PPC::X5, PPC::X6,
PPC::X7, PPC::X8, PPC::X9, PPC::X10, PPC::X7, PPC::X8, PPC::X9, PPC::X10,
}; };
static const MCPhysReg *FPR = GetFPR();
static const MCPhysReg VR[] = { static const MCPhysReg VR[] = {
PPC::V2, PPC::V3, PPC::V4, PPC::V5, PPC::V6, PPC::V7, PPC::V8, PPC::V2, PPC::V3, PPC::V4, PPC::V5, PPC::V6, PPC::V7, PPC::V8,
PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13 PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13
@ -6425,7 +6400,7 @@ static SDValue BuildSplatI(int Val, unsigned SplatSize, EVT VT,
SelectionDAG &DAG, SDLoc dl) { SelectionDAG &DAG, SDLoc dl) {
assert(Val >= -16 && Val <= 15 && "vsplti is out of range!"); assert(Val >= -16 && Val <= 15 && "vsplti is out of range!");
static const EVT VTys[] = { // canonical VT to use for each size. static const MVT VTys[] = { // canonical VT to use for each size.
MVT::v16i8, MVT::v8i16, MVT::Other, MVT::v4i32 MVT::v16i8, MVT::v8i16, MVT::Other, MVT::v4i32
}; };

View File

@ -583,10 +583,7 @@ unsigned SIInstrInfo::calculateLDSSpillAddress(MachineBasicBlock &MBB,
unsigned TIDIGZReg = TRI->getPreloadedValue(*MF, SIRegisterInfo::TIDIG_Z); unsigned TIDIGZReg = TRI->getPreloadedValue(*MF, SIRegisterInfo::TIDIG_Z);
unsigned InputPtrReg = unsigned InputPtrReg =
TRI->getPreloadedValue(*MF, SIRegisterInfo::INPUT_PTR); TRI->getPreloadedValue(*MF, SIRegisterInfo::INPUT_PTR);
static const unsigned TIDIGRegs[3] = { for (unsigned Reg : {TIDIGXReg, TIDIGYReg, TIDIGZReg}) {
TIDIGXReg, TIDIGYReg, TIDIGZReg
};
for (unsigned Reg : TIDIGRegs) {
if (!Entry.isLiveIn(Reg)) if (!Entry.isLiveIn(Reg))
Entry.addLiveIn(Reg); Entry.addLiveIn(Reg);
} }