From cb71c72ccc9261e65661126e5c82648cbb02c5b4 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 13 Jul 2015 22:01:27 +0000 Subject: [PATCH] COFF: Inline Defined::getRVA because it's very hot. llvm-svn: 242075 --- lld/COFF/Symbols.cpp | 24 ------------------------ lld/COFF/Symbols.h | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp index 402dd43..68af7bc 100644 --- a/lld/COFF/Symbols.cpp +++ b/lld/COFF/Symbols.cpp @@ -161,30 +161,6 @@ std::string SymbolBody::getDebugName() { return N; } -uint64_t Defined::getRVA() { - switch (kind()) { - case DefinedAbsoluteKind: - return cast(this)->getRVA(); - case DefinedImportDataKind: - return cast(this)->getRVA(); - case DefinedImportThunkKind: - return cast(this)->getRVA(); - case DefinedLocalImportKind: - return cast(this)->getRVA(); - case DefinedCommonKind: - return cast(this)->getRVA(); - case DefinedRegularKind: - return cast(this)->getRVA(); - - case DefinedBitcodeKind: - llvm_unreachable("There is no address for a bitcode symbol."); - case LazyKind: - case UndefinedKind: - llvm_unreachable("Cannot get the address for an undefined symbol."); - } - llvm_unreachable("unknown symbol kind"); -} - uint64_t Defined::getFileOff() { switch (kind()) { case DefinedImportDataKind: diff --git a/lld/COFF/Symbols.h b/lld/COFF/Symbols.h index 5c8e55f..f569a42 100644 --- a/lld/COFF/Symbols.h +++ b/lld/COFF/Symbols.h @@ -360,6 +360,29 @@ private: BitcodeFile *File; }; +inline uint64_t Defined::getRVA() { + switch (kind()) { + case DefinedAbsoluteKind: + return cast(this)->getRVA(); + case DefinedImportDataKind: + return cast(this)->getRVA(); + case DefinedImportThunkKind: + return cast(this)->getRVA(); + case DefinedLocalImportKind: + return cast(this)->getRVA(); + case DefinedCommonKind: + return cast(this)->getRVA(); + case DefinedRegularKind: + return cast(this)->getRVA(); + case DefinedBitcodeKind: + llvm_unreachable("There is no address for a bitcode symbol."); + case LazyKind: + case UndefinedKind: + llvm_unreachable("Cannot get the address for an undefined symbol."); + } + llvm_unreachable("unknown symbol kind"); +} + } // namespace coff } // namespace lld -- 2.7.4