[llvm] r311288 - Move helper classes into anonymous namespaces.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 20 06:03:49 PDT 2017
Author: d0k
Date: Sun Aug 20 06:03:48 2017
New Revision: 311288
URL: http://llvm.org/viewvc/llvm-project?rev=311288&view=rev
Log:
Move helper classes into anonymous namespaces.
No functionality change intended.
Modified:
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
llvm/trunk/lib/IR/SafepointIRVerifier.cpp
llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp
llvm/trunk/lib/ObjectYAML/DWARFVisitor.cpp
llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPULibFunc.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp
llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
llvm/trunk/lib/XRay/Trace.cpp
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Sun Aug 20 06:03:48 2017
@@ -4031,6 +4031,7 @@ void llvm::WriteIndexToFile(
Out.write((char *)&Buffer.front(), Buffer.size());
}
+namespace {
/// Class to manage the bitcode writing for a thin link bitcode file.
class ThinLinkBitcodeWriter : public ModuleBitcodeWriterBase {
/// ModHash is for use in ThinLTO incremental build, generated while writing
@@ -4051,6 +4052,7 @@ public:
private:
void writeSimplifiedModuleInfo();
};
+} // namespace
// This function writes a simpilified module info for thin link bitcode file.
// It only contains the source file name along with the name(the offset and
Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Sun Aug 20 06:03:48 2017
@@ -1656,6 +1656,7 @@ static bool despeculateCountZeros(Intrin
return true;
}
+namespace {
// This class provides helper functions to expand a memcmp library call into an
// inline expansion.
class MemCmpExpansion {
@@ -1703,6 +1704,7 @@ public:
unsigned NumLoadsPerBlock, const DataLayout &DL);
Value *getMemCmpExpansion(uint64_t Size);
};
+} // namespace
MemCmpExpansion::ResultBlock::ResultBlock()
: BB(nullptr), PhiSrc1(nullptr), PhiSrc2(nullptr) {}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sun Aug 20 06:03:48 2017
@@ -7015,6 +7015,7 @@ static bool createVirtualRegs(SmallVecto
return true;
}
+namespace {
class ExtraFlags {
unsigned Flags = 0;
@@ -7048,6 +7049,7 @@ public:
unsigned get() const { return Flags; }
};
+} // namespace
/// visitInlineAsm - Handle a call to an InlineAsm object.
///
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Aug 20 06:03:48 2017
@@ -1287,10 +1287,10 @@ static void propagateSwiftErrorVRegs(Fun
}
}
-void preassignSwiftErrorRegs(const TargetLowering *TLI,
- FunctionLoweringInfo *FuncInfo,
- BasicBlock::const_iterator Begin,
- BasicBlock::const_iterator End) {
+static void preassignSwiftErrorRegs(const TargetLowering *TLI,
+ FunctionLoweringInfo *FuncInfo,
+ BasicBlock::const_iterator Begin,
+ BasicBlock::const_iterator End) {
if (!TLI->supportSwiftError() || FuncInfo->SwiftErrorVals.empty())
return;
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Sun Aug 20 06:03:48 2017
@@ -927,7 +927,6 @@ namespace {
struct DWARFSectionMap final : public DWARFSection {
RelocAddrMap Relocs;
};
-} // namespace
class DWARFObjInMemory final : public DWARFObject {
bool IsLittleEndian;
@@ -1279,6 +1278,7 @@ public:
F(P.second);
}
};
+} // namespace
std::unique_ptr<DWARFContext>
DWARFContext::create(const object::ObjectFile &Obj, const LoadedObjectInfo *L,
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp Sun Aug 20 06:03:48 2017
@@ -169,7 +169,7 @@ Error GSIStreamBuilder::finalizeMsfLayou
return Error::success();
}
-bool comparePubSymByAddrAndName(const CVSymbol *LS, const CVSymbol *RS) {
+static bool comparePubSymByAddrAndName(const CVSymbol *LS, const CVSymbol *RS) {
assert(LS->kind() == SymbolKind::S_PUB32);
assert(RS->kind() == SymbolKind::S_PUB32);
Modified: llvm/trunk/lib/IR/SafepointIRVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/SafepointIRVerifier.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/IR/SafepointIRVerifier.cpp (original)
+++ llvm/trunk/lib/IR/SafepointIRVerifier.cpp Sun Aug 20 06:03:48 2017
@@ -60,6 +60,7 @@ static cl::opt<bool> PrintOnly("safepoin
static void Verify(const Function &F, const DominatorTree &DT);
+namespace {
struct SafepointIRVerifier : public FunctionPass {
static char ID; // Pass identification, replacement for typeid
DominatorTree DT;
@@ -79,6 +80,7 @@ struct SafepointIRVerifier : public Func
StringRef getPassName() const override { return "safepoint verifier"; }
};
+} // namespace
void llvm::verifySafepointIR(Function &F) {
SafepointIRVerifier pass;
Modified: llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/DWARFEmitter.cpp Sun Aug 20 06:03:48 2017
@@ -62,8 +62,8 @@ static void ZeroFillBytes(raw_ostream &O
OS.write(reinterpret_cast<char *>(FillData.data()), Size);
}
-void writeInitialLength(const DWARFYAML::InitialLength &Length, raw_ostream &OS,
- bool IsLittleEndian) {
+static void writeInitialLength(const DWARFYAML::InitialLength &Length,
+ raw_ostream &OS, bool IsLittleEndian) {
writeInteger((uint32_t)Length.TotalLength, OS, IsLittleEndian);
if (Length.isDWARF64())
writeInteger((uint64_t)Length.TotalLength64, OS, IsLittleEndian);
@@ -131,6 +131,7 @@ void DWARFYAML::EmitPubSection(raw_ostre
}
}
+namespace {
/// \brief An extension of the DWARFYAML::ConstVisitor which writes compile
/// units and DIEs to a stream.
class DumpVisitor : public DWARFYAML::ConstVisitor {
@@ -195,6 +196,7 @@ public:
DumpVisitor(const DWARFYAML::Data &DI, raw_ostream &Out)
: DWARFYAML::ConstVisitor(DI), OS(Out) {}
};
+} // namespace
void DWARFYAML::EmitDebugInfo(raw_ostream &OS, const DWARFYAML::Data &DI) {
DumpVisitor Visitor(DI, OS);
Modified: llvm/trunk/lib/ObjectYAML/DWARFVisitor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/DWARFVisitor.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/DWARFVisitor.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/DWARFVisitor.cpp Sun Aug 20 06:03:48 2017
@@ -34,11 +34,11 @@ void DWARFYAML::VisitorImpl<T>::onVariab
}
}
-unsigned getOffsetSize(const DWARFYAML::Unit &Unit) {
+static unsigned getOffsetSize(const DWARFYAML::Unit &Unit) {
return Unit.Length.isDWARF64() ? 8 : 4;
}
-unsigned getRefSize(const DWARFYAML::Unit &Unit) {
+static unsigned getRefSize(const DWARFYAML::Unit &Unit) {
if (Unit.Version == 2)
return Unit.AddrSize;
return getOffsetSize(Unit);
Modified: llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64CallLowering.cpp Sun Aug 20 06:03:48 2017
@@ -50,6 +50,7 @@ using namespace llvm;
AArch64CallLowering::AArch64CallLowering(const AArch64TargetLowering &TLI)
: CallLowering(&TLI) {}
+namespace {
struct IncomingArgHandler : public CallLowering::ValueHandler {
IncomingArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI,
CCAssignFn *AssignFn)
@@ -167,6 +168,7 @@ struct OutgoingArgHandler : public CallL
CCAssignFn *AssignFnVarArg;
uint64_t StackSize;
};
+} // namespace
void AArch64CallLowering::splitToValueTypes(
const ArgInfo &OrigArg, SmallVectorImpl<ArgInfo> &SplitArgs,
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPULibFunc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPULibFunc.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPULibFunc.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPULibFunc.cpp Sun Aug 20 06:03:48 2017
@@ -516,10 +516,12 @@ bool AMDGPULibFunc::parseName(const Stri
///////////////////////////////////////////////////////////////////////////////
// Itanium Demangling
+namespace {
struct ItaniumParamParser {
AMDGPULibFunc::Param Prev;
bool parseItaniumParam(StringRef& param, AMDGPULibFunc::Param &res);
};
+} // namespace
bool ItaniumParamParser::parseItaniumParam(StringRef& param,
AMDGPULibFunc::Param &res) {
@@ -689,7 +691,7 @@ static const char *getItaniumTypeName(AM
return nullptr;
}
-
+namespace {
// Itanium mangling ABI says:
// "5.1.8. Compression
// ... Each non-terminal in the grammar for which <substitution> appears on the
@@ -784,6 +786,7 @@ public:
if (Ptr.ArgType) Str.push_back(Ptr);
}
};
+} // namespace
std::string AMDGPULibFunc::mangleNameItanium() const {
SmallString<128> Buf;
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Aug 20 06:03:48 2017
@@ -8782,7 +8782,8 @@ static bool matchVectorShuffleAsBlend(SD
return true;
}
-uint64_t scaleVectorShuffleBlendMask(uint64_t BlendMask, int Size, int Scale) {
+static uint64_t scaleVectorShuffleBlendMask(uint64_t BlendMask, int Size,
+ int Scale) {
uint64_t ScaledMask = 0;
for (int i = 0; i != Size; ++i)
if (BlendMask & (1ull << i))
Modified: llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp Sun Aug 20 06:03:48 2017
@@ -167,7 +167,7 @@ X86InstructionSelector::getRegClass(LLT
return getRegClass(Ty, RegBank);
}
-unsigned getSubRegIndex(const TargetRegisterClass *RC) {
+static unsigned getSubRegIndex(const TargetRegisterClass *RC) {
unsigned SubIdx = X86::NoSubRegister;
if (RC == &X86::GR32RegClass) {
SubIdx = X86::sub_32bit;
@@ -180,7 +180,7 @@ unsigned getSubRegIndex(const TargetRegi
return SubIdx;
}
-const TargetRegisterClass *getRegClassFromGRPhysReg(unsigned Reg) {
+static const TargetRegisterClass *getRegClassFromGRPhysReg(unsigned Reg) {
assert(TargetRegisterInfo::isPhysicalRegister(Reg));
if (X86::GR64RegClass.contains(Reg))
return &X86::GR64RegClass;
@@ -403,8 +403,9 @@ unsigned X86InstructionSelector::getLoad
}
// Fill in an address from the given instruction.
-void X86SelectAddress(const MachineInstr &I, const MachineRegisterInfo &MRI,
- X86AddressMode &AM) {
+static void X86SelectAddress(const MachineInstr &I,
+ const MachineRegisterInfo &MRI,
+ X86AddressMode &AM) {
assert(I.getOperand(0).isReg() && "unsupported opperand.");
assert(MRI.getType(I.getOperand(0).getReg()).isPointer() &&
Modified: llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/NewGVN.cpp Sun Aug 20 06:03:48 2017
@@ -148,6 +148,7 @@ PHIExpression::~PHIExpression() = defaul
}
}
+namespace {
// Tarjan's SCC finding algorithm with Nuutila's improvements
// SCCIterator is actually fairly complex for the simple thing we want.
// It also wants to hand us SCC's that are unrelated to the phi node we ask
@@ -380,6 +381,7 @@ private:
// This is used so we can detect store equivalence changes properly.
int StoreCount = 0;
};
+} // namespace
namespace llvm {
struct ExactEqualsExpression {
Modified: llvm/trunk/lib/XRay/Trace.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/XRay/Trace.cpp?rev=311288&r1=311287&r2=311288&view=diff
==============================================================================
--- llvm/trunk/lib/XRay/Trace.cpp (original)
+++ llvm/trunk/lib/XRay/Trace.cpp Sun Aug 20 06:03:48 2017
@@ -21,6 +21,7 @@ using namespace llvm;
using namespace llvm::xray;
using llvm::yaml::Input;
+namespace {
using XRayRecordStorage =
std::aligned_storage<sizeof(XRayRecord), alignof(XRayRecord)>::type;
@@ -134,7 +135,7 @@ struct FDRState {
uint64_t CurrentBufferConsumed;
};
-Twine fdrStateToTwine(const FDRState::Token &state) {
+const char *fdrStateToTwine(const FDRState::Token &state) {
switch (state) {
case FDRState::Token::NEW_BUFFER_RECORD_OR_EOF:
return "NEW_BUFFER_RECORD_OR_EOF";
@@ -484,6 +485,7 @@ Error loadYAMLLog(StringRef Data, XRayFi
});
return Error::success();
}
+} // namespace
Expected<Trace> llvm::xray::loadTraceFile(StringRef Filename, bool Sort) {
int Fd;
More information about the llvm-commits
mailing list