[llvm] r267103 - Refactor IRObjectFile, extract a static CollectAsmUndefinedRefs() method to parse inline assembly (NFC)
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 22:15:02 PDT 2016
Yeah I fixed it almost immediately in r267104: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/3875
MSVC is happy with a move of the enum to create the std::pair. I have no idea why but I'm interested to understand if you know?
--
Mehdi
> On Apr 21, 2016, at 10:04 PM, Sean Silva <chisophugis at gmail.com> wrote:
>
> This seems to break VS2015: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/3874 <http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/3874>
>
> -- Sean Silva
>
> On Thu, Apr 21, 2016 at 9:28 PM, Mehdi Amini via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> Author: mehdi_amini
> Date: Thu Apr 21 23:28:05 2016
> New Revision: 267103
>
> URL: http://llvm.org/viewvc/llvm-project?rev=267103&view=rev <http://llvm.org/viewvc/llvm-project?rev=267103&view=rev>
> Log:
> Refactor IRObjectFile, extract a static CollectAsmUndefinedRefs() method to parse inline assembly (NFC)
>
> I plan to call this from ThinLTOCodeGenerator.
>
> From: Mehdi Amini <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>>
>
> Modified:
> llvm/trunk/include/llvm/Object/IRObjectFile.h
> llvm/trunk/lib/Object/IRObjectFile.cpp
>
> Modified: llvm/trunk/include/llvm/Object/IRObjectFile.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/IRObjectFile.h?rev=267103&r1=267102&r2=267103&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/IRObjectFile.h?rev=267103&r1=267102&r2=267103&view=diff>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/IRObjectFile.h (original)
> +++ llvm/trunk/include/llvm/Object/IRObjectFile.h Thu Apr 21 23:28:05 2016
> @@ -59,6 +59,16 @@ public:
> /// error code if not found.
> static ErrorOr<MemoryBufferRef> findBitcodeInObject(const ObjectFile &Obj);
>
> + /// Parse inline ASM and collect the symbols that are not defined in
> + /// the current module.
> + ///
> + /// For each found symbol, call \p AsmUndefinedRefs with the name of the
> + /// symbol found and the associated flags.
> + static void CollectAsmUndefinedRefs(
> + Module &TheModule,
> + const std::function<void(StringRef, BasicSymbolRef::Flags)> &
> + AsmUndefinedRefs);
> +
> /// \brief Finds and returns bitcode in the given memory buffer (which may
> /// be either a bitcode file or a native object file with embedded bitcode),
> /// or an error code if not found.
>
> Modified: llvm/trunk/lib/Object/IRObjectFile.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=267103&r1=267102&r2=267103&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=267103&r1=267102&r2=267103&view=diff>
> ==============================================================================
> --- llvm/trunk/lib/Object/IRObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/IRObjectFile.cpp Thu Apr 21 23:28:05 2016
> @@ -38,12 +38,24 @@ using namespace object;
> IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> Mod)
> : SymbolicFile(Binary::ID_IR, Object), M(std::move(Mod)) {
> Mang.reset(new Mangler());
> + CollectAsmUndefinedRefs(*M, [this](StringRef Name,
> + BasicSymbolRef::Flags Flags) {
> + AsmSymbols.push_back(std::make_pair<std::string, uint32_t>(Name, Flags));
> + });
> +}
> +
> +// Parse inline ASM and collect the list of symbols that are not defined in
> +// the current module. This is inspired from IRObjectFile.
> +void IRObjectFile::CollectAsmUndefinedRefs(
> + Module &TheModule,
> + const std::function<void(StringRef, BasicSymbolRef::Flags)> &
> + AsmUndefinedRefs) {
>
> - const std::string &InlineAsm = M->getModuleInlineAsm();
> + const std::string &InlineAsm = TheModule.getModuleInlineAsm();
> if (InlineAsm.empty())
> return;
>
> - Triple TT(M->getTargetTriple());
> + Triple TT(TheModule.getTargetTriple());
> std::string Err;
> const Target *T = TargetRegistry::lookupTarget(TT.str(), Err);
> if (!T)
> @@ -106,8 +118,7 @@ IRObjectFile::IRObjectFile(MemoryBufferR
> Res |= BasicSymbolRef::SF_Global;
> break;
> }
> - AsmSymbols.push_back(
> - std::make_pair<std::string, uint32_t>(Key, std::move(Res)));
> + AsmUndefinedRefs(Key, BasicSymbolRef::Flags(Res));
> }
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160421/68b0a2cc/attachment.html>
More information about the llvm-commits
mailing list