llvm.org GIT mirror llvm / c773276
Move helper classes into anonymous namespaces. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311288 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 2 years ago
15 changed file(s) with 38 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
40304030 Out.write((char *)&Buffer.front(), Buffer.size());
40314031 }
40324032
4033 namespace {
40334034 /// Class to manage the bitcode writing for a thin link bitcode file.
40344035 class ThinLinkBitcodeWriter : public ModuleBitcodeWriterBase {
40354036 /// ModHash is for use in ThinLTO incremental build, generated while writing
40504051 private:
40514052 void writeSimplifiedModuleInfo();
40524053 };
4054 } // namespace
40534055
40544056 // This function writes a simpilified module info for thin link bitcode file.
40554057 // It only contains the source file name along with the name(the offset and
16551655 return true;
16561656 }
16571657
1658 namespace {
16581659 // This class provides helper functions to expand a memcmp library call into an
16591660 // inline expansion.
16601661 class MemCmpExpansion {
17021703 unsigned NumLoadsPerBlock, const DataLayout &DL);
17031704 Value *getMemCmpExpansion(uint64_t Size);
17041705 };
1706 } // namespace
17051707
17061708 MemCmpExpansion::ResultBlock::ResultBlock()
17071709 : BB(nullptr), PhiSrc1(nullptr), PhiSrc2(nullptr) {}
70147014 return true;
70157015 }
70167016
7017 namespace {
70177018 class ExtraFlags {
70187019 unsigned Flags = 0;
70197020
70477048
70487049 unsigned get() const { return Flags; }
70497050 };
7051 } // namespace
70507052
70517053 /// visitInlineAsm - Handle a call to an InlineAsm object.
70527054 ///
12861286 }
12871287 }
12881288
1289 void preassignSwiftErrorRegs(const TargetLowering *TLI,
1290 FunctionLoweringInfo *FuncInfo,
1291 BasicBlock::const_iterator Begin,
1292 BasicBlock::const_iterator End) {
1289 static void preassignSwiftErrorRegs(const TargetLowering *TLI,
1290 FunctionLoweringInfo *FuncInfo,
1291 BasicBlock::const_iterator Begin,
1292 BasicBlock::const_iterator End) {
12931293 if (!TLI->supportSwiftError() || FuncInfo->SwiftErrorVals.empty())
12941294 return;
12951295
926926 struct DWARFSectionMap final : public DWARFSection {
927927 RelocAddrMap Relocs;
928928 };
929 } // namespace
930929
931930 class DWARFObjInMemory final : public DWARFObject {
932931 bool IsLittleEndian;
12781277 F(P.second);
12791278 }
12801279 };
1280 } // namespace
12811281
12821282 std::unique_ptr
12831283 DWARFContext::create(const object::ObjectFile &Obj, const LoadedObjectInfo *L,
168168 return Error::success();
169169 }
170170
171 bool comparePubSymByAddrAndName(const CVSymbol *LS, const CVSymbol *RS) {
171 static bool comparePubSymByAddrAndName(const CVSymbol *LS, const CVSymbol *RS) {
172172 assert(LS->kind() == SymbolKind::S_PUB32);
173173 assert(RS->kind() == SymbolKind::S_PUB32);
174174
5959
6060 static void Verify(const Function &F, const DominatorTree &DT);
6161
62 namespace {
6263 struct SafepointIRVerifier : public FunctionPass {
6364 static char ID; // Pass identification, replacement for typeid
6465 DominatorTree DT;
7879
7980 StringRef getPassName() const override { return "safepoint verifier"; }
8081 };
82 } // namespace
8183
8284 void llvm::verifySafepointIR(Function &F) {
8385 SafepointIRVerifier pass;
6161 OS.write(reinterpret_cast(FillData.data()), Size);
6262 }
6363
64 void writeInitialLength(const DWARFYAML::InitialLength &Length, raw_ostream &OS,
65 bool IsLittleEndian) {
64 static void writeInitialLength(const DWARFYAML::InitialLength &Length,
65 raw_ostream &OS, bool IsLittleEndian) {
6666 writeInteger((uint32_t)Length.TotalLength, OS, IsLittleEndian);
6767 if (Length.isDWARF64())
6868 writeInteger((uint64_t)Length.TotalLength64, OS, IsLittleEndian);
130130 }
131131 }
132132
133 namespace {
133134 /// \brief An extension of the DWARFYAML::ConstVisitor which writes compile
134135 /// units and DIEs to a stream.
135136 class DumpVisitor : public DWARFYAML::ConstVisitor {
194195 DumpVisitor(const DWARFYAML::Data &DI, raw_ostream &Out)
195196 : DWARFYAML::ConstVisitor(DI), OS(Out) {}
196197 };
198 } // namespace
197199
198200 void DWARFYAML::EmitDebugInfo(raw_ostream &OS, const DWARFYAML::Data &DI) {
199201 DumpVisitor Visitor(DI, OS);
3333 }
3434 }
3535
36 unsigned getOffsetSize(const DWARFYAML::Unit &Unit) {
36 static unsigned getOffsetSize(const DWARFYAML::Unit &Unit) {
3737 return Unit.Length.isDWARF64() ? 8 : 4;
3838 }
3939
40 unsigned getRefSize(const DWARFYAML::Unit &Unit) {
40 static unsigned getRefSize(const DWARFYAML::Unit &Unit) {
4141 if (Unit.Version == 2)
4242 return Unit.AddrSize;
4343 return getOffsetSize(Unit);
4949 AArch64CallLowering::AArch64CallLowering(const AArch64TargetLowering &TLI)
5050 : CallLowering(&TLI) {}
5151
52 namespace {
5253 struct IncomingArgHandler : public CallLowering::ValueHandler {
5354 IncomingArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI,
5455 CCAssignFn *AssignFn)
166167 CCAssignFn *AssignFnVarArg;
167168 uint64_t StackSize;
168169 };
170 } // namespace
169171
170172 void AArch64CallLowering::splitToValueTypes(
171173 const ArgInfo &OrigArg, SmallVectorImpl &SplitArgs,
515515 ///////////////////////////////////////////////////////////////////////////////
516516 // Itanium Demangling
517517
518 namespace {
518519 struct ItaniumParamParser {
519520 AMDGPULibFunc::Param Prev;
520521 bool parseItaniumParam(StringRef& param, AMDGPULibFunc::Param &res);
521522 };
523 } // namespace
522524
523525 bool ItaniumParamParser::parseItaniumParam(StringRef& param,
524526 AMDGPULibFunc::Param &res) {
688690 return nullptr;
689691 }
690692
691
693 namespace {
692694 // Itanium mangling ABI says:
693695 // "5.1.8. Compression
694696 // ... Each non-terminal in the grammar for which appears on the
783785 if (Ptr.ArgType) Str.push_back(Ptr);
784786 }
785787 };
788 } // namespace
786789
787790 std::string AMDGPULibFunc::mangleNameItanium() const {
788791 SmallString<128> Buf;
87818781 return true;
87828782 }
87838783
8784 uint64_t scaleVectorShuffleBlendMask(uint64_t BlendMask, int Size, int Scale) {
8784 static uint64_t scaleVectorShuffleBlendMask(uint64_t BlendMask, int Size,
8785 int Scale) {
87858786 uint64_t ScaledMask = 0;
87868787 for (int i = 0; i != Size; ++i)
87878788 if (BlendMask & (1ull << i))
166166 return getRegClass(Ty, RegBank);
167167 }
168168
169 unsigned getSubRegIndex(const TargetRegisterClass *RC) {
169 static unsigned getSubRegIndex(const TargetRegisterClass *RC) {
170170 unsigned SubIdx = X86::NoSubRegister;
171171 if (RC == &X86::GR32RegClass) {
172172 SubIdx = X86::sub_32bit;
179179 return SubIdx;
180180 }
181181
182 const TargetRegisterClass *getRegClassFromGRPhysReg(unsigned Reg) {
182 static const TargetRegisterClass *getRegClassFromGRPhysReg(unsigned Reg) {
183183 assert(TargetRegisterInfo::isPhysicalRegister(Reg));
184184 if (X86::GR64RegClass.contains(Reg))
185185 return &X86::GR64RegClass;
402402 }
403403
404404 // Fill in an address from the given instruction.
405 void X86SelectAddress(const MachineInstr &I, const MachineRegisterInfo &MRI,
406 X86AddressMode &AM) {
405 static void X86SelectAddress(const MachineInstr &I,
406 const MachineRegisterInfo &MRI,
407 X86AddressMode &AM) {
407408
408409 assert(I.getOperand(0).isReg() && "unsupported opperand.");
409410 assert(MRI.getType(I.getOperand(0).getReg()).isPointer() &&
147147 }
148148 }
149149
150 namespace {
150151 // Tarjan's SCC finding algorithm with Nuutila's improvements
151152 // SCCIterator is actually fairly complex for the simple thing we want.
152153 // It also wants to hand us SCC's that are unrelated to the phi node we ask
379380 // This is used so we can detect store equivalence changes properly.
380381 int StoreCount = 0;
381382 };
383 } // namespace
382384
383385 namespace llvm {
384386 struct ExactEqualsExpression {
2020 using namespace llvm::xray;
2121 using llvm::yaml::Input;
2222
23 namespace {
2324 using XRayRecordStorage =
2425 std::aligned_storage::type;
2526
133134 uint64_t CurrentBufferConsumed;
134135 };
135136
136 Twine fdrStateToTwine(const FDRState::Token &state) {
137 const char *fdrStateToTwine(const FDRState::Token &state) {
137138 switch (state) {
138139 case FDRState::Token::NEW_BUFFER_RECORD_OR_EOF:
139140 return "NEW_BUFFER_RECORD_OR_EOF";
483484 });
484485 return Error::success();
485486 }
487 } // namespace
486488
487489 Expected llvm::xray::loadTraceFile(StringRef Filename, bool Sort) {
488490 int Fd;