From owner-svn-src-all@FreeBSD.ORG Sat Jan 31 19:27:34 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B24129CF; Sat, 31 Jan 2015 19:27:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99CC2B4; Sat, 31 Jan 2015 19:27:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0VJRYLQ048321; Sat, 31 Jan 2015 19:27:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0VJRTt5048292; Sat, 31 Jan 2015 19:27:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201501311927.t0VJRTt5048292@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 31 Jan 2015 19:27:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r277992 - in vendor/llvm/dist: docs include/llvm/IR include/llvm/MC include/llvm/Transforms/Utils lib/Analysis lib/CodeGen lib/CodeGen/AsmPrinter lib/IR lib/MC lib/Support lib/Target/AA... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2015 19:27:34 -0000 Author: dim Date: Sat Jan 31 19:27:28 2015 New Revision: 277992 URL: https://svnweb.freebsd.org/changeset/base/277992 Log: Vendor import of llvm RELEASE_360/rc2 tag r227651 (effectively, 3.6.0 RC2): https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360/rc2@227651 Added: vendor/llvm/dist/test/Analysis/ScalarEvolution/nw-sub-is-not-nw-add.ll vendor/llvm/dist/test/Bindings/llvm-c/add_named_metadata_operand.ll vendor/llvm/dist/test/Bindings/llvm-c/set_metadata.ll vendor/llvm/dist/test/CodeGen/AArch64/ghc-cc.ll vendor/llvm/dist/test/CodeGen/ARM/2015-01-21-thumbv4t-ldstr-opt.ll vendor/llvm/dist/test/CodeGen/R600/misaligned-load.ll vendor/llvm/dist/test/CodeGen/R600/scratch-buffer.ll vendor/llvm/dist/test/DebugInfo/Mips/fn-call-line.ll vendor/llvm/dist/test/MC/ARM/pr22395.s (contents, props changed) vendor/llvm/dist/test/Transforms/IndVarSimplify/pr22222.ll vendor/llvm/dist/tools/llvm-c-test/metadata.c (contents, props changed) Deleted: vendor/llvm/dist/test/MC/MachO/AArch64/mergeable.s vendor/llvm/dist/test/MC/MachO/x86_64-mergeable.s Modified: vendor/llvm/dist/docs/ReleaseNotes.rst vendor/llvm/dist/include/llvm/IR/LegacyPassManagers.h vendor/llvm/dist/include/llvm/MC/MCAsmBackend.h vendor/llvm/dist/include/llvm/MC/MCAssembler.h vendor/llvm/dist/include/llvm/MC/MCMachObjectWriter.h vendor/llvm/dist/include/llvm/MC/MCObjectWriter.h vendor/llvm/dist/include/llvm/Transforms/Utils/SimplifyLibCalls.h vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfUnit.cpp vendor/llvm/dist/lib/CodeGen/MachineFunctionPass.cpp vendor/llvm/dist/lib/IR/Core.cpp vendor/llvm/dist/lib/IR/LegacyPassManager.cpp vendor/llvm/dist/lib/MC/ELFObjectWriter.cpp vendor/llvm/dist/lib/MC/MCAsmInfoDarwin.cpp vendor/llvm/dist/lib/MC/MCAssembler.cpp vendor/llvm/dist/lib/MC/MachObjectWriter.cpp vendor/llvm/dist/lib/MC/WinCOFFObjectWriter.cpp vendor/llvm/dist/lib/Support/Triple.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64CallingConvention.td vendor/llvm/dist/lib/Target/AArch64/AArch64FastISel.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64FrameLowering.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64RegisterInfo.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp vendor/llvm/dist/lib/Target/ARM/ARMLoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/ARM/AsmParser/ARMAsmParser.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp vendor/llvm/dist/lib/Target/Mips/Mips16ISelLowering.cpp vendor/llvm/dist/lib/Target/Mips/Mips32r6InstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsISelLowering.cpp vendor/llvm/dist/lib/Target/Mips/MipsISelLowering.h vendor/llvm/dist/lib/Target/NVPTX/NVPTXAllocaHoisting.h vendor/llvm/dist/lib/Target/NVPTX/NVPTXLowerAggrCopies.h vendor/llvm/dist/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp vendor/llvm/dist/lib/Target/R600/AMDGPU.h vendor/llvm/dist/lib/Target/R600/AMDGPU.td vendor/llvm/dist/lib/Target/R600/AMDGPUAsmPrinter.cpp vendor/llvm/dist/lib/Target/R600/AMDGPUISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/R600/AMDGPUISelLowering.cpp vendor/llvm/dist/lib/Target/R600/AMDGPUInstrInfo.cpp vendor/llvm/dist/lib/Target/R600/AMDGPUInstrInfo.h vendor/llvm/dist/lib/Target/R600/AMDGPUMCInstLower.cpp vendor/llvm/dist/lib/Target/R600/AMDGPUMCInstLower.h vendor/llvm/dist/lib/Target/R600/AMDGPUSubtarget.cpp vendor/llvm/dist/lib/Target/R600/AMDGPUSubtarget.h vendor/llvm/dist/lib/Target/R600/MCTargetDesc/AMDGPUAsmBackend.cpp vendor/llvm/dist/lib/Target/R600/SIDefines.h vendor/llvm/dist/lib/Target/R600/SIISelLowering.cpp vendor/llvm/dist/lib/Target/R600/SIInstrFormats.td vendor/llvm/dist/lib/Target/R600/SIInstrInfo.cpp vendor/llvm/dist/lib/Target/R600/SIInstrInfo.h vendor/llvm/dist/lib/Target/R600/SIInstrInfo.td vendor/llvm/dist/lib/Target/R600/SIInstructions.td vendor/llvm/dist/lib/Target/R600/SIMachineFunctionInfo.h vendor/llvm/dist/lib/Target/R600/SIPrepareScratchRegs.cpp vendor/llvm/dist/lib/Target/R600/SIRegisterInfo.cpp vendor/llvm/dist/lib/Target/R600/SIRegisterInfo.h vendor/llvm/dist/lib/Target/R600/SIShrinkInstructions.cpp vendor/llvm/dist/lib/Target/R600/VIInstructions.td vendor/llvm/dist/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCalls.cpp vendor/llvm/dist/lib/Transforms/Scalar/GVN.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopInstSimplify.cpp vendor/llvm/dist/lib/Transforms/Utils/LowerSwitch.cpp vendor/llvm/dist/lib/Transforms/Utils/SimplifyIndVar.cpp vendor/llvm/dist/lib/Transforms/Utils/SimplifyLibCalls.cpp vendor/llvm/dist/lib/Transforms/Utils/SymbolRewriter.cpp vendor/llvm/dist/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp vendor/llvm/dist/test/CodeGen/AArch64/arm64-platform-reg.ll vendor/llvm/dist/test/CodeGen/Mips/fcmp.ll vendor/llvm/dist/test/CodeGen/R600/basic-loop.ll vendor/llvm/dist/test/CodeGen/R600/ctpop.ll vendor/llvm/dist/test/CodeGen/R600/ctpop64.ll vendor/llvm/dist/test/CodeGen/R600/ds_read2st64.ll vendor/llvm/dist/test/CodeGen/R600/fp_to_sint.ll vendor/llvm/dist/test/CodeGen/R600/hsa.ll vendor/llvm/dist/test/CodeGen/R600/si-triv-disjoint-mem-access.ll vendor/llvm/dist/test/CodeGen/SPARC/2008-10-10-InlineAsmMemoryOperand.ll vendor/llvm/dist/test/CodeGen/SPARC/inlineasm.ll vendor/llvm/dist/test/CodeGen/SPARC/mult-alt-generic-sparc.ll vendor/llvm/dist/test/DebugInfo/X86/decl-derived-member.ll vendor/llvm/dist/test/MC/ELF/relocation-386.s vendor/llvm/dist/test/MC/MachO/x86_64-symbols.s vendor/llvm/dist/test/SymbolRewriter/rewrite.ll vendor/llvm/dist/test/SymbolRewriter/rewrite.map vendor/llvm/dist/test/Transforms/GVN/edge.ll vendor/llvm/dist/test/Transforms/IndVarSimplify/strengthen-overflow.ll vendor/llvm/dist/test/Transforms/InstCombine/call-cast-target.ll vendor/llvm/dist/test/Transforms/InstCombine/memcpy_chk-1.ll vendor/llvm/dist/test/Transforms/InstCombine/memmove_chk-1.ll vendor/llvm/dist/test/Transforms/InstCombine/memset_chk-1.ll vendor/llvm/dist/test/Transforms/InstCombine/stpcpy_chk-1.ll vendor/llvm/dist/test/Transforms/InstCombine/strcpy_chk-1.ll vendor/llvm/dist/test/Transforms/InstCombine/strncpy_chk-1.ll vendor/llvm/dist/test/tools/gold/emit-llvm.ll vendor/llvm/dist/tools/gold/gold-plugin.cpp vendor/llvm/dist/tools/llvm-c-test/CMakeLists.txt vendor/llvm/dist/tools/llvm-c-test/llvm-c-test.h vendor/llvm/dist/tools/llvm-c-test/main.c vendor/llvm/dist/unittests/ADT/TripleTest.cpp vendor/llvm/dist/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp Modified: vendor/llvm/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist/docs/ReleaseNotes.rst Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/docs/ReleaseNotes.rst Sat Jan 31 19:27:28 2015 (r277992) @@ -102,6 +102,282 @@ enable handling of case (3). .. _discussions: http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073235.html +Metadata is not a Value +----------------------- + +Metadata nodes (``!{...}``) and strings (``!"..."``) are no longer values. +They have no use-lists, no type, cannot RAUW, and cannot be function-local. + +Bridges between Value and Metadata +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +LLVM intrinsics can reference metadata using the ``metadata`` type, and +metadata nodes can reference constant values. + +Function-local metadata is limited to direct arguments to LLVM intrinsics. + +Metadata is typeless +^^^^^^^^^^^^^^^^^^^^ + +The following old IR: + +.. code-block:: llvm + + @g = global i32 0 + + define void @foo(i32 %v) { + entry: + call void @llvm.md(metadata !{i32 %v}) + call void @llvm.md(metadata !{i32* @global}) + call void @llvm.md(metadata !0) + call void @llvm.md(metadata !{metadata !"string"}) + call void @llvm.md(metadata !{metadata !{metadata !1, metadata !"string"}}) + ret void, !bar !1, !baz !2 + } + + declare void @llvm.md(metadata) + + !0 = metadata !{metadata !1, metadata !2, metadata !3, metadata !"some string"} + !1 = metadata !{metadata !2, null, metadata !"other", i32* @global, i32 7} + !2 = metadata !{} + +should now be written as: + +.. code-block:: llvm + + @g = global i32 0 + + define void @foo(i32 %v) { + entry: + call void @llvm.md(metadata i32 %v) ; The only legal place for function-local + ; metadata. + call void @llvm.md(metadata i32* @global) + call void @llvm.md(metadata !0) + call void @llvm.md(metadata !{!"string"}) + call void @llvm.md(metadata !{!{!1, !"string"}}) + ret void, !bar !1, !baz !2 + } + + declare void @llvm.md(metadata) + + !0 = !{!1, !2, !3, !"some string"} + !1 = !{!2, null, !"other", i32* @global, i32 7} + !2 = !{} + +Distinct metadata nodes +^^^^^^^^^^^^^^^^^^^^^^^ + +Metadata nodes can opt-out of uniquing, using the keyword ``distinct``. +Distinct nodes are still owned by the context, but are stored in a side table, +and not uniqued. + +In LLVM 3.5, metadata nodes would drop uniquing if an operand changed to +``null`` during optimizations. This is no longer true. However, if an operand +change causes a uniquing collision, they become ``distinct``. Unlike LLVM 3.5, +where serializing to assembly or bitcode would re-unique the nodes, they now +remain ``distinct``. + +The following IR: + +.. code-block:: llvm + + !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} + + !0 = !{} + !1 = !{} + !2 = distinct !{} + !3 = distinct !{} + !4 = !{!0} + !5 = distinct !{!0} + !6 = !{!4, !{}, !5} + !7 = !{!{!0}, !0, !5} + !8 = distinct !{!{!0}, !0, !5} + +is equivalent to the following: + +.. code-block:: llvm + + !named = !{!0, !0, !1, !2, !3, !4, !5, !5, !6} + + !0 = !{} + !1 = distinct !{} + !2 = distinct !{} + !3 = !{!0} + !4 = distinct !{!0} + !5 = !{!3, !0, !4} + !6 = distinct !{!3, !0, !4} + +Constructing cyclic graphs +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +During graph construction, if a metadata node transitively references a forward +declaration, the node itself is considered "unresolved" until the forward +declaration resolves. An unresolved node can RAUW itself to support uniquing. +Nodes automatically resolve once all their operands have resolved. + +However, cyclic graphs prevent the nodes from resolving. An API client that +constructs a cyclic graph must call ``resolveCycles()`` to resolve nodes in the +cycle. + +To save self-references from that burden, self-referencing nodes are implicitly +``distinct``. So the following IR: + +.. code-block:: llvm + + !named = !{!0, !1, !2, !3, !4} + + !0 = !{!0} + !1 = !{!1} + !2 = !{!2, !1} + !3 = !{!2, !1} + !4 = !{!2, !1} + +is equivalent to: + +.. code-block:: llvm + + !named = !{!0, !1, !2, !3, !3} + + !0 = distinct !{!0} + !1 = distinct !{!1} + !2 = distinct !{!2, !1} + !3 = !{!2, !1} + +MDLocation (aka DebugLoc aka DILocation) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +There's a new first-class metadata construct called ``MDLocation`` (to be +followed in subsequent releases by others). It's used for the locations +referenced by ``!dbg`` metadata attachments. + +For example, if an old ``!dbg`` attachment looked like this: + +.. code-block:: llvm + + define i32 @foo(i32 %a, i32 %b) { + entry: + %add = add i32 %a, %b, !dbg !0 + ret %add, !dbg !1 + } + + !0 = metadata !{i32 10, i32 3, metadata !2, metadata !1) + !1 = metadata !{i32 20, i32 7, metadata !3) + !2 = metadata !{...} + !3 = metadata !{...} + +the new attachment looks like this: + +.. code-block:: llvm + + define i32 @foo(i32 %a, i32 %b) { + entry: + %add = add i32 %a, %b, !dbg !0 + ret %add, !dbg !1 + } + + !0 = !MDLocation(line: 10, column: 3, scope: !2, inlinedAt: !1) + !1 = !MDLocation(line: 20, column: 7, scope: !3) + !2 = !{...} + !3 = !{...} + +The fields are named, can be reordered, and have sane defaults if left out +(although ``scope:`` is required). + + +Alias syntax change +----------------------- + +The syntax for aliases is now closer to what is used for global variables + +.. code-block:: llvm + + @a = weak global ... + @b = weak alias ... + +The order of the ``alias`` keyword and the linkage was swapped before. + +The old JIT has been removed +---------------------------- + +All users should transition to MCJIT. + + +object::Binary doesn't owns the file buffer +------------------------------------------- + +It is now just a wrapper, which simplifies using object::Binary with other +users of the underlying file. + +IR in object files is now supported +----------------------------------- + +Regular object files can contain IR in a section named ``.llvmbc``. + + +The gold plugin has been rewritten +---------------------------------- + +It is now implemented directly on top of lib/Linker instead of ``lib/LTO``. +The API of ``lib/LTO`` is sufficiently different from gold's view of the +linking process that some cases could not be conveniently implemented. + +The new implementation is also lazier and has a ``save-temps`` option. + + +Change in the representation of lazy loaded funcs +------------------------------------------------- + +Lazy loaded functions are now represented is a way that ``isDeclaration`` +returns the correct answer even before reading the body. + + +The opt option -std-compile-opts was removed +-------------------------------------------- + +It was effectively an alias of -O3. + + +Python 2.7 is now required +-------------------------- + +This was done to simplify compatibility with python 3. + +The leak detector has been removed +---------------------------------- + +In practice tools like asan and valgrind were finding way more bugs than +the old leak detector, so it was removed. + + +New comdat syntax +----------------- + +The syntax of comdats was changed to + +.. code-block:: llvm + + $c = comdat any + @g = global i32 0, comdat($c) + @c = global i32 0, comdat + +The version without the parentheses is a syntatic sugar for a comdat with +the same name as the global. + + +Diagnotic infrastructure used by lib/Linker and lib/Bitcode +----------------------------------------------------------- + +These libraries now use the diagnostic handler to print errors and warnings. +This provides better error messages and simpler error handling. + + +The PreserveSource linker mode was removed +------------------------------------------ + +It was fairly broken and was removed. + + + Changes to the ARM Backend -------------------------- @@ -237,8 +513,35 @@ An exciting aspect of LLVM is that it is a lot of other language and tools projects. This section lists some of the projects that have already been updated to work with LLVM 3.6. -* A project +Portable Computing Language (pocl) +---------------------------------- +In addition to producing an easily portable open source OpenCL +implementation, another major goal of `pocl `_ +is improving performance portability of OpenCL programs with +compiler optimizations, reducing the need for target-dependent manual +optimizations. An important part of pocl is a set of LLVM passes used to +statically parallelize multiple work-items with the kernel compiler, even in +the presence of work-group barriers. This enables static parallelization of +the fine-grained static concurrency in the work groups in multiple ways. + +TTA-based Co-design Environment (TCE) +------------------------------------- + +`TCE `_ is a toolset for designing customized +exposed datapath processors based on the Transport triggered +architecture (TTA). + +The toolset provides a complete co-design flow from C/C++ +programs down to synthesizable VHDL/Verilog and parallel program binaries. +Processor customization points include the register files, function units, +supported operations, and the interconnection network. + +TCE uses Clang and LLVM for C/C++/OpenCL C language support, target independent +optimizations and also for parts of code generation. It generates +new LLVM-based code generators "on the fly" for the designed processors and +loads them in to the compiler backend as runtime libraries to avoid +per-target recompilation of larger parts of the compiler chain. Additional Information ====================== Modified: vendor/llvm/dist/include/llvm/IR/LegacyPassManagers.h ============================================================================== --- vendor/llvm/dist/include/llvm/IR/LegacyPassManagers.h Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/include/llvm/IR/LegacyPassManagers.h Sat Jan 31 19:27:28 2015 (r277992) @@ -195,6 +195,9 @@ public: /// then return NULL. Pass *findAnalysisPass(AnalysisID AID); + /// Retrieve the PassInfo for an analysis. + const PassInfo *findAnalysisPassInfo(AnalysisID AID) const; + /// Find analysis usage information for the pass P. AnalysisUsage *findAnalysisUsage(Pass *P); @@ -251,6 +254,12 @@ private: SmallVector ImmutablePasses; DenseMap AnUsageMap; + + /// Collection of PassInfo objects found via analysis IDs and in this top + /// level manager. This is used to memoize queries to the pass registry. + /// FIXME: This is an egregious hack because querying the pass registry is + /// either slow or racy. + mutable DenseMap AnalysisPassInfos; }; Modified: vendor/llvm/dist/include/llvm/MC/MCAsmBackend.h ============================================================================== --- vendor/llvm/dist/include/llvm/MC/MCAsmBackend.h Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/include/llvm/MC/MCAsmBackend.h Sat Jan 31 19:27:28 2015 (r277992) @@ -61,6 +61,12 @@ public: /// markers. If not, data region directives will be ignored. bool hasDataInCodeSupport() const { return HasDataInCodeSupport; } + /// doesSectionRequireSymbols - Check whether the given section requires that + /// all symbols (even temporaries) have symbol table entries. + virtual bool doesSectionRequireSymbols(const MCSection &Section) const { + return false; + } + /// @name Target Fixup Interfaces /// @{ Modified: vendor/llvm/dist/include/llvm/MC/MCAssembler.h ============================================================================== --- vendor/llvm/dist/include/llvm/MC/MCAssembler.h Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/include/llvm/MC/MCAssembler.h Sat Jan 31 19:27:28 2015 (r277992) @@ -11,7 +11,6 @@ #define LLVM_MC_MCASSEMBLER_H #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallString.h" @@ -882,8 +881,6 @@ private: iplist Symbols; - DenseSet LocalsUsedInReloc; - /// The map of sections to their associated assembler backend data. // // FIXME: Avoid this indirection? @@ -983,9 +980,6 @@ private: MCFragment &F, const MCFixup &Fixup); public: - void addLocalUsedInReloc(const MCSymbol &Sym); - bool isLocalUsedInReloc(const MCSymbol &Sym) const; - /// Compute the effective fragment size assuming it is laid out at the given /// \p SectionAddress and \p FragmentOffset. uint64_t computeFragmentSize(const MCAsmLayout &Layout, Modified: vendor/llvm/dist/include/llvm/MC/MCMachObjectWriter.h ============================================================================== --- vendor/llvm/dist/include/llvm/MC/MCMachObjectWriter.h Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/include/llvm/MC/MCMachObjectWriter.h Sat Jan 31 19:27:28 2015 (r277992) @@ -68,10 +68,12 @@ public: /// @name API /// @{ - virtual void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm, + virtual void RecordRelocation(MachObjectWriter *Writer, + const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, - const MCFixup &Fixup, MCValue Target, + const MCFixup &Fixup, + MCValue Target, uint64_t &FixedValue) = 0; /// @} @@ -95,14 +97,8 @@ class MachObjectWriter : public MCObject /// @name Relocation Data /// @{ - struct RelAndSymbol { - const MCSymbolData *Sym; - MachO::any_relocation_info MRE; - RelAndSymbol(const MCSymbolData *Sym, const MachO::any_relocation_info &MRE) - : Sym(Sym), MRE(MRE) {} - }; - - llvm::DenseMap> Relocations; + llvm::DenseMap > Relocations; llvm::DenseMap IndirectSymBase; /// @} @@ -217,15 +213,9 @@ public: // - Input errors, where something cannot be correctly encoded. 'as' allows // these through in many cases. - // Add a relocation to be output in the object file. At the time this is - // called, the symbol indexes are not know, so if the relocation refers - // to a symbol it should be passed as \p RelSymbol so that it can be updated - // afterwards. If the relocation doesn't refer to a symbol, nullptr should be - // used. - void addRelocation(const MCSymbolData *RelSymbol, const MCSectionData *SD, + void addRelocation(const MCSectionData *SD, MachO::any_relocation_info &MRE) { - RelAndSymbol P(RelSymbol, MRE); - Relocations[SD].push_back(P); + Relocations[SD].push_back(MRE); } void RecordScatteredRelocation(const MCAssembler &Asm, @@ -241,7 +231,7 @@ public: const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue); - void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, + void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue) override; Modified: vendor/llvm/dist/include/llvm/MC/MCObjectWriter.h ============================================================================== --- vendor/llvm/dist/include/llvm/MC/MCObjectWriter.h Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/include/llvm/MC/MCObjectWriter.h Sat Jan 31 19:27:28 2015 (r277992) @@ -76,10 +76,12 @@ public: /// post layout binding. The implementation is responsible for storing /// information about the relocation so that it can be emitted during /// WriteObject(). - virtual void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, + virtual void RecordRelocation(const MCAssembler &Asm, + const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, - bool &IsPCRel, uint64_t &FixedValue) = 0; + bool &IsPCRel, + uint64_t &FixedValue) = 0; /// \brief Check whether the difference (A - B) between two symbol /// references is fully resolved. Modified: vendor/llvm/dist/include/llvm/Transforms/Utils/SimplifyLibCalls.h ============================================================================== --- vendor/llvm/dist/include/llvm/Transforms/Utils/SimplifyLibCalls.h Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/include/llvm/Transforms/Utils/SimplifyLibCalls.h Sat Jan 31 19:27:28 2015 (r277992) @@ -17,6 +17,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/IR/IRBuilder.h" +#include "llvm/Target/TargetLibraryInfo.h" namespace llvm { class Value; @@ -53,8 +54,10 @@ private: Value *optimizeMemCpyChk(CallInst *CI, IRBuilder<> &B); Value *optimizeMemMoveChk(CallInst *CI, IRBuilder<> &B); Value *optimizeMemSetChk(CallInst *CI, IRBuilder<> &B); - Value *optimizeStrCpyChk(CallInst *CI, IRBuilder<> &B); - Value *optimizeStrNCpyChk(CallInst *CI, IRBuilder<> &B); + + // Str/Stp cpy are similar enough to be handled in the same functions. + Value *optimizeStrpCpyChk(CallInst *CI, IRBuilder<> &B, LibFunc::Func Func); + Value *optimizeStrpNCpyChk(CallInst *CI, IRBuilder<> &B, LibFunc::Func Func); /// \brief Checks whether the call \p CI to a fortified libcall is foldable /// to the non-fortified version. Modified: vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp ============================================================================== --- vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -3154,8 +3154,9 @@ const SCEV *ScalarEvolution::getMinusSCE if (LHS == RHS) return getConstant(LHS->getType(), 0); - // X - Y --> X + -Y - return getAddExpr(LHS, getNegativeSCEV(RHS), Flags); + // X - Y --> X + -Y. + // X -(nsw || nuw) Y --> X + -Y. + return getAddExpr(LHS, getNegativeSCEV(RHS)); } /// getTruncateOrZeroExtend - Return a SCEV corresponding to a conversion of the @@ -3461,12 +3462,10 @@ const SCEV *ScalarEvolution::createNodeF if (isKnownPositive(getMinusSCEV(getSCEV(GEP), Ptr))) Flags = setFlags(Flags, SCEV::FlagNUW); } - } else if (const SubOperator *OBO = - dyn_cast(BEValueV)) { - if (OBO->hasNoUnsignedWrap()) - Flags = setFlags(Flags, SCEV::FlagNUW); - if (OBO->hasNoSignedWrap()) - Flags = setFlags(Flags, SCEV::FlagNSW); + + // We cannot transfer nuw and nsw flags from subtraction + // operations -- sub nuw X, Y is not the same as add nuw X, -Y + // for instance. } const SCEV *StartVal = getSCEV(StartValueV); Modified: vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfUnit.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -626,10 +626,7 @@ static uint64_t getBaseTypeSize(DwarfDeb DIType BaseType = DD->resolve(Ty.getTypeDerivedFrom()); - // If this type is not derived from any type or the type is a declaration then - // take conservative approach. - if (!BaseType.isValid() || BaseType.isForwardDecl()) - return Ty.getSizeInBits(); + assert(BaseType.isValid()); // If this is a derived type, go ahead and get the base type, unless it's a // reference then it's just the size of the field. Pointer types have no need @@ -1473,7 +1470,7 @@ void DwarfUnit::constructMemberDIE(DIE & uint64_t FieldSize = getBaseTypeSize(DD, DT); uint64_t OffsetInBytes; - if (Size != FieldSize) { + if (FieldSize && Size != FieldSize) { // Handle bitfield, assume bytes are 8 bits. addUInt(MemberDie, dwarf::DW_AT_byte_size, None, FieldSize/8); addUInt(MemberDie, dwarf::DW_AT_bit_size, None, Size); Modified: vendor/llvm/dist/lib/CodeGen/MachineFunctionPass.cpp ============================================================================== --- vendor/llvm/dist/lib/CodeGen/MachineFunctionPass.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/CodeGen/MachineFunctionPass.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -11,11 +11,19 @@ // //===----------------------------------------------------------------------===// -#include "llvm/IR/Function.h" +#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/DominanceFrontier.h" +#include "llvm/Analysis/IVUsers.h" +#include "llvm/Analysis/LoopInfo.h" +#include "llvm/Analysis/LoopInfo.h" +#include "llvm/Analysis/MemoryDependenceAnalysis.h" +#include "llvm/Analysis/ScalarEvolution.h" #include "llvm/CodeGen/MachineFunctionAnalysis.h" -#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/StackProtector.h" +#include "llvm/IR/Dominators.h" +#include "llvm/IR/Function.h" using namespace llvm; Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O, @@ -43,15 +51,13 @@ void MachineFunctionPass::getAnalysisUsa // because CodeGen overloads that to mean preserving the MachineBasicBlock // CFG in addition to the LLVM IR CFG. AU.addPreserved(); - AU.addPreserved("scalar-evolution"); - AU.addPreserved("iv-users"); - AU.addPreserved("memdep"); - AU.addPreserved("live-values"); - AU.addPreserved("domtree"); - AU.addPreserved("domfrontier"); - AU.addPreserved("loops"); - AU.addPreserved("lda"); - AU.addPreserved("stack-protector"); + AU.addPreserved(); + AU.addPreserved(); + AU.addPreserved(); + AU.addPreserved(); + AU.addPreserved(); + AU.addPreserved(); + AU.addPreserved(); FunctionPass::getAnalysisUsage(AU); } Modified: vendor/llvm/dist/lib/IR/Core.cpp ============================================================================== --- vendor/llvm/dist/lib/IR/Core.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/IR/Core.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -563,9 +563,23 @@ LLVMValueRef LLVMGetMetadata(LLVMValueRe return nullptr; } -void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef MD) { - MDNode *N = - MD ? cast(unwrap(MD)->getMetadata()) : nullptr; +// MetadataAsValue uses a canonical format which strips the actual MDNode for +// MDNode with just a single constant value, storing just a ConstantAsMetadata +// This undoes this canonicalization, reconstructing the MDNode. +static MDNode *extractMDNode(MetadataAsValue *MAV) { + Metadata *MD = MAV->getMetadata(); + assert((isa(MD) || isa(MD)) && + "Expected a metadata node or a canonicalized constant"); + + if (MDNode *N = dyn_cast(MD)) + return N; + + return MDNode::get(MAV->getContext(), MD); +} + +void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef Val) { + MDNode *N = Val ? extractMDNode(unwrap(Val)) : nullptr; + unwrap(Inst)->setMetadata(KindID, N); } @@ -795,7 +809,7 @@ void LLVMAddNamedMetadataOperand(LLVMMod return; if (!Val) return; - N->addOperand(cast(unwrap(Val)->getMetadata())); + N->addOperand(extractMDNode(unwrap(Val))); } /*--.. Operations on scalar constants ......................................--*/ Modified: vendor/llvm/dist/lib/IR/LegacyPassManager.cpp ============================================================================== --- vendor/llvm/dist/lib/IR/LegacyPassManager.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/IR/LegacyPassManager.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -600,8 +600,7 @@ void PMTopLevelManager::schedulePass(Pas // If P is an analysis pass and it is available then do not // generate the analysis again. Stale analysis info should not be // available at this point. - const PassInfo *PI = - PassRegistry::getPassRegistry()->getPassInfo(P->getPassID()); + const PassInfo *PI = findAnalysisPassInfo(P->getPassID()); if (PI && PI->isAnalysis() && findAnalysisPass(P->getPassID())) { delete P; return; @@ -619,7 +618,7 @@ void PMTopLevelManager::schedulePass(Pas Pass *AnalysisPass = findAnalysisPass(*I); if (!AnalysisPass) { - const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I); + const PassInfo *PI = findAnalysisPassInfo(*I); if (!PI) { // Pass P is not in the global PassRegistry @@ -716,8 +715,7 @@ Pass *PMTopLevelManager::findAnalysisPas return *I; // If Pass not found then check the interfaces implemented by Immutable Pass - const PassInfo *PassInf = - PassRegistry::getPassRegistry()->getPassInfo(PI); + const PassInfo *PassInf = findAnalysisPassInfo(PI); assert(PassInf && "Expected all immutable passes to be initialized"); const std::vector &ImmPI = PassInf->getInterfacesImplemented(); @@ -731,6 +729,17 @@ Pass *PMTopLevelManager::findAnalysisPas return nullptr; } +const PassInfo *PMTopLevelManager::findAnalysisPassInfo(AnalysisID AID) const { + const PassInfo *&PI = AnalysisPassInfos[AID]; + if (!PI) + PI = PassRegistry::getPassRegistry()->getPassInfo(AID); + else + assert(PI == PassRegistry::getPassRegistry()->getPassInfo(AID) && + "The pass info pointer changed for an analysis ID!"); + + return PI; +} + // Print passes managed by this top level manager. void PMTopLevelManager::dumpPasses() const { @@ -759,8 +768,7 @@ void PMTopLevelManager::dumpArguments() dbgs() << "Pass Arguments: "; for (SmallVectorImpl::const_iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I) - if (const PassInfo *PI = - PassRegistry::getPassRegistry()->getPassInfo((*I)->getPassID())) { + if (const PassInfo *PI = findAnalysisPassInfo((*I)->getPassID())) { assert(PI && "Expected all immutable passes to be initialized"); if (!PI->isAnalysisGroup()) dbgs() << " -" << PI->getPassArgument(); @@ -824,7 +832,7 @@ void PMDataManager::recordAvailableAnaly // This pass is the current implementation of all of the interfaces it // implements as well. - const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(PI); + const PassInfo *PInf = TPM->findAnalysisPassInfo(PI); if (!PInf) return; const std::vector &II = PInf->getInterfacesImplemented(); for (unsigned i = 0, e = II.size(); i != e; ++i) @@ -957,7 +965,7 @@ void PMDataManager::freePass(Pass *P, St } AnalysisID PI = P->getPassID(); - if (const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(PI)) { + if (const PassInfo *PInf = TPM->findAnalysisPassInfo(PI)) { // Remove the pass itself (if it is not already removed). AvailableAnalysis.erase(PI); @@ -1037,7 +1045,7 @@ void PMDataManager::add(Pass *P, bool Pr for (SmallVectorImpl::iterator I = ReqAnalysisNotAvailable.begin(), E = ReqAnalysisNotAvailable.end() ;I != E; ++I) { - const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I); + const PassInfo *PI = TPM->findAnalysisPassInfo(*I); Pass *AnalysisPass = PI->createPass(); this->addLowerLevelRequiredPass(P, AnalysisPass); } @@ -1142,7 +1150,7 @@ void PMDataManager::dumpPassArguments() PMD->dumpPassArguments(); else if (const PassInfo *PI = - PassRegistry::getPassRegistry()->getPassInfo((*I)->getPassID())) + TPM->findAnalysisPassInfo((*I)->getPassID())) if (!PI->isAnalysisGroup()) dbgs() << " -" << PI->getPassArgument(); } @@ -1218,7 +1226,7 @@ void PMDataManager::dumpAnalysisUsage(St dbgs() << (const void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; for (unsigned i = 0; i != Set.size(); ++i) { if (i) dbgs() << ','; - const PassInfo *PInf = PassRegistry::getPassRegistry()->getPassInfo(Set[i]); + const PassInfo *PInf = TPM->findAnalysisPassInfo(Set[i]); if (!PInf) { // Some preserved passes, such as AliasAnalysis, may not be initialized by // all drivers. @@ -1658,8 +1666,8 @@ void MPPassManager::addLowerLevelRequire OnTheFlyManagers[P] = FPP; } - const PassInfo * RequiredPassPI = - PassRegistry::getPassRegistry()->getPassInfo(RequiredPass->getPassID()); + const PassInfo *RequiredPassPI = + TPM->findAnalysisPassInfo(RequiredPass->getPassID()); Pass *FoundPass = nullptr; if (RequiredPassPI && RequiredPassPI->isAnalysis()) { Modified: vendor/llvm/dist/lib/MC/ELFObjectWriter.cpp ============================================================================== --- vendor/llvm/dist/lib/MC/ELFObjectWriter.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/MC/ELFObjectWriter.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -219,7 +219,7 @@ class ELFObjectWriter : public MCObjectW const MCSymbolData *SD, uint64_t C, unsigned Type) const; - void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, + void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue) override; @@ -789,11 +789,13 @@ static const MCSymbol *getWeakRef(const return nullptr; } -void ELFObjectWriter::RecordRelocation(MCAssembler &Asm, +void ELFObjectWriter::RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, - const MCFixup &Fixup, MCValue Target, - bool &IsPCRel, uint64_t &FixedValue) { + const MCFixup &Fixup, + MCValue Target, + bool &IsPCRel, + uint64_t &FixedValue) { const MCSectionData *FixupSection = Fragment->getParent(); uint64_t C = Target.getConstant(); uint64_t FixupOffset = Layout.getFragmentOffset(Fragment) + Fixup.getOffset(); Modified: vendor/llvm/dist/lib/MC/MCAsmInfoDarwin.cpp ============================================================================== --- vendor/llvm/dist/lib/MC/MCAsmInfoDarwin.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/MC/MCAsmInfoDarwin.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -27,7 +27,22 @@ bool MCAsmInfoDarwin::isSectionAtomizabl // contain. // Sections holding 2 byte strings require symbols in order to be atomized. // There is no dedicated section for 4 byte strings. - if (SMO.getType() == MachO::S_CSTRING_LITERALS) + if (SMO.getKind().isMergeable1ByteCString()) + return false; + + if (SMO.getSegmentName() == "__TEXT" && + SMO.getSectionName() == "__objc_classname" && + SMO.getType() == MachO::S_CSTRING_LITERALS) + return false; + + if (SMO.getSegmentName() == "__TEXT" && + SMO.getSectionName() == "__objc_methname" && + SMO.getType() == MachO::S_CSTRING_LITERALS) + return false; + + if (SMO.getSegmentName() == "__TEXT" && + SMO.getSectionName() == "__objc_methtype" && + SMO.getType() == MachO::S_CSTRING_LITERALS) return false; if (SMO.getSegmentName() == "__DATA" && SMO.getSectionName() == "__cfstring") Modified: vendor/llvm/dist/lib/MC/MCAssembler.cpp ============================================================================== --- vendor/llvm/dist/lib/MC/MCAssembler.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/MC/MCAssembler.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -425,16 +425,6 @@ bool MCAssembler::isThumbFunc(const MCSy return true; } -void MCAssembler::addLocalUsedInReloc(const MCSymbol &Sym) { - assert(Sym.isTemporary()); - LocalsUsedInReloc.insert(&Sym); -} - -bool MCAssembler::isLocalUsedInReloc(const MCSymbol &Sym) const { - assert(Sym.isTemporary()); - return LocalsUsedInReloc.count(&Sym); -} - bool MCAssembler::isSymbolLinkerVisible(const MCSymbol &Symbol) const { // Non-temporary labels should always be visible to the linker. if (!Symbol.isTemporary()) @@ -444,10 +434,8 @@ bool MCAssembler::isSymbolLinkerVisible( if (!Symbol.isInSection()) return false; - if (isLocalUsedInReloc(Symbol)) - return true; - - return false; + // Otherwise, check if the section requires symbols even for temporary labels. + return getBackend().doesSectionRequireSymbols(Symbol.getSection()); } const MCSymbolData *MCAssembler::getAtom(const MCSymbolData *SD) const { Modified: vendor/llvm/dist/lib/MC/MachObjectWriter.cpp ============================================================================== --- vendor/llvm/dist/lib/MC/MachObjectWriter.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/MC/MachObjectWriter.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -448,11 +448,14 @@ void MachObjectWriter::WriteLinkerOption assert(OS.tell() - Start == Size); } -void MachObjectWriter::RecordRelocation(MCAssembler &Asm, + +void MachObjectWriter::RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, - const MCFixup &Fixup, MCValue Target, - bool &IsPCRel, uint64_t &FixedValue) { + const MCFixup &Fixup, + MCValue Target, + bool &IsPCRel, + uint64_t &FixedValue) { TargetObjectWriter->RecordRelocation(this, Asm, Layout, Fragment, Fixup, Target, FixedValue); } @@ -613,22 +616,6 @@ void MachObjectWriter::ComputeSymbolTabl ExternalSymbolData[i].SymbolData->setIndex(Index++); for (unsigned i = 0, e = UndefinedSymbolData.size(); i != e; ++i) UndefinedSymbolData[i].SymbolData->setIndex(Index++); - - for (const MCSectionData &SD : Asm) { - std::vector &Relocs = Relocations[&SD]; - for (RelAndSymbol &Rel : Relocs) { - if (!Rel.Sym) - continue; - - // Set the Index and the IsExtern bit. - unsigned Index = Rel.Sym->getIndex(); - assert(isInt<24>(Index)); - if (IsLittleEndian) - Rel.MRE.r_word1 = (Rel.MRE.r_word1 & (-1 << 24)) | Index | (1 << 27); - else - Rel.MRE.r_word1 = (Rel.MRE.r_word1 & 0xff) | Index << 8 | (1 << 4); - } - } } void MachObjectWriter::computeSectionAddresses(const MCAssembler &Asm, @@ -675,6 +662,10 @@ void MachObjectWriter::ExecutePostLayout // Mark symbol difference expressions in variables (from .set or = directives) // as absolute. markAbsoluteVariableSymbols(Asm, Layout); + + // Compute symbol table information and bind symbol indices. + ComputeSymbolTable(Asm, LocalSymbolData, ExternalSymbolData, + UndefinedSymbolData); } bool MachObjectWriter:: @@ -758,10 +749,6 @@ IsSymbolRefDifferenceFullyResolvedImpl(c void MachObjectWriter::WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) { - // Compute symbol table information and bind symbol indices. - ComputeSymbolTable(Asm, LocalSymbolData, ExternalSymbolData, - UndefinedSymbolData); - unsigned NumSections = Asm.size(); const MCAssembler::VersionMinInfoType &VersionInfo = Layout.getAssembler().getVersionMinInfo(); @@ -852,7 +839,7 @@ void MachObjectWriter::WriteObject(MCAss uint64_t RelocTableEnd = SectionDataStart + SectionDataFileSize; for (MCAssembler::const_iterator it = Asm.begin(), ie = Asm.end(); it != ie; ++it) { - std::vector &Relocs = Relocations[it]; + std::vector &Relocs = Relocations[it]; unsigned NumRelocs = Relocs.size(); uint64_t SectionStart = SectionDataStart + getSectionAddress(it); WriteSection(Asm, Layout, *it, SectionStart, RelocTableEnd, NumRelocs); @@ -946,10 +933,10 @@ void MachObjectWriter::WriteObject(MCAss ie = Asm.end(); it != ie; ++it) { // Write the section relocation entries, in reverse order to match 'as' // (approximately, the exact algorithm is more complicated than this). - std::vector &Relocs = Relocations[it]; + std::vector &Relocs = Relocations[it]; for (unsigned i = 0, e = Relocs.size(); i != e; ++i) { - Write32(Relocs[e - i - 1].MRE.r_word0); - Write32(Relocs[e - i - 1].MRE.r_word1); + Write32(Relocs[e - i - 1].r_word0); + Write32(Relocs[e - i - 1].r_word1); } } Modified: vendor/llvm/dist/lib/MC/WinCOFFObjectWriter.cpp ============================================================================== --- vendor/llvm/dist/lib/MC/WinCOFFObjectWriter.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/MC/WinCOFFObjectWriter.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -175,7 +175,7 @@ public: const MCFragment &FB, bool InSet, bool IsPCRel) const override; - void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, + void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue) override; @@ -661,9 +661,13 @@ bool WinCOFFObjectWriter::IsSymbolRefDif InSet, IsPCRel); } -void WinCOFFObjectWriter::RecordRelocation( - MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, - const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue) { +void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm, + const MCAsmLayout &Layout, + const MCFragment *Fragment, + const MCFixup &Fixup, + MCValue Target, + bool &IsPCRel, + uint64_t &FixedValue) { assert(Target.getSymA() && "Relocation must reference a symbol!"); const MCSymbol &Symbol = Target.getSymA()->getSymbol(); Modified: vendor/llvm/dist/lib/Support/Triple.cpp ============================================================================== --- vendor/llvm/dist/lib/Support/Triple.cpp Sat Jan 31 19:18:09 2015 (r277991) +++ vendor/llvm/dist/lib/Support/Triple.cpp Sat Jan 31 19:27:28 2015 (r277992) @@ -246,13 +246,21 @@ static Triple::ArchType parseARMArch(Str if (ArchName.startswith("armv")) { offset = 3; - arch = Triple::arm; + if (ArchName.endswith("eb")) { + arch = Triple::armeb; + ArchName = ArchName.substr(0, ArchName.size() - 2); + } else + arch = Triple::arm; } else if (ArchName.startswith("armebv")) { offset = 5; arch = Triple::armeb; } else if (ArchName.startswith("thumbv")) { offset = 5; - arch = Triple::thumb; + if (ArchName.endswith("eb")) { + arch = Triple::thumbeb; + ArchName = ArchName.substr(0, ArchName.size() - 2); + } else + arch = Triple::thumb; } else if (ArchName.startswith("thumbebv")) { offset = 7; arch = Triple::thumbeb; @@ -271,6 +279,8 @@ static Triple::ArchType parseARMArch(Str } static Triple::ArchType parseArch(StringRef ArchName) { + Triple::ArchType ARMArch(parseARMArch(ArchName)); + return StringSwitch(ArchName) .Cases("i386", "i486", "i586", "i686", Triple::x86) // FIXME: Do we need to support these? @@ -280,9 +290,10 @@ static Triple::ArchType parseArch(String .Cases("powerpc64", "ppu", Triple::ppc64) .Case("powerpc64le", Triple::ppc64le) .Case("xscale", Triple::arm) - .StartsWith("arm", parseARMArch(ArchName)) - .StartsWith("thumb", parseARMArch(ArchName)) - .StartsWith("aarch64", parseARMArch(ArchName)) + .Case("xscaleeb", Triple::armeb) + .StartsWith("arm", ARMArch) + .StartsWith("thumb", ARMArch) + .StartsWith("aarch64", ARMArch) .Case("msp430", Triple::msp430) .Cases("mips", "mipseb", "mipsallegrex", Triple::mips) .Cases("mipsel", "mipsallegrexel", Triple::mipsel) @@ -379,6 +390,9 @@ static Triple::ObjectFormatType parseFor } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***