From: Simon Atanasyan Date: Thu, 17 Jul 2014 20:57:54 +0000 (+0000) Subject: [Mips] s/context/ctx/ for consistency and reduce lines lengths. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2d8d6d4890dae9c4d9dfb9022492cd733d5c122;p=platform%2Fupstream%2Fllvm.git [Mips] s/context/ctx/ for consistency and reduce lines lengths. No functional changes. llvm-svn: 213310 --- diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h b/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h index a5ff627..dde09dc 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h @@ -22,7 +22,7 @@ template class MipsTargetLayout; template class MipsDynamicLibraryWriter : public DynamicLibraryWriter { public: - MipsDynamicLibraryWriter(MipsLinkingContext &context, + MipsDynamicLibraryWriter(MipsLinkingContext &ctx, MipsTargetLayout &layout); protected: @@ -57,10 +57,9 @@ private: template MipsDynamicLibraryWriter::MipsDynamicLibraryWriter( - MipsLinkingContext &context, MipsTargetLayout &layout) - : DynamicLibraryWriter(context, layout), - _writeHelper(context, layout), - _mipsContext(context), _mipsTargetLayout(layout) {} + MipsLinkingContext &ctx, MipsTargetLayout &layout) + : DynamicLibraryWriter(ctx, layout), _writeHelper(ctx, layout), + _mipsContext(ctx), _mipsTargetLayout(layout) {} template bool MipsDynamicLibraryWriter::createImplicitFiles( diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h b/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h index 46e1e25..9a3832a 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicTable.h @@ -21,9 +21,9 @@ template class MipsTargetLayout; template class MipsDynamicTable : public DynamicTable { public: - MipsDynamicTable(MipsLinkingContext &context, + MipsDynamicTable(MipsLinkingContext &ctx, MipsTargetLayout &layout) - : DynamicTable(context, layout, ".dynamic", + : DynamicTable(ctx, layout, ".dynamic", DefaultLayout::ORDER_DYNAMIC), _mipsTargetLayout(layout) {} diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h b/lld/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h index 66121b2..7c8607e 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFWriters.h @@ -19,9 +19,8 @@ template class MipsTargetLayout; template class MipsELFWriter { public: - MipsELFWriter(MipsLinkingContext &context, - MipsTargetLayout &targetLayout) - : _context(context), _targetLayout(targetLayout) {} + MipsELFWriter(MipsLinkingContext &ctx, MipsTargetLayout &targetLayout) + : _ctx(ctx), _targetLayout(targetLayout) {} void setELFHeader(ELFHeader &elfHeader) { elfHeader.e_version(1); @@ -36,13 +35,13 @@ public: // merge them and write result here. uint32_t flags = llvm::ELF::EF_MIPS_NOREORDER | llvm::ELF::EF_MIPS_ABI_O32 | llvm::ELF::EF_MIPS_CPIC | llvm::ELF::EF_MIPS_ARCH_32R2; - if (_context.getOutputELFType() == llvm::ELF::ET_DYN) + if (_ctx.getOutputELFType() == llvm::ELF::ET_DYN) flags |= EF_MIPS_PIC; elfHeader.e_flags(flags); } void finalizeMipsRuntimeAtomValues() { - if (!_context.isDynamic()) + if (!_ctx.isDynamic()) return; auto gotSection = _targetLayout.findOutputSection(".got"); @@ -60,8 +59,8 @@ public: } std::unique_ptr> createRuntimeFile() { - auto file = llvm::make_unique>(_context); - if (_context.isDynamic()) { + auto file = llvm::make_unique>(_ctx); + if (_ctx.isDynamic()) { file->addAbsoluteAtom("_GLOBAL_OFFSET_TABLE_"); file->addAbsoluteAtom("_gp"); file->addAbsoluteAtom("_gp_disp"); @@ -80,7 +79,7 @@ public: } private: - MipsLinkingContext &_context; + MipsLinkingContext &_ctx; MipsTargetLayout &_targetLayout; void setAtomValue(StringRef name, uint64_t value) { diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h b/lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h index 49f5597..cb1a987 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h @@ -22,8 +22,7 @@ template class MipsTargetLayout; template class MipsExecutableWriter : public ExecutableWriter { public: - MipsExecutableWriter(MipsLinkingContext &context, - MipsTargetLayout &layout); + MipsExecutableWriter(MipsLinkingContext &ctx, MipsTargetLayout &layout); protected: void buildDynamicSymbolTable(const File &file) override; @@ -58,10 +57,10 @@ private: }; template -MipsExecutableWriter::MipsExecutableWriter(MipsLinkingContext &context, +MipsExecutableWriter::MipsExecutableWriter(MipsLinkingContext &ctx, MipsTargetLayout &layout) - : ExecutableWriter(context, layout), _writeHelper(context, layout), - _mipsContext(context), _mipsTargetLayout(layout) {} + : ExecutableWriter(ctx, layout), _writeHelper(ctx, layout), + _mipsContext(ctx), _mipsTargetLayout(layout) {} template void MipsExecutableWriter::buildDynamicSymbolTable(const File &file) { diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp index 237a733..4fea252 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp @@ -154,13 +154,13 @@ public: template class RelocationPass : public Pass { public: - RelocationPass(MipsLinkingContext &context); + RelocationPass(MipsLinkingContext &ctx); void perform(std::unique_ptr &mf) override; private: /// \brief Reference to the linking context. - const MipsLinkingContext &_context; + const MipsLinkingContext &_ctx; /// \brief Owner of all the Atoms created by this pass. RelocationPassFile _file; @@ -259,8 +259,8 @@ private: }; template -RelocationPass::RelocationPass(MipsLinkingContext &context) - : _context(context), _file(context), _gotLDMEntry(nullptr) { +RelocationPass::RelocationPass(MipsLinkingContext &ctx) + : _ctx(ctx), _file(ctx), _gotLDMEntry(nullptr) { _localGotVector.push_back(new (_file._alloc) GOT0Atom(_file)); _localGotVector.push_back(new (_file._alloc) GOTModulePointerAtom(_file)); } @@ -449,7 +449,7 @@ bool RelocationPass::mightBeDynamic(const MipsELFDefinedAtom &atom, if ((atom.section()->sh_flags & SHF_ALLOC) == 0) return false; - if (_context.getOutputELFType() == llvm::ELF::ET_DYN) + if (_ctx.getOutputELFType() == llvm::ELF::ET_DYN) return true; if (!isMipsReadonly(atom)) return true; @@ -503,7 +503,7 @@ bool RelocationPass::isDynamic(const Atom *atom) const { if (sa) return true; - if (_context.getOutputELFType() == llvm::ELF::ET_DYN) { + if (_ctx.getOutputELFType() == llvm::ELF::ET_DYN) { if (da && da->scope() != DefinedAtom::scopeTranslationUnit) return true; @@ -568,7 +568,7 @@ bool RelocationPass::isLocalCall(const Atom *a) const { return true; // Calls to external symbols defined in an executable file resolved locally. - if (_context.getOutputELFType() == llvm::ELF::ET_EXEC) + if (_ctx.getOutputELFType() == llvm::ELF::ET_EXEC) return true; return false; diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h b/lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h index 8b483b1..b50482f 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h @@ -18,8 +18,8 @@ class MipsLinkingContext; /// \brief Handle Mips GOT section template class MipsGOTSection : public AtomSection { public: - MipsGOTSection(const MipsLinkingContext &context) - : AtomSection(context, ".got", DefinedAtom::typeGOT, + MipsGOTSection(const MipsLinkingContext &ctx) + : AtomSection(ctx, ".got", DefinedAtom::typeGOT, DefinedAtom::permRW_, MipsTargetLayout::ORDER_GOT), _hasNonLocal(false), _localCount(0) { @@ -95,8 +95,8 @@ private: /// \brief Handle Mips PLT section template class MipsPLTSection : public AtomSection { public: - MipsPLTSection(const MipsLinkingContext &context) - : AtomSection(context, ".plt", DefinedAtom::typeGOT, + MipsPLTSection(const MipsLinkingContext &ctx) + : AtomSection(ctx, ".plt", DefinedAtom::typeGOT, DefinedAtom::permR_X, MipsTargetLayout::ORDER_PLT) {} diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp index fc32ba3..3043686 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp @@ -18,22 +18,20 @@ using namespace elf; typedef llvm::object::ELFType Mips32ElELFType; -MipsTargetHandler::MipsTargetHandler(MipsLinkingContext &context) - : DefaultTargetHandler(context), _context(context), - _runtimeFile(new MipsRuntimeFile(context)), - _targetLayout(new MipsTargetLayout(context)), +MipsTargetHandler::MipsTargetHandler(MipsLinkingContext &ctx) + : DefaultTargetHandler(ctx), _ctx(ctx), + _runtimeFile(new MipsRuntimeFile(ctx)), + _targetLayout(new MipsTargetLayout(ctx)), _relocationHandler(new MipsTargetRelocationHandler(*_targetLayout)) {} std::unique_ptr MipsTargetHandler::getWriter() { - switch (_context.getOutputELFType()) { + switch (_ctx.getOutputELFType()) { case llvm::ELF::ET_EXEC: return std::unique_ptr( - new elf::MipsExecutableWriter(_context, - *_targetLayout)); + new MipsExecutableWriter(_ctx, *_targetLayout)); case llvm::ELF::ET_DYN: return std::unique_ptr( - new elf::MipsDynamicLibraryWriter(_context, - *_targetLayout)); + new MipsDynamicLibraryWriter(_ctx, *_targetLayout)); case llvm::ELF::ET_REL: llvm_unreachable("TODO: support -r mode"); default: diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h index ecba5dd..0b0589f 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.h @@ -124,14 +124,14 @@ private: template class MipsRuntimeFile final : public CRuntimeFile { public: - MipsRuntimeFile(const MipsLinkingContext &context) - : CRuntimeFile(context, "Mips runtime file") {} + MipsRuntimeFile(const MipsLinkingContext &ctx) + : CRuntimeFile(ctx, "Mips runtime file") {} }; /// \brief TargetHandler for Mips class MipsTargetHandler final : public DefaultTargetHandler { public: - MipsTargetHandler(MipsLinkingContext &context); + MipsTargetHandler(MipsLinkingContext &ctx); MipsTargetLayout &getTargetLayout() override { return *_targetLayout; @@ -151,7 +151,7 @@ public: private: static const Registry::KindStrings kindStrings[]; - MipsLinkingContext &_context; + MipsLinkingContext &_ctx; std::unique_ptr> _runtimeFile; std::unique_ptr> _targetLayout; std::unique_ptr _relocationHandler; @@ -160,11 +160,10 @@ private: template class MipsDynamicSymbolTable : public DynamicSymbolTable { public: - MipsDynamicSymbolTable(const MipsLinkingContext &context, + MipsDynamicSymbolTable(const MipsLinkingContext &ctx, MipsTargetLayout &layout) - : DynamicSymbolTable( - context, layout, ".dynsym", - DefaultLayout::ORDER_DYNAMIC_SYMBOLS), + : DynamicSymbolTable(ctx, layout, ".dynsym", + DefaultLayout::ORDER_DYNAMIC_SYMBOLS), _targetLayout(layout) {} void sortSymbols() override {