Move helpers into anonymous namespaces. NFC.

llvm-svn: 277916
This commit is contained in:
Benjamin Kramer 2016-08-06 11:13:10 +00:00
parent 70c93fa69a
commit b7d3311c77
15 changed files with 32 additions and 24 deletions

View File

@ -14,8 +14,6 @@
using namespace llvm; using namespace llvm;
class MCExpr;
unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) { unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
HasBeenUsed = true; HasBeenUsed = true;
auto IterBool = auto IterBool =

View File

@ -349,7 +349,7 @@ bool DwarfDebug::isLexicalScopeDIENull(LexicalScope *Scope) {
return !getLabelAfterInsn(Ranges.front().second); return !getLabelAfterInsn(Ranges.front().second);
} }
template <typename Func> void forBothCUs(DwarfCompileUnit &CU, Func F) { template <typename Func> static void forBothCUs(DwarfCompileUnit &CU, Func F) {
F(CU); F(CU);
if (auto *SkelCU = CU.getSkeleton()) if (auto *SkelCU = CU.getSkeleton())
F(*SkelCU); F(*SkelCU);

View File

@ -70,9 +70,10 @@ void LiveRegMatrix::releaseMemory() {
} }
} }
template<typename Callable> template <typename Callable>
bool foreachUnit(const TargetRegisterInfo *TRI, LiveInterval &VRegInterval, static bool foreachUnit(const TargetRegisterInfo *TRI,
unsigned PhysReg, Callable Func) { LiveInterval &VRegInterval, unsigned PhysReg,
Callable Func) {
if (VRegInterval.hasSubRanges()) { if (VRegInterval.hasSubRanges()) {
for (MCRegUnitMaskIterator Units(PhysReg, TRI); Units.isValid(); ++Units) { for (MCRegUnitMaskIterator Units(PhysReg, TRI); Units.isValid(); ++Units) {
unsigned Unit = (*Units).first; unsigned Unit = (*Units).first;

View File

@ -98,8 +98,9 @@ STATISTIC(NumTrytoPipeline, "Number of loops that we attempt to pipeline");
STATISTIC(NumPipelined, "Number of loops software pipelined"); STATISTIC(NumPipelined, "Number of loops software pipelined");
/// A command line option to turn software pipelining on or off. /// A command line option to turn software pipelining on or off.
cl::opt<bool> EnableSWP("enable-pipeliner", cl::Hidden, cl::init(true), static cl::opt<bool> EnableSWP("enable-pipeliner", cl::Hidden, cl::init(true),
cl::ZeroOrMore, cl::desc("Enable Software Pipelining")); cl::ZeroOrMore,
cl::desc("Enable Software Pipelining"));
/// A command line option to enable SWP at -Os. /// A command line option to enable SWP at -Os.
static cl::opt<bool> EnableSWPOptSize("enable-pipeliner-opt-size", static cl::opt<bool> EnableSWPOptSize("enable-pipeliner-opt-size",

View File

@ -22,7 +22,7 @@ using namespace llvm;
#define DEBUG_TYPE "ip-regalloc" #define DEBUG_TYPE "ip-regalloc"
cl::opt<bool> DumpRegUsage( static cl::opt<bool> DumpRegUsage(
"print-regusage", cl::init(false), cl::Hidden, "print-regusage", cl::init(false), cl::Hidden,
cl::desc("print register usage details collected for analysis.")); cl::desc("print register usage details collected for analysis."));

View File

@ -256,8 +256,8 @@ bool ShrinkWrap::useOrDefCSROrFI(const MachineInstr &MI,
/// \brief Helper function to find the immediate (post) dominator. /// \brief Helper function to find the immediate (post) dominator.
template <typename ListOfBBs, typename DominanceAnalysis> template <typename ListOfBBs, typename DominanceAnalysis>
MachineBasicBlock *FindIDom(MachineBasicBlock &Block, ListOfBBs BBs, static MachineBasicBlock *FindIDom(MachineBasicBlock &Block, ListOfBBs BBs,
DominanceAnalysis &Dom) { DominanceAnalysis &Dom) {
MachineBasicBlock *IDom = &Block; MachineBasicBlock *IDom = &Block;
for (MachineBasicBlock *BB : BBs) { for (MachineBasicBlock *BB : BBs) {
IDom = Dom.findNearestCommonDominator(IDom, BB); IDom = Dom.findNearestCommonDominator(IDom, BB);

View File

@ -762,7 +762,7 @@ static bool isScope(const Metadata *MD) { return !MD || isa<DIScope>(MD); }
static bool isDINode(const Metadata *MD) { return !MD || isa<DINode>(MD); } static bool isDINode(const Metadata *MD) { return !MD || isa<DINode>(MD); }
template <class Ty> template <class Ty>
bool isValidMetadataArrayImpl(const MDTuple &N, bool AllowNull) { static bool isValidMetadataArrayImpl(const MDTuple &N, bool AllowNull) {
for (Metadata *MD : N.operands()) { for (Metadata *MD : N.operands()) {
if (MD) { if (MD) {
if (!isa<Ty>(MD)) if (!isa<Ty>(MD))
@ -775,13 +775,11 @@ bool isValidMetadataArrayImpl(const MDTuple &N, bool AllowNull) {
return true; return true;
} }
template <class Ty> template <class Ty> static bool isValidMetadataArray(const MDTuple &N) {
bool isValidMetadataArray(const MDTuple &N) {
return isValidMetadataArrayImpl<Ty>(N, /* AllowNull */ false); return isValidMetadataArrayImpl<Ty>(N, /* AllowNull */ false);
} }
template <class Ty> template <class Ty> static bool isValidMetadataNullArray(const MDTuple &N) {
bool isValidMetadataNullArray(const MDTuple &N) {
return isValidMetadataArrayImpl<Ty>(N, /* AllowNull */ true); return isValidMetadataArrayImpl<Ty>(N, /* AllowNull */ true);
} }

View File

@ -869,7 +869,7 @@ static bool produceCompactUnwindFrame(MachineFunction &MF) {
Attrs.hasAttrSomewhere(Attribute::SwiftError)); Attrs.hasAttrSomewhere(Attribute::SwiftError));
} }
namespace {
struct RegPairInfo { struct RegPairInfo {
RegPairInfo() : Reg1(AArch64::NoRegister), Reg2(AArch64::NoRegister) {} RegPairInfo() : Reg1(AArch64::NoRegister), Reg2(AArch64::NoRegister) {}
unsigned Reg1; unsigned Reg1;
@ -879,6 +879,7 @@ struct RegPairInfo {
bool IsGPR; bool IsGPR;
bool isPaired() const { return Reg2 != AArch64::NoRegister; } bool isPaired() const { return Reg2 != AArch64::NoRegister; }
}; };
} // end anonymous namespace
static void computeCalleeSaveRegisterPairs( static void computeCalleeSaveRegisterPairs(
MachineFunction &MF, const std::vector<CalleeSavedInfo> &CSI, MachineFunction &MF, const std::vector<CalleeSavedInfo> &CSI,

View File

@ -1028,6 +1028,7 @@ static bool areCFlagsAliveInSuccessors(MachineBasicBlock *MBB) {
return false; return false;
} }
namespace {
struct UsedNZCV { struct UsedNZCV {
bool N; bool N;
bool Z; bool Z;
@ -1042,6 +1043,7 @@ struct UsedNZCV {
return *this; return *this;
} }
}; };
} // end anonymous namespace
/// Find a condition code used by the instruction. /// Find a condition code used by the instruction.
/// Returns AArch64CC::Invalid if either the instruction does not use condition /// Returns AArch64CC::Invalid if either the instruction does not use condition

View File

@ -1583,6 +1583,7 @@ int HexagonDAGToDAGISel::getHeight(SDNode *N) {
return RootHeights[N]; return RootHeights[N];
} }
namespace {
struct WeightedLeaf { struct WeightedLeaf {
SDValue Value; SDValue Value;
int Weight; int Weight;
@ -1673,6 +1674,7 @@ public:
LeafPrioQueue(unsigned Opcode) : LeafPrioQueue(unsigned Opcode) :
HaveConst(false), Opcode(Opcode) { } HaveConst(false), Opcode(Opcode) { }
}; };
} // end anonymous namespace
WeightedLeaf LeafPrioQueue::findSHL(uint64_t MaxAmount) { WeightedLeaf LeafPrioQueue::findSHL(uint64_t MaxAmount) {
int ResultPos; int ResultPos;

View File

@ -51,6 +51,7 @@ using namespace llvm;
#define DEBUG_TYPE "misched" #define DEBUG_TYPE "misched"
namespace {
class HexagonCallMutation : public ScheduleDAGMutation { class HexagonCallMutation : public ScheduleDAGMutation {
public: public:
void apply(ScheduleDAGInstrs *DAG) override; void apply(ScheduleDAGInstrs *DAG) override;
@ -58,6 +59,7 @@ private:
bool shouldTFRICallBind(const HexagonInstrInfo &HII, bool shouldTFRICallBind(const HexagonInstrInfo &HII,
const SUnit &Inst1, const SUnit &Inst2) const; const SUnit &Inst1, const SUnit &Inst2) const;
}; };
} // end anonymous namespace
// Check if a call and subsequent A2_tfrpi instructions should maintain // Check if a call and subsequent A2_tfrpi instructions should maintain
// scheduling affinity. We are looking for the TFRI to be consumed in // scheduling affinity. We are looking for the TFRI to be consumed in

View File

@ -44,12 +44,6 @@ static cl::opt<bool>
STATISTIC(NumSubstLEAs, "Number of LEA instruction substitutions"); STATISTIC(NumSubstLEAs, "Number of LEA instruction substitutions");
STATISTIC(NumRedundantLEAs, "Number of redundant LEA instructions removed"); STATISTIC(NumRedundantLEAs, "Number of redundant LEA instructions removed");
class MemOpKey;
/// \brief Returns a hash table key based on memory operands of \p MI. The
/// number of the first memory operand of \p MI is specified through \p N.
static inline MemOpKey getMemOpKey(const MachineInstr &MI, unsigned N);
/// \brief Returns true if two machine operands are identical and they are not /// \brief Returns true if two machine operands are identical and they are not
/// physical registers. /// physical registers.
static inline bool isIdenticalOp(const MachineOperand &MO1, static inline bool isIdenticalOp(const MachineOperand &MO1,
@ -63,6 +57,7 @@ static bool isSimilarDispOp(const MachineOperand &MO1,
/// \brief Returns true if the instruction is LEA. /// \brief Returns true if the instruction is LEA.
static inline bool isLEA(const MachineInstr &MI); static inline bool isLEA(const MachineInstr &MI);
namespace {
/// A key based on instruction's memory operands. /// A key based on instruction's memory operands.
class MemOpKey { class MemOpKey {
public: public:
@ -95,6 +90,7 @@ public:
// Address' displacement operand. // Address' displacement operand.
const MachineOperand *Disp; const MachineOperand *Disp;
}; };
} // end anonymous namespace
/// Provide DenseMapInfo for MemOpKey. /// Provide DenseMapInfo for MemOpKey.
namespace llvm { namespace llvm {
@ -168,6 +164,8 @@ template <> struct DenseMapInfo<MemOpKey> {
}; };
} }
/// \brief Returns a hash table key based on memory operands of \p MI. The
/// number of the first memory operand of \p MI is specified through \p N.
static inline MemOpKey getMemOpKey(const MachineInstr &MI, unsigned N) { static inline MemOpKey getMemOpKey(const MachineInstr &MI, unsigned N) {
assert((isLEA(MI) || MI.mayLoadOrStore()) && assert((isLEA(MI) || MI.mayLoadOrStore()) &&
"The instruction must be a LEA, a load or a store"); "The instruction must be a LEA, a load or a store");

View File

@ -1703,6 +1703,7 @@ bool llvm::callsGCLeafFunction(ImmutableCallSite CS) {
return false; return false;
} }
namespace {
/// A potential constituent of a bitreverse or bswap expression. See /// A potential constituent of a bitreverse or bswap expression. See
/// collectBitParts for a fuller explanation. /// collectBitParts for a fuller explanation.
struct BitPart { struct BitPart {
@ -1718,6 +1719,7 @@ struct BitPart {
enum { Unset = -1 }; enum { Unset = -1 };
}; };
} // end anonymous namespace
/// Analyze the specified subexpression and see if it is capable of providing /// Analyze the specified subexpression and see if it is capable of providing
/// pieces of a bswap or bitreverse. The subexpression provides a potential /// pieces of a bswap or bitreverse. The subexpression provides a potential

View File

@ -19,6 +19,7 @@
using namespace llvm; using namespace llvm;
namespace {
// Compute a "unique" hash for the module based on the name of the public // Compute a "unique" hash for the module based on the name of the public
// functions. // functions.
class ModuleHasher { class ModuleHasher {
@ -57,6 +58,7 @@ public:
return TheHash; return TheHash;
} }
}; };
} // end anonymous namespace
// Rename all the anon functions in the module // Rename all the anon functions in the module
bool llvm::nameUnamedFunctions(Module &M) { bool llvm::nameUnamedFunctions(Module &M) {

View File

@ -3942,7 +3942,7 @@ static Value *createRdxShuffleMask(unsigned VecLen, unsigned NumEltsToRdx,
return ConstantVector::get(ShuffleMask); return ConstantVector::get(ShuffleMask);
} }
namespace {
/// Model horizontal reductions. /// Model horizontal reductions.
/// ///
/// A horizontal reduction is a tree of reduction operations (currently add and /// A horizontal reduction is a tree of reduction operations (currently add and
@ -4228,6 +4228,7 @@ private:
return Builder.CreateExtractElement(TmpVec, Builder.getInt32(0)); return Builder.CreateExtractElement(TmpVec, Builder.getInt32(0));
} }
}; };
} // end anonymous namespace
/// \brief Recognize construction of vectors like /// \brief Recognize construction of vectors like
/// %ra = insertelement <4 x float> undef, float %s0, i32 0 /// %ra = insertelement <4 x float> undef, float %s0, i32 0