svn commit: r319230 - in vendor/llvm/dist: docs docs/Proposals include/llvm/Analysis include/llvm/CodeGen include/llvm/DebugInfo/CodeView include/llvm/DebugInfo/PDB/Native include/llvm/MC include/l...

Dimitry Andric dim at FreeBSD.org
Tue May 30 17:37:34 UTC 2017


Author: dim
Date: Tue May 30 17:37:31 2017
New Revision: 319230
URL: https://svnweb.freebsd.org/changeset/base/319230

Log:
  Vendor import of llvm trunk r304222:
  https://llvm.org/svn/llvm-project/llvm/trunk@304222

Added:
  vendor/llvm/dist/docs/Proposals/VectorizationPlan.rst
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsection.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h   (contents, props changed)
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugUnknownSubsection.h   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugSubsection.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp   (contents, props changed)
  vendor/llvm/dist/lib/DebugInfo/CodeView/DebugSymbolsSubsection.cpp   (contents, props changed)
  vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrDFP.td
  vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrHFP.td
  vendor/llvm/dist/test/CodeGen/AArch64/reg-scavenge-frame.mir
  vendor/llvm/dist/test/CodeGen/AMDGPU/sdwa-scalar-ops.mir
  vendor/llvm/dist/test/CodeGen/X86/bitcast-and-setcc-128.ll
  vendor/llvm/dist/test/CodeGen/X86/bitcast-and-setcc-256.ll
  vendor/llvm/dist/test/CodeGen/X86/xchg-nofold.ll
  vendor/llvm/dist/test/MC/Mips/macro-li.d.s   (contents, props changed)
  vendor/llvm/dist/test/MC/Mips/macro-li.s.s   (contents, props changed)
Deleted:
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugFragment.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/ModuleDebugUnknownFragment.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/StringTable.h
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugFragment.cpp
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.cpp
  vendor/llvm/dist/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp
  vendor/llvm/dist/lib/DebugInfo/CodeView/StringTable.cpp
  vendor/llvm/dist/test/Transforms/LoopVectorize/AArch64/no_vector_instructions.ll
  vendor/llvm/dist/tools/llvm-readobj/CodeView.h
Modified:
  vendor/llvm/dist/docs/Vectorizers.rst
  vendor/llvm/dist/docs/index.rst
  vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h
  vendor/llvm/dist/include/llvm/CodeGen/DIE.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/CodeView.h
  vendor/llvm/dist/include/llvm/DebugInfo/CodeView/SymbolVisitorDelegate.h
  vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h
  vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/DbiStream.h
  vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
  vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/PDBStringTable.h
  vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h
  vendor/llvm/dist/include/llvm/MC/ConstantPools.h
  vendor/llvm/dist/include/llvm/Support/ManagedStatic.h
  vendor/llvm/dist/include/llvm/TableGen/Record.h
  vendor/llvm/dist/include/llvm/Transforms/Scalar/GVNExpression.h
  vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp
  vendor/llvm/dist/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  vendor/llvm/dist/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  vendor/llvm/dist/lib/CodeGen/GlobalISel/Localizer.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  vendor/llvm/dist/lib/CodeGen/TargetLoweringBase.cpp
  vendor/llvm/dist/lib/DebugInfo/CodeView/CMakeLists.txt
  vendor/llvm/dist/lib/DebugInfo/CodeView/EnumTables.cpp
  vendor/llvm/dist/lib/DebugInfo/CodeView/SymbolDumper.cpp
  vendor/llvm/dist/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
  vendor/llvm/dist/lib/MC/MCCodeView.cpp
  vendor/llvm/dist/lib/Support/APFloat.cpp
  vendor/llvm/dist/lib/Support/Timer.cpp
  vendor/llvm/dist/lib/TableGen/Record.cpp
  vendor/llvm/dist/lib/Target/AArch64/AArch64FrameLowering.cpp
  vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUSubtarget.h
  vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/SIFoldOperands.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
  vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp
  vendor/llvm/dist/lib/Target/Hexagon/HexagonISelLowering.cpp
  vendor/llvm/dist/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  vendor/llvm/dist/lib/Target/Mips/MipsISelLowering.cpp
  vendor/llvm/dist/lib/Target/Mips/MipsInstrFPU.td
  vendor/llvm/dist/lib/Target/Mips/MipsRegisterInfo.td
  vendor/llvm/dist/lib/Target/PowerPC/PPCISelLowering.cpp
  vendor/llvm/dist/lib/Target/SystemZ/SystemZ.td
  vendor/llvm/dist/lib/Target/SystemZ/SystemZFeatures.td
  vendor/llvm/dist/lib/Target/SystemZ/SystemZISelLowering.cpp
  vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrFP.td
  vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrFormats.td
  vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleZ13.td
  vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleZ196.td
  vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleZEC12.td
  vendor/llvm/dist/lib/Target/SystemZ/SystemZSubtarget.cpp
  vendor/llvm/dist/lib/Target/SystemZ/SystemZSubtarget.h
  vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp
  vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp
  vendor/llvm/dist/test/CodeGen/AMDGPU/add.v2i16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/bfe-combine.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/commute-compares.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/commute_modifiers.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/copy-illegal-type.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/cvt_f32_ubyte.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fabs.f64.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fabs.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fadd.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fadd64.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fcanonicalize.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fmul.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fneg-fabs.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fneg-fabs.f64.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fneg-fabs.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fneg.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fract.f64.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fsub.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/fsub64.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/immv216.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/insert_vector_elt.v2i16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.amdgcn.div.fixup.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.amdgcn.div.fmas.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.amdgcn.fcmp.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.amdgcn.fmul.legacy.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.amdgcn.s.barrier.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.fma.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.fmuladd.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.maxnum.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/llvm.minnum.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/mad24-get-global-id.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/madak.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/madmk.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/mul.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/scratch-simple.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/sdiv.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/sdwa-peephole.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/select.f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/shift-and-i128-ubfe.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/shift-and-i64-ubfe.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/sminmax.v2i16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/srem.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/sub.v2i16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/udiv.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/urem.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/use-sgpr-multiple-times.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/v_mac_f16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/wqm.ll
  vendor/llvm/dist/test/CodeGen/WebAssembly/negative-base-reg.ll
  vendor/llvm/dist/test/CodeGen/X86/mul-constant-i16.ll
  vendor/llvm/dist/test/CodeGen/X86/mul-constant-i32.ll
  vendor/llvm/dist/test/CodeGen/X86/mul-constant-i64.ll
  vendor/llvm/dist/test/CodeGen/X86/setcc-lowering.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-sext.ll
  vendor/llvm/dist/test/MC/AArch64/ldr-pseudo.s
  vendor/llvm/dist/test/MC/Disassembler/SystemZ/insns-z13.txt
  vendor/llvm/dist/test/MC/Disassembler/SystemZ/insns.txt
  vendor/llvm/dist/test/MC/SystemZ/insn-bad-z13.s
  vendor/llvm/dist/test/MC/SystemZ/insn-bad-z196.s
  vendor/llvm/dist/test/MC/SystemZ/insn-bad-zEC12.s
  vendor/llvm/dist/test/MC/SystemZ/insn-bad.s
  vendor/llvm/dist/test/MC/SystemZ/insn-good-z13.s
  vendor/llvm/dist/test/MC/SystemZ/insn-good-z196.s
  vendor/llvm/dist/test/MC/SystemZ/insn-good-zEC12.s
  vendor/llvm/dist/test/MC/SystemZ/insn-good.s
  vendor/llvm/dist/tools/llvm-pdbdump/C13DebugFragmentVisitor.cpp
  vendor/llvm/dist/tools/llvm-pdbdump/C13DebugFragmentVisitor.h
  vendor/llvm/dist/tools/llvm-pdbdump/LLVMOutputStyle.cpp
  vendor/llvm/dist/tools/llvm-pdbdump/YAMLOutputStyle.cpp
  vendor/llvm/dist/tools/llvm-pdbdump/llvm-pdbdump.cpp
  vendor/llvm/dist/tools/llvm-readobj/COFFDumper.cpp
  vendor/llvm/dist/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  vendor/llvm/dist/unittests/Support/ManagedStatic.cpp
  vendor/llvm/dist/utils/TableGen/GlobalISelEmitter.cpp
  vendor/llvm/dist/utils/TableGen/X86FoldTablesEmitter.cpp

Added: vendor/llvm/dist/docs/Proposals/VectorizationPlan.rst
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/docs/Proposals/VectorizationPlan.rst	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,182 @@
+==================
+Vectorization Plan
+==================
+
+.. contents::
+   :local:
+
+Abstract
+========
+The vectorization transformation can be rather complicated, involving several
+potential alternatives, especially for outer-loops [1]_ but also possibly for
+innermost loops. These alternatives may have significant performance impact,
+both positive and negative. A cost model is therefore employed to identify the
+best alternative, including the alternative of avoiding any transformation
+altogether.
+
+The Vectorization Plan is an explicit model for describing vectorization
+candidates. It serves for both optimizing candidates including estimating their
+cost reliably, and for performing their final translation into IR. This
+facilitates dealing with multiple vectorization candidates.
+
+High-level Design
+=================
+
+Vectorization Workflow
+----------------------
+VPlan-based vectorization involves three major steps, taking a "scenario-based
+approach" to vectorization planning:
+
+1. Legal Step: check if a loop can be legally vectorized; encode contraints and
+   artifacts if so.
+2. Plan Step:
+
+   a. Build initial VPlans following the constraints and decisions taken by
+      Legal Step 1, and compute their cost.
+   b. Apply optimizations to the VPlans, possibly forking additional VPlans.
+      Prune sub-optimal VPlans having relatively high cost.
+3. Execute Step: materialize the best VPlan. Note that this is the only step
+   that modifies the IR.
+
+Design Guidelines
+-----------------
+In what follows, the term "input IR" refers to code that is fed into the
+vectorizer whereas the term "output IR" refers to code that is generated by the
+vectorizer. The output IR contains code that has been vectorized or "widened"
+according to a loop Vectorization Factor (VF), and/or loop unroll-and-jammed
+according to an Unroll Factor (UF).
+The design of VPlan follows several high-level guidelines:
+
+1. Analysis-like: building and manipulating VPlans must not modify the input IR.
+   In particular, if the best option is not to vectorize at all, the
+   vectorization process terminates before reaching Step 3, and compilation
+   should proceed as if VPlans had not been built.
+
+2. Align Cost & Execute: each VPlan must support both estimating the cost and
+   generating the output IR code, such that the cost estimation evaluates the
+   to-be-generated code reliably.
+
+3. Support vectorizing additional constructs:
+
+   a. Outer-loop vectorization. In particular, VPlan must be able to model the
+      control-flow of the output IR which may include multiple basic-blocks and
+      nested loops.
+   b. SLP vectorization.
+   c. Combinations of the above, including nested vectorization: vectorizing
+      both an inner loop and an outer-loop at the same time (each with its own
+      VF and UF), mixed vectorization: vectorizing a loop with SLP patterns
+      inside [4]_, (re)vectorizing input IR containing vector code.
+   d. Function vectorization [2]_.
+
+4. Support multiple candidates efficiently. In particular, similar candidates
+   related to a range of possible VF's and UF's must be represented efficiently.
+   Potential versioning needs to be supported efficiently.
+
+5. Support vectorizing idioms, such as interleaved groups of strided loads or
+   stores. This is achieved by modeling a sequence of output instructions using
+   a "Recipe", which is responsible for computing its cost and generating its
+   code.
+
+6. Encapsulate Single-Entry Single-Exit regions (SESE). During vectorization
+   such regions may need to be, for example, predicated and linearized, or
+   replicated VF*UF times to handle scalarized and predicated instructions.
+   Innerloops are also modelled as SESE regions.
+
+Low-level Design
+================
+The low-level design of VPlan comprises of the following classes.
+
+:LoopVectorizationPlanner:
+  A LoopVectorizationPlanner is designed to handle the vectorization of a loop
+  or a loop nest. It can construct, optimize and discard one or more VPlans,
+  each VPlan modelling a distinct way to vectorize the loop or the loop nest.
+  Once the best VPlan is determined, including the best VF and UF, this VPlan
+  drives the generation of output IR.
+
+:VPlan:
+  A model of a vectorized candidate for a given input IR loop or loop nest. This
+  candidate is represented using a Hierarchical CFG. VPlan supports estimating
+  the cost and driving the generation of the output IR code it represents.
+
+:Hierarchical CFG:
+  A control-flow graph whose nodes are basic-blocks or Hierarchical CFG's. The
+  Hierarchical CFG data structure is similar to the Tile Tree [5]_, where
+  cross-Tile edges are lifted to connect Tiles instead of the original
+  basic-blocks as in Sharir [6]_, promoting the Tile encapsulation. The terms
+  Region and Block are used rather than Tile [5]_ to avoid confusion with loop
+  tiling.
+
+:VPBlockBase:
+  The building block of the Hierarchical CFG. A pure-virtual base-class of
+  VPBasicBlock and VPRegionBlock, see below. VPBlockBase models the hierarchical
+  control-flow relations with other VPBlocks. Note that in contrast to the IR
+  BasicBlock, a VPBlockBase models its control-flow successors and predecessors
+  directly, rather than through a Terminator branch or through predecessor
+  branches that "use" the VPBlockBase.
+
+:VPBasicBlock:
+  VPBasicBlock is a subclass of VPBlockBase, and serves as the leaves of the
+  Hierarchical CFG. It represents a sequence of output IR instructions that will
+  appear consecutively in an output IR basic-block. The instructions of this
+  basic-block originate from one or more VPBasicBlocks. VPBasicBlock holds a
+  sequence of zero or more VPRecipes that model the cost and generation of the
+  output IR instructions.
+
+:VPRegionBlock:
+  VPRegionBlock is a subclass of VPBlockBase. It models a collection of
+  VPBasicBlocks and VPRegionBlocks which form a SESE subgraph of the output IR
+  CFG. A VPRegionBlock may indicate that its contents are to be replicated a
+  constant number of times when output IR is generated, effectively representing
+  a loop with constant trip-count that will be completely unrolled. This is used
+  to support scalarized and predicated instructions with a single model for
+  multiple candidate VF's and UF's.
+
+:VPRecipeBase:
+  A pure-virtual base class modeling a sequence of one or more output IR
+  instructions, possibly based on one or more input IR instructions. These
+  input IR instructions are referred to as "Ingredients" of the Recipe. A Recipe
+  may specify how its ingredients are to be transformed to produce the output IR
+  instructions; e.g., cloned once, replicated multiple times or widened
+  according to selected VF.
+
+:VPTransformState:
+  Stores information used for generating output IR, passed from
+  LoopVectorizationPlanner to its selected VPlan for execution, and used to pass
+  additional information down to VPBlocks and VPRecipes.
+
+Related LLVM components
+-----------------------
+1. SLP Vectorizer: one can compare the VPlan model with LLVM's existing SLP
+   tree, where TSLP [3]_ adds Plan Step 2.b.
+
+2. RegionInfo: one can compare VPlan's H-CFG with the Region Analysis as used by
+   Polly [7]_.
+
+References
+----------
+.. [1] "Outer-loop vectorization: revisited for short SIMD architectures", Dorit
+    Nuzman and Ayal Zaks, PACT 2008.
+
+.. [2] "Proposal for function vectorization and loop vectorization with function
+    calls", Xinmin Tian, [`cfe-dev
+    <http://lists.llvm.org/pipermail/cfe-dev/2016-March/047732.html>`_].,
+    March 2, 2016.
+    See also `review <https://reviews.llvm.org/D22792>`_.
+
+.. [3] "Throttling Automatic Vectorization: When Less is More", Vasileios
+    Porpodas and Tim Jones, PACT 2015 and LLVM Developers' Meeting 2015.
+
+.. [4] "Exploiting mixed SIMD parallelism by reducing data reorganization
+    overhead", Hao Zhou and Jingling Xue, CGO 2016.
+
+.. [5] "Register Allocation via Hierarchical Graph Coloring", David Callahan and
+    Brian Koblenz, PLDI 1991
+
+.. [6] "Structural analysis: A new approach to flow analysis in optimizing
+    compilers", M. Sharir, Journal of Computer Languages, Jan. 1980
+
+.. [7] "Enabling Polyhedral Optimizations in LLVM", Tobias Grosser, Diploma
+    thesis, 2011.
+
+.. [8] "Introducing VPlan to the Loop Vectorizer", Gil Rapaport and Ayal Zaks,
+    European LLVM Developers' Meeting 2017.

Modified: vendor/llvm/dist/docs/Vectorizers.rst
==============================================================================
--- vendor/llvm/dist/docs/Vectorizers.rst	Tue May 30 17:16:08 2017	(r319229)
+++ vendor/llvm/dist/docs/Vectorizers.rst	Tue May 30 17:37:31 2017	(r319230)
@@ -382,6 +382,17 @@ And Linpack-pc with the same configuration. Result is 
 
 .. image:: linpack-pc.png
 
+Ongoing Development Directions
+------------------------------
+
+.. toctree::
+   :hidden:
+
+   Proposals/VectorizationPlan
+
+:doc:`Proposals/VectorizationPlan`
+   Modeling the process and upgrading the infrastructure of LLVM's Loop Vectorizer.
+
 .. _slp-vectorizer:
 
 The SLP Vectorizer

Modified: vendor/llvm/dist/docs/index.rst
==============================================================================
--- vendor/llvm/dist/docs/index.rst	Tue May 30 17:16:08 2017	(r319229)
+++ vendor/llvm/dist/docs/index.rst	Tue May 30 17:37:31 2017	(r319230)
@@ -528,6 +528,7 @@ can be better.
 
    CodeOfConduct
    Proposals/GitHubMove
+   Proposals/VectorizationPlan
 
 :doc:`CodeOfConduct`
    Proposal to adopt a code of conduct on the LLVM social spaces (lists, events,
@@ -536,6 +537,8 @@ can be better.
 :doc:`Proposals/GitHubMove`
    Proposal to move from SVN/Git to GitHub.
 
+:doc:`Proposals/VectorizationPlan`
+   Proposal to model the process and upgrade the infrastructure of LLVM's Loop Vectorizer.
 
 Indices and tables
 ==================

Modified: vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h	Tue May 30 17:16:08 2017	(r319229)
+++ vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h	Tue May 30 17:37:31 2017	(r319230)
@@ -1536,8 +1536,7 @@ class ScalarEvolution { (public)
   /// Determine if the SCEV can be evaluated at loop's entry. It is true if it
   /// doesn't depend on a SCEVUnknown of an instruction which is dominated by
   /// the header of loop L.
-  bool isAvailableAtLoopEntry(const SCEV *S, const Loop *L, DominatorTree &DT,
-                              LoopInfo &LI);
+  bool isAvailableAtLoopEntry(const SCEV *S, const Loop *L);
 
   /// Return true if the given SCEV changes value in a known way in the
   /// specified loop.  This property being true implies that the value is

Modified: vendor/llvm/dist/include/llvm/CodeGen/DIE.h
==============================================================================
--- vendor/llvm/dist/include/llvm/CodeGen/DIE.h	Tue May 30 17:16:08 2017	(r319229)
+++ vendor/llvm/dist/include/llvm/CodeGen/DIE.h	Tue May 30 17:37:31 2017	(r319230)
@@ -383,11 +383,11 @@ class DIEValue { (private)
       return;
 #define HANDLE_DIEVALUE_SMALL(T)                                               \
   case is##T:                                                                  \
-    destruct<DIE##T>();
+    destruct<DIE##T>();                                                        \
     return;
 #define HANDLE_DIEVALUE_LARGE(T)                                               \
   case is##T:                                                                  \
-    destruct<const DIE##T *>();
+    destruct<const DIE##T *>();                                                \
     return;
 #include "llvm/CodeGen/DIEValue.def"
     }

Modified: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/CodeView.h
==============================================================================
--- vendor/llvm/dist/include/llvm/DebugInfo/CodeView/CodeView.h	Tue May 30 17:16:08 2017	(r319229)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/CodeView.h	Tue May 30 17:37:31 2017	(r319230)
@@ -13,6 +13,8 @@
 #include <cinttypes>
 #include <type_traits>
 
+#include "llvm/Support/Endian.h"
+
 namespace llvm {
 namespace codeview {
 
@@ -291,7 +293,7 @@ enum class ModifierOptions : uint16_t {
 };
 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ModifierOptions)
 
-enum class ModuleDebugFragmentKind : uint32_t {
+enum class DebugSubsectionKind : uint32_t {
   None = 0,
   Symbols = 0xf1,
   Lines = 0xf2,
@@ -549,6 +551,24 @@ enum class FileChecksumKind : uint8_t { None, MD5, SHA
 enum LineFlags : uint16_t {
   LF_None = 0,
   LF_HaveColumns = 1, // CV_LINES_HAVE_COLUMNS
+};
+
+/// Data in the the SUBSEC_FRAMEDATA subection.
+struct FrameData {
+  support::ulittle32_t RvaStart;
+  support::ulittle32_t CodeSize;
+  support::ulittle32_t LocalSize;
+  support::ulittle32_t ParamsSize;
+  support::ulittle32_t MaxStackSize;
+  support::ulittle32_t FrameFunc;
+  support::ulittle16_t PrologSize;
+  support::ulittle16_t SavedRegsSize;
+  support::ulittle32_t Flags;
+  enum : uint32_t {
+    HasSEH = 1 << 0,
+    HasEH = 1 << 1,
+    IsFunctionStart = 1 << 2,
+  };
 };
 }
 }

Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,98 @@
+//===- DebugChecksumsSubsection.h -------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Endian.h"
+
+namespace llvm {
+namespace codeview {
+
+class DebugStringTableSubsection;
+
+struct FileChecksumEntry {
+  uint32_t FileNameOffset;    // Byte offset of filename in global stringtable.
+  FileChecksumKind Kind;      // The type of checksum.
+  ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
+};
+}
+}
+
+namespace llvm {
+template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
+public:
+  typedef void ContextType;
+
+  static Error extract(BinaryStreamRef Stream, uint32_t &Len,
+                       codeview::FileChecksumEntry &Item);
+};
+}
+
+namespace llvm {
+namespace codeview {
+class DebugChecksumsSubsectionRef final : public DebugSubsectionRef {
+  typedef VarStreamArray<codeview::FileChecksumEntry> FileChecksumArray;
+  typedef FileChecksumArray::Iterator Iterator;
+
+public:
+  DebugChecksumsSubsectionRef()
+      : DebugSubsectionRef(DebugSubsectionKind::FileChecksums) {}
+
+  static bool classof(const DebugSubsectionRef *S) {
+    return S->kind() == DebugSubsectionKind::FileChecksums;
+  }
+
+  bool valid() const { return Checksums.valid(); }
+
+  Error initialize(BinaryStreamReader Reader);
+  Error initialize(BinaryStreamRef Stream);
+
+  Iterator begin() { return Checksums.begin(); }
+  Iterator end() { return Checksums.end(); }
+
+  const FileChecksumArray &getArray() const { return Checksums; }
+
+private:
+  FileChecksumArray Checksums;
+};
+
+class DebugChecksumsSubsection final : public DebugSubsection {
+public:
+  explicit DebugChecksumsSubsection(DebugStringTableSubsection &Strings);
+
+  static bool classof(const DebugSubsection *S) {
+    return S->kind() == DebugSubsectionKind::FileChecksums;
+  }
+
+  void addChecksum(StringRef FileName, FileChecksumKind Kind,
+                   ArrayRef<uint8_t> Bytes);
+
+  uint32_t calculateSerializedSize() const override;
+  Error commit(BinaryStreamWriter &Writer) const override;
+  uint32_t mapChecksumOffset(StringRef FileName) const;
+
+private:
+  DebugStringTableSubsection &Strings;
+
+  DenseMap<uint32_t, uint32_t> OffsetMap;
+  uint32_t SerializedSize = 0;
+  llvm::BumpPtrAllocator Storage;
+  std::vector<FileChecksumEntry> Checksums;
+};
+}
+}
+
+#endif

Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,59 @@
+//===- DebugFrameDataSubsection.h ------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGFRAMEDATASUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGFRAMEDATASUBSECTION_H
+
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Error.h"
+
+namespace llvm {
+namespace codeview {
+class DebugFrameDataSubsectionRef final : public DebugSubsectionRef {
+public:
+  DebugFrameDataSubsectionRef()
+      : DebugSubsectionRef(DebugSubsectionKind::FrameData) {}
+  static bool classof(const DebugSubsection *S) {
+    return S->kind() == DebugSubsectionKind::FrameData;
+  }
+
+  Error initialize(BinaryStreamReader Reader);
+
+  FixedStreamArray<FrameData>::Iterator begin() const { return Frames.begin(); }
+  FixedStreamArray<FrameData>::Iterator end() const { return Frames.end(); }
+
+  const void *getRelocPtr() const { return RelocPtr; }
+
+private:
+  const uint32_t *RelocPtr = nullptr;
+  FixedStreamArray<FrameData> Frames;
+};
+
+class DebugFrameDataSubsection final : public DebugSubsection {
+public:
+  DebugFrameDataSubsection()
+      : DebugSubsection(DebugSubsectionKind::FrameData) {}
+  static bool classof(const DebugSubsection *S) {
+    return S->kind() == DebugSubsectionKind::FrameData;
+  }
+
+  uint32_t calculateSerializedSize() const override;
+  Error commit(BinaryStreamWriter &Writer) const override;
+
+  void addFrameData(const FrameData &Frame);
+
+private:
+  std::vector<FrameData> Frames;
+};
+}
+}
+
+#endif

Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,105 @@
+//===- DebugInlineeLinesSubsection.h ----------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_BUGINLINEELINESSUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_BUGINLINEELINESSUBSECTION_H
+
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
+#include "llvm/DebugInfo/CodeView/Line.h"
+#include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Error.h"
+
+namespace llvm {
+namespace codeview {
+
+class DebugInlineeLinesSubsectionsRef;
+class DebugChecksumsSubsection;
+
+enum class InlineeLinesSignature : uint32_t {
+  Normal,    // CV_INLINEE_SOURCE_LINE_SIGNATURE
+  ExtraFiles // CV_INLINEE_SOURCE_LINE_SIGNATURE_EX
+};
+
+struct InlineeSourceLineHeader {
+  TypeIndex Inlinee;                  // ID of the function that was inlined.
+  support::ulittle32_t FileID;        // Offset into FileChecksums subsection.
+  support::ulittle32_t SourceLineNum; // First line of inlined code.
+                                      // If extra files present:
+                                      //   ulittle32_t ExtraFileCount;
+                                      //   ulittle32_t Files[];
+};
+
+struct InlineeSourceLine {
+  const InlineeSourceLineHeader *Header;
+  FixedStreamArray<support::ulittle32_t> ExtraFiles;
+};
+}
+
+template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {
+  typedef bool ContextType;
+
+  static Error extract(BinaryStreamRef Stream, uint32_t &Len,
+                       codeview::InlineeSourceLine &Item, bool HasExtraFiles);
+};
+
+namespace codeview {
+class DebugInlineeLinesSubsectionRef final : public DebugSubsectionRef {
+  typedef VarStreamArray<InlineeSourceLine> LinesArray;
+  typedef LinesArray::Iterator Iterator;
+
+public:
+  DebugInlineeLinesSubsectionRef();
+
+  static bool classof(const DebugSubsectionRef *S) {
+    return S->kind() == DebugSubsectionKind::InlineeLines;
+  }
+
+  Error initialize(BinaryStreamReader Reader);
+  bool hasExtraFiles() const;
+
+  Iterator begin() const { return Lines.begin(); }
+  Iterator end() const { return Lines.end(); }
+
+private:
+  InlineeLinesSignature Signature;
+  VarStreamArray<InlineeSourceLine> Lines;
+};
+
+class DebugInlineeLinesSubsection final : public DebugSubsection {
+public:
+  DebugInlineeLinesSubsection(DebugChecksumsSubsection &Checksums,
+                              bool HasExtraFiles);
+
+  static bool classof(const DebugSubsection *S) {
+    return S->kind() == DebugSubsectionKind::InlineeLines;
+  }
+
+  Error commit(BinaryStreamWriter &Writer) const override;
+  uint32_t calculateSerializedSize() const override;
+
+  void addInlineSite(TypeIndex FuncId, StringRef FileName, uint32_t SourceLine);
+  void addExtraFile(StringRef FileName);
+
+private:
+  DebugChecksumsSubsection &Checksums;
+
+  bool HasExtraFiles = false;
+  uint32_t ExtraFileCount = 0;
+
+  struct Entry {
+    std::vector<support::ulittle32_t> ExtraFiles;
+    InlineeSourceLineHeader Header;
+  };
+  std::vector<Entry> Entries;
+};
+}
+}
+
+#endif

Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugLinesSubsection.h	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,143 @@
+//===- DebugLinesSubsection.h --------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGLINEFRAGMENT_H
+#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGLINEFRAGMENT_H
+
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
+#include "llvm/DebugInfo/CodeView/Line.h"
+#include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Error.h"
+
+namespace llvm {
+namespace codeview {
+
+class DebugChecksumsSubsection;
+class DebugStringTableSubsection;
+
+// Corresponds to the `CV_DebugSLinesHeader_t` structure.
+struct LineFragmentHeader {
+  support::ulittle32_t RelocOffset;  // Code offset of line contribution.
+  support::ulittle16_t RelocSegment; // Code segment of line contribution.
+  support::ulittle16_t Flags;        // See LineFlags enumeration.
+  support::ulittle32_t CodeSize;     // Code size of this line contribution.
+};
+
+// Corresponds to the `CV_DebugSLinesFileBlockHeader_t` structure.
+struct LineBlockFragmentHeader {
+  support::ulittle32_t NameIndex; // Offset of FileChecksum entry in File
+                                  // checksums buffer.  The checksum entry then
+                                  // contains another offset into the string
+                                  // table of the actual name.
+  support::ulittle32_t NumLines;  // Number of lines
+  support::ulittle32_t BlockSize; // Code size of block, in bytes.
+  // The following two variable length arrays appear immediately after the
+  // header.  The structure definitions follow.
+  // LineNumberEntry   Lines[NumLines];
+  // ColumnNumberEntry Columns[NumLines];
+};
+
+// Corresponds to `CV_Line_t` structure
+struct LineNumberEntry {
+  support::ulittle32_t Offset; // Offset to start of code bytes for line number
+  support::ulittle32_t Flags;  // Start:24, End:7, IsStatement:1
+};
+
+// Corresponds to `CV_Column_t` structure
+struct ColumnNumberEntry {
+  support::ulittle16_t StartColumn;
+  support::ulittle16_t EndColumn;
+};
+
+struct LineColumnEntry {
+  support::ulittle32_t NameIndex;
+  FixedStreamArray<LineNumberEntry> LineNumbers;
+  FixedStreamArray<ColumnNumberEntry> Columns;
+};
+
+class LineColumnExtractor {
+public:
+  typedef const LineFragmentHeader *ContextType;
+
+  static Error extract(BinaryStreamRef Stream, uint32_t &Len,
+                       LineColumnEntry &Item, const LineFragmentHeader *Ctx);
+};
+
+class DebugLinesSubsectionRef final : public DebugSubsectionRef {
+  friend class LineColumnExtractor;
+  typedef VarStreamArray<LineColumnEntry, LineColumnExtractor> LineInfoArray;
+  typedef LineInfoArray::Iterator Iterator;
+
+public:
+  DebugLinesSubsectionRef();
+
+  static bool classof(const DebugSubsectionRef *S) {
+    return S->kind() == DebugSubsectionKind::Lines;
+  }
+
+  Error initialize(BinaryStreamReader Reader);
+
+  Iterator begin() const { return LinesAndColumns.begin(); }
+  Iterator end() const { return LinesAndColumns.end(); }
+
+  const LineFragmentHeader *header() const { return Header; }
+
+  bool hasColumnInfo() const;
+
+private:
+  const LineFragmentHeader *Header = nullptr;
+  LineInfoArray LinesAndColumns;
+};
+
+class DebugLinesSubsection final : public DebugSubsection {
+  struct Block {
+    Block(uint32_t ChecksumBufferOffset)
+        : ChecksumBufferOffset(ChecksumBufferOffset) {}
+
+    uint32_t ChecksumBufferOffset;
+    std::vector<LineNumberEntry> Lines;
+    std::vector<ColumnNumberEntry> Columns;
+  };
+
+public:
+  DebugLinesSubsection(DebugChecksumsSubsection &Checksums,
+                       DebugStringTableSubsection &Strings);
+
+  static bool classof(const DebugSubsection *S) {
+    return S->kind() == DebugSubsectionKind::Lines;
+  }
+
+  void createBlock(StringRef FileName);
+  void addLineInfo(uint32_t Offset, const LineInfo &Line);
+  void addLineAndColumnInfo(uint32_t Offset, const LineInfo &Line,
+                            uint32_t ColStart, uint32_t ColEnd);
+
+  uint32_t calculateSerializedSize() const override;
+  Error commit(BinaryStreamWriter &Writer) const override;
+
+  void setRelocationAddress(uint16_t Segment, uint16_t Offset);
+  void setCodeSize(uint32_t Size);
+  void setFlags(LineFlags Flags);
+
+  bool hasColumnInfo() const;
+
+private:
+  DebugChecksumsSubsection &Checksums;
+
+  uint16_t RelocOffset = 0;
+  uint16_t RelocSegment = 0;
+  uint32_t CodeSize = 0;
+  LineFlags Flags = LF_None;
+  std::vector<Block> Blocks;
+};
+}
+}
+
+#endif

Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,86 @@
+//===- DebugStringTableSubsection.h - CodeView String Table -----*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSTRINGTABLESUBSECTION_H
+#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSTRINGTABLESUBSECTION_H
+
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Error.h"
+
+#include <stdint.h>
+
+namespace llvm {
+
+class BinaryStreamReader;
+class BinaryStreamRef;
+class BinaryStreamWriter;
+
+namespace codeview {
+
+/// Represents a read-only view of a CodeView string table.  This is a very
+/// simple flat buffer consisting of null-terminated strings, where strings
+/// are retrieved by their offset in the buffer.  DebugStringTableSubsectionRef
+/// does not own the underlying storage for the buffer.
+class DebugStringTableSubsectionRef : public DebugSubsectionRef {
+public:
+  DebugStringTableSubsectionRef();
+
+  static bool classof(const DebugSubsectionRef *S) {
+    return S->kind() == DebugSubsectionKind::StringTable;
+  }
+
+  Error initialize(BinaryStreamRef Contents);
+
+  Expected<StringRef> getString(uint32_t Offset) const;
+
+  bool valid() const { return Stream.valid(); }
+
+private:
+  BinaryStreamRef Stream;
+};
+
+/// Represents a read-write view of a CodeView string table.
+/// DebugStringTableSubsection owns the underlying storage for the table, and is
+/// capable of serializing the string table into a format understood by
+/// DebugStringTableSubsectionRef.
+class DebugStringTableSubsection : public DebugSubsection {
+public:
+  DebugStringTableSubsection();
+
+  static bool classof(const DebugSubsection *S) {
+    return S->kind() == DebugSubsectionKind::StringTable;
+  }
+
+  // If string S does not exist in the string table, insert it.
+  // Returns the ID for S.
+  uint32_t insert(StringRef S);
+
+  // Return the ID for string S.  Assumes S exists in the table.
+  uint32_t getStringId(StringRef S) const;
+
+  uint32_t calculateSerializedSize() const override;
+  Error commit(BinaryStreamWriter &Writer) const override;
+
+  uint32_t size() const;
+
+  StringMap<uint32_t>::const_iterator begin() const { return Strings.begin(); }
+
+  StringMap<uint32_t>::const_iterator end() const { return Strings.end(); }
+
+private:
+  StringMap<uint32_t> Strings;
+  uint32_t StringSize = 1;
+};
+}
+}
+
+#endif

Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsection.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsection.h	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,52 @@
+//===- DebugSubsection.h ------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENT_H
+#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENT_H
+
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Casting.h"
+
+namespace llvm {
+namespace codeview {
+
+class DebugSubsectionRef {
+public:
+  explicit DebugSubsectionRef(DebugSubsectionKind Kind) : Kind(Kind) {}
+  virtual ~DebugSubsectionRef();
+
+  static bool classof(const DebugSubsectionRef *S) { return true; }
+
+  DebugSubsectionKind kind() const { return Kind; }
+
+protected:
+  DebugSubsectionKind Kind;
+};
+
+class DebugSubsection {
+public:
+  explicit DebugSubsection(DebugSubsectionKind Kind) : Kind(Kind) {}
+  virtual ~DebugSubsection();
+
+  static bool classof(const DebugSubsection *S) { return true; }
+
+  DebugSubsectionKind kind() const { return Kind; }
+
+  virtual Error commit(BinaryStreamWriter &Writer) const = 0;
+  virtual uint32_t calculateSerializedSize() const = 0;
+
+protected:
+  DebugSubsectionKind Kind;
+};
+
+} // namespace codeview
+} // namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENT_H

Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsectionRecord.h	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,77 @@
+//===- DebugSubsection.h ------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
+#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
+
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+
+namespace llvm {
+namespace codeview {
+
+class DebugSubsection;
+
+// Corresponds to the `CV_DebugSSubsectionHeader_t` structure.
+struct DebugSubsectionHeader {
+  support::ulittle32_t Kind;   // codeview::DebugSubsectionKind enum
+  support::ulittle32_t Length; // number of bytes occupied by this record.
+};
+
+class DebugSubsectionRecord {
+public:
+  DebugSubsectionRecord();
+  DebugSubsectionRecord(DebugSubsectionKind Kind, BinaryStreamRef Data);
+
+  static Error initialize(BinaryStreamRef Stream, DebugSubsectionRecord &Info);
+
+  uint32_t getRecordLength() const;
+  DebugSubsectionKind kind() const;
+  BinaryStreamRef getRecordData() const;
+
+private:
+  DebugSubsectionKind Kind;
+  BinaryStreamRef Data;
+};
+
+class DebugSubsectionRecordBuilder {
+public:
+  DebugSubsectionRecordBuilder(DebugSubsectionKind Kind, DebugSubsection &Frag);
+  uint32_t calculateSerializedLength();
+  Error commit(BinaryStreamWriter &Writer);
+
+private:
+  DebugSubsectionKind Kind;
+  DebugSubsection &Frag;
+};
+
+} // namespace codeview
+
+template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
+  typedef void ContextType;
+
+  static Error extract(BinaryStreamRef Stream, uint32_t &Length,
+                       codeview::DebugSubsectionRecord &Info) {
+    if (auto EC = codeview::DebugSubsectionRecord::initialize(Stream, Info))
+      return EC;
+    Length = Info.getRecordLength();
+    return Error::success();
+  }
+};
+
+namespace codeview {
+typedef VarStreamArray<DebugSubsectionRecord> DebugSubsectionArray;
+}
+} // namespace llvm
+
+#endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H

Added: vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h	Tue May 30 17:37:31 2017	(r319230)
@@ -0,0 +1,66 @@
+//===- DebugSubsectionVisitor.h -----------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
+#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H
+
+#include "llvm/Support/Error.h"
+#include <cstdint>
+
+namespace llvm {
+
+namespace codeview {
+
+class DebugChecksumsSubsectionRef;
+class DebugSubsectionRecord;
+class DebugInlineeLinesSubsectionRef;
+class DebugLinesSubsectionRef;
+class DebugUnknownSubsectionRef;
+
+class DebugSubsectionVisitor {
+public:
+  virtual ~DebugSubsectionVisitor() = default;
+
+  virtual Error visitUnknown(DebugUnknownSubsectionRef &Unknown) {
+    return Error::success();
+  }
+  virtual Error visitLines(DebugLinesSubsectionRef &Lines) {
+    return Error::success();
+  }
+
+  virtual Error visitFileChecksums(DebugChecksumsSubsectionRef &Checksums) {
+    return Error::success();
+  }
+
+  virtual Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees) {
+    return Error::success();
+  }
+
+  virtual Error finished() { return Error::success(); }
+};
+
+Error visitDebugSubsection(const DebugSubsectionRecord &R,
+                           DebugSubsectionVisitor &V);
+
+template <typename T>
+Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V) {
+  for (const auto &L : FragmentRange) {
+    if (auto EC = visitDebugSubsection(L, V))
+      return EC;
+  }
+  if (auto EC = V.finished())
+    return EC;
+  return Error::success();

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list