Vendor import of llvm trunk r306956:
https://llvm.org/svn/llvm-project/llvm/trunk@306956
This commit is contained in:
parent
08bbd35a80
commit
9df3605dea
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/llvm/dist/; revision=320533 svn path=/vendor/llvm/llvm-trunk-r306956/; revision=320534; tag=vendor/llvm/llvm-trunk-r306956
@ -206,7 +206,7 @@ endif()
|
||||
include(VersionFromVCS)
|
||||
|
||||
option(LLVM_APPEND_VC_REV
|
||||
"Append the version control system revision id to LLVM version" OFF)
|
||||
"Embed the version control system revision id in LLVM" ON)
|
||||
|
||||
if( LLVM_APPEND_VC_REV )
|
||||
add_version_info_from_vcs(PACKAGE_VERSION)
|
||||
|
@ -70,7 +70,7 @@ D: Branch weights and BlockFrequencyInfo
|
||||
|
||||
N: Hal Finkel
|
||||
E: hfinkel@anl.gov
|
||||
D: BBVectorize, the loop reroller, alias analysis and the PowerPC target
|
||||
D: The loop reroller, alias analysis and the PowerPC target
|
||||
|
||||
N: Dan Gohman
|
||||
E: sunfish@mozilla.com
|
||||
|
@ -318,11 +318,12 @@ D: Support for implicit TLS model used with MS VC runtime
|
||||
D: Dumping of Win64 EH structures
|
||||
|
||||
N: Takumi Nakamura
|
||||
I: chapuni
|
||||
E: geek4civic@gmail.com
|
||||
E: chapuni@hf.rim.or.jp
|
||||
D: Cygwin and MinGW support.
|
||||
D: Win32 tweaks.
|
||||
S: Yokohama, Japan
|
||||
D: Maintaining the Git monorepo
|
||||
W: https://github.com/llvm-project/
|
||||
S: Ebina, Japan
|
||||
|
||||
N: Edward O'Callaghan
|
||||
E: eocallaghan@auroraux.org
|
||||
|
@ -77,7 +77,7 @@ CAMLprim value llvm_datalayout_pointer_size(value DL) {
|
||||
|
||||
/* Llvm.llcontext -> DataLayout.t -> Llvm.lltype */
|
||||
CAMLprim LLVMTypeRef llvm_datalayout_intptr_type(LLVMContextRef C, value DL) {
|
||||
return LLVMIntPtrTypeInContext(C, DataLayout_val(DL));;
|
||||
return LLVMIntPtrTypeInContext(C, DataLayout_val(DL));
|
||||
}
|
||||
|
||||
/* int -> DataLayout.t -> int */
|
||||
|
@ -247,9 +247,10 @@ LLVM-specific variables
|
||||
tests.
|
||||
|
||||
**LLVM_APPEND_VC_REV**:BOOL
|
||||
Append version control revision info (svn revision number or Git revision id)
|
||||
to LLVM version string (stored in the PACKAGE_VERSION macro). For this to work
|
||||
cmake must be invoked before the build. Defaults to OFF.
|
||||
Embed version control revision info (svn revision number or Git revision id).
|
||||
This is used among other things in the LLVM version string (stored in the
|
||||
PACKAGE_VERSION macro). For this to work cmake must be invoked before the
|
||||
build. Defaults to ON.
|
||||
|
||||
**LLVM_ENABLE_THREADS**:BOOL
|
||||
Build with threads support, if available. Defaults to ON.
|
||||
|
@ -134,9 +134,6 @@ OPTIONS
|
||||
BUGS
|
||||
----
|
||||
|
||||
* :program:`llvm-nm` cannot demangle C++ mangled names, like GNU :program:`nm`
|
||||
can.
|
||||
|
||||
* :program:`llvm-nm` does not support the full set of arguments that GNU
|
||||
:program:`nm` does.
|
||||
|
||||
|
205
docs/Docker.rst
Normal file
205
docs/Docker.rst
Normal file
@ -0,0 +1,205 @@
|
||||
=========================================
|
||||
A guide to Dockerfiles for building LLVM
|
||||
=========================================
|
||||
|
||||
Introduction
|
||||
============
|
||||
You can find a number of sources to build docker images with LLVM components in
|
||||
``llvm/utils/docker``. They can be used by anyone who wants to build the docker
|
||||
images for their own use, or as a starting point for someone who wants to write
|
||||
their own Dockerfiles.
|
||||
|
||||
We currently provide Dockerfiles with ``debian8`` and ``nvidia-cuda`` base images.
|
||||
We also provide an ``example`` image, which contains placeholders that one would need
|
||||
to fill out in order to produce Dockerfiles for a new docker image.
|
||||
|
||||
Why?
|
||||
----
|
||||
Docker images provide a way to produce binary distributions of
|
||||
software inside a controlled environment. Having Dockerfiles to builds docker images
|
||||
inside LLVM repo makes them much more discoverable than putting them into any other
|
||||
place.
|
||||
|
||||
Docker basics
|
||||
-------------
|
||||
If you've never heard about Docker before, you might find this section helpful
|
||||
to get a very basic explanation of it.
|
||||
`Docker <https://www.docker.com/>`_ is a popular solution for running programs in
|
||||
an isolated and reproducible environment, especially to maintain releases for
|
||||
software deployed to large distributed fleets.
|
||||
It uses linux kernel namespaces and cgroups to provide a lightweight isolation
|
||||
inside currently running linux kernel.
|
||||
A single active instance of dockerized environment is called a *docker
|
||||
container*.
|
||||
A snapshot of a docker container filesystem is called a *docker image*.
|
||||
One can start a container from a prebuilt docker image.
|
||||
|
||||
Docker images are built from a so-called *Dockerfile*, a source file written in
|
||||
a specialized language that defines instructions to be used when build
|
||||
the docker image (see `official
|
||||
documentation <https://docs.docker.com/engine/reference/builder/>`_ for more
|
||||
details). A minimal Dockerfile typically contains a base image and a number
|
||||
of RUN commands that have to be executed to build the image. When building a new
|
||||
image, docker will first download your base image, mount its filesystem as
|
||||
read-only and then add a writable overlay on top of it to keep track of all
|
||||
filesystem modifications, performed while building your image. When the build
|
||||
process is finished, a diff between your image's final filesystem state and the
|
||||
base image's filesystem is stored in the resulting image.
|
||||
|
||||
Overview
|
||||
========
|
||||
The ``llvm/utils/docker`` folder contains Dockerfiles and simple bash scripts to
|
||||
serve as a basis for anyone who wants to create their own Docker image with
|
||||
LLVM components, compiled from sources. The sources are checked out from the
|
||||
upstream svn repository when building the image.
|
||||
|
||||
Inside each subfolder we host Dockerfiles for two images:
|
||||
|
||||
- ``build/`` image is used to compile LLVM, it installs a system compiler and all
|
||||
build dependencies of LLVM. After the build process is finished, the build
|
||||
image will have an archive with compiled components at ``/tmp/clang.tar.gz``.
|
||||
- ``release/`` image usually only contains LLVM components, compiled by the
|
||||
``build/`` image, and also libstdc++ and binutils to make image minimally
|
||||
useful for C++ development. The assumption is that you usually want clang to
|
||||
be one of the provided components.
|
||||
|
||||
To build both of those images, use ``build_docker_image.sh`` script.
|
||||
It will checkout LLVM sources and build clang in the ``build`` container, copy results
|
||||
of the build to the local filesystem and then build the ``release`` container using
|
||||
those. The ``build_docker_image.sh`` accepts a list of LLVM repositories to
|
||||
checkout, and arguments for CMake invocation.
|
||||
|
||||
If you want to write your own docker image, start with an ``example/`` subfolder.
|
||||
It provides incomplete Dockerfiles with (very few) FIXMEs explaining the steps
|
||||
you need to take in order to make your Dockerfiles functional.
|
||||
|
||||
Usage
|
||||
=====
|
||||
The ``llvm/utils/build_docker_image.sh`` script provides a rather high degree of
|
||||
control on how to run the build. It allows you to specify the projects to
|
||||
checkout from svn and provide a list of CMake arguments to use during when
|
||||
building LLVM inside docker container.
|
||||
|
||||
Here's a very simple example of getting a docker image with clang binary,
|
||||
compiled by the system compiler in the debian8 image:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./llvm/utils/docker/build_docker_image.sh \
|
||||
--source debian8 \
|
||||
--docker-repository clang-debian8 --docker-tag "staging" \
|
||||
-- \
|
||||
-p clang -i install-clang -i install-clang-headers \
|
||||
-- \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
Note there are two levels of ``--`` indirection. First one separates
|
||||
``build_docker_image.sh`` arguments from ``llvm/utils/build_install_llvm.sh``
|
||||
arguments. Second one separates CMake arguments from ``build_install_llvm.sh``
|
||||
arguments. Note that build like that doesn't use a 2-stage build process that
|
||||
you probably want for clang. Running a 2-stage build is a little more intricate,
|
||||
this command will do that:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Run a 2-stage build.
|
||||
# LLVM_TARGETS_TO_BUILD=Native is to reduce stage1 compile time.
|
||||
# Options, starting with BOOTSTRAP_* are passed to stage2 cmake invocation.
|
||||
./build_docker_image.sh \
|
||||
--source debian8 \
|
||||
--docker-repository clang-debian8 --docker-tag "staging" \
|
||||
-- \
|
||||
-p clang -i stage2-install-clang -i stage2-install-clang-headers \
|
||||
-- \
|
||||
-DLLVM_TARGETS_TO_BUILD=Native -DCMAKE_BUILD_TYPE=Release \
|
||||
-DBOOTSTRAP_CMAKE_BUILD_TYPE=Release \
|
||||
-DCLANG_ENABLE_BOOTSTRAP=ON -DCLANG_BOOTSTRAP_TARGETS="install-clang;install-clang-headers"
|
||||
|
||||
This will produce two images, a release image ``clang-debian8:staging`` and a
|
||||
build image ``clang-debian8-build:staging`` from the latest upstream revision.
|
||||
After the image is built you can run bash inside a container based on your
|
||||
image like this:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
docker run -ti clang-debian8:staging bash
|
||||
|
||||
Now you can run bash commands as you normally would:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
root@80f351b51825:/# clang -v
|
||||
clang version 5.0.0 (trunk 305064)
|
||||
Target: x86_64-unknown-linux-gnu
|
||||
Thread model: posix
|
||||
InstalledDir: /bin
|
||||
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
|
||||
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
|
||||
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
|
||||
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
|
||||
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
|
||||
Candidate multilib: .;@m64
|
||||
Selected multilib: .;@m64
|
||||
|
||||
|
||||
Which image should I choose?
|
||||
============================
|
||||
We currently provide two images: debian8-based and nvidia-cuda-based. They
|
||||
differ in the base image that they use, i.e. they have a different set of
|
||||
preinstalled binaries. Debian8 is very minimal, nvidia-cuda is larger, but has
|
||||
preinstalled CUDA libraries and allows to access a GPU, installed on your
|
||||
machine.
|
||||
|
||||
If you need a minimal linux distribution with only clang and libstdc++ included,
|
||||
you should try debian8-based image.
|
||||
|
||||
If you want to use CUDA libraries and have access to a GPU on your machine,
|
||||
you should choose nvidia-cuda-based image and use `nvidia-docker
|
||||
<https://github.com/NVIDIA/nvidia-docker>`_ to run your docker containers. Note
|
||||
that you don't need nvidia-docker to build the images, but you need it in order
|
||||
to have an access to GPU from a docker container that is running the built
|
||||
image.
|
||||
|
||||
If you have a different use-case, you could create your own image based on
|
||||
``example/`` folder.
|
||||
|
||||
Any docker image can be built and run using only the docker binary, i.e. you can
|
||||
run debian8 build on Fedora or any other Linux distribution. You don't need to
|
||||
install CMake, compilers or any other clang dependencies. It is all handled
|
||||
during the build process inside Docker's isolated environment.
|
||||
|
||||
Stable build
|
||||
============
|
||||
If you want a somewhat recent and somewhat stable build, use the
|
||||
``branches/google/stable`` branch, i.e. the following command will produce a
|
||||
debian8-based image using the latest ``google/stable`` sources for you:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./llvm/utils/docker/build_docker_image.sh \
|
||||
-s debian8 --d clang-debian8 -t "staging" \
|
||||
-- \
|
||||
--branch branches/google/stable \
|
||||
-p clang -i install-clang -i install-clang-headers \
|
||||
-- \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
|
||||
Minimizing docker image size
|
||||
============================
|
||||
Due to Docker restrictions we use two images (i.e., build and release folders)
|
||||
for the release image to be as small as possible. It's much easier to achieve
|
||||
that using two images, because Docker would store a filesystem layer for each
|
||||
command in the Dockerfile, i.e. if you install some packages in one command,
|
||||
then remove those in a separate command, the size of the resulting image will
|
||||
still be proportinal to the size of an image with installed packages.
|
||||
Therefore, we strive to provide a very simple release image which only copies
|
||||
compiled clang and does not do anything else.
|
||||
|
||||
Docker 1.13 added a ``--squash`` flag that allows to flatten the layers of the
|
||||
image, i.e. remove the parts that were actually deleted. That is an easier way
|
||||
to produce the smallest images possible by using just a single image. We do not
|
||||
use it because as of today the flag is in experimental stage and not everyone
|
||||
may have the latest docker version available. When the flag is out of
|
||||
experimental stage, we should investigate replacing two images approach with
|
||||
just a single image, built using ``--squash`` flag.
|
@ -54,8 +54,9 @@ Non-comprehensive list of changes in this release
|
||||
its nature as a general purpose PDB manipulation / diagnostics tool that does
|
||||
more than just dumping contents.
|
||||
|
||||
|
||||
* ... next change ...
|
||||
* The ``BBVectorize`` pass has been removed. It was fully replaced and no
|
||||
longer used back in 2014 but we didn't get around to removing it. Now it is
|
||||
gone. The SLP vectorizer is the suggested non-loop vectorization pass.
|
||||
|
||||
.. NOTE
|
||||
If you would like to document a larger change, then you can add a
|
||||
@ -108,6 +109,15 @@ Changes to the OCaml bindings
|
||||
During this release ...
|
||||
|
||||
|
||||
Changes to the C API
|
||||
--------------------
|
||||
|
||||
* Deprecated the ``LLVMAddBBVectorizePass`` interface since the ``BBVectorize``
|
||||
pass has been removed. It is now a no-op and will be removed in the next
|
||||
release. Use ``LLVMAddSLPVectorizePass`` instead to get the supported SLP
|
||||
vectorizer.
|
||||
|
||||
|
||||
External Open Source Projects Using LLVM 5
|
||||
==========================================
|
||||
|
||||
|
@ -150,7 +150,7 @@ variable, where we list down the options and their defaults below.
|
||||
| xray_logfile_base | ``const char*`` | ``xray-log.`` | Filename base for the |
|
||||
| | | | XRay logfile. |
|
||||
+-------------------+-----------------+---------------+------------------------+
|
||||
| xray_fdr_log | ``bool`` | ``false`` | Whether to install the |
|
||||
| xray_fdr_log | ``bool`` | ``false`` | Whether to install the |
|
||||
| | | | Flight Data Recorder |
|
||||
| | | | (FDR) mode. |
|
||||
+-------------------+-----------------+---------------+------------------------+
|
||||
|
@ -91,6 +91,7 @@ representation.
|
||||
CompileCudaWithLLVM
|
||||
ReportingGuide
|
||||
Benchmarking
|
||||
Docker
|
||||
|
||||
:doc:`GettingStarted`
|
||||
Discusses how to get up and running quickly with the LLVM infrastructure.
|
||||
@ -161,6 +162,9 @@ representation.
|
||||
A collection of tips for frontend authors on how to generate IR
|
||||
which LLVM is able to effectively optimize.
|
||||
|
||||
:doc:`Docker`
|
||||
A reference for using Dockerfiles provided with LLVM.
|
||||
|
||||
|
||||
Programming Documentation
|
||||
=========================
|
||||
|
@ -33,7 +33,7 @@ extern "C" {
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createBBVectorizePass function. */
|
||||
/** DEPRECATED - Use LLVMAddSLPVectorizePass */
|
||||
void LLVMAddBBVectorizePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopVectorizePass function. */
|
||||
|
@ -69,10 +69,15 @@ class AliasSet : public ilist_node<AliasSet> {
|
||||
if (AAInfo == DenseMapInfo<AAMDNodes>::getEmptyKey())
|
||||
// We don't have a AAInfo yet. Set it to NewAAInfo.
|
||||
AAInfo = NewAAInfo;
|
||||
else if (AAInfo != NewAAInfo)
|
||||
// NewAAInfo conflicts with AAInfo.
|
||||
AAInfo = DenseMapInfo<AAMDNodes>::getTombstoneKey();
|
||||
|
||||
else {
|
||||
AAMDNodes Intersection(AAInfo.intersect(NewAAInfo));
|
||||
if (!Intersection) {
|
||||
// NewAAInfo conflicts with AAInfo.
|
||||
AAInfo = DenseMapInfo<AAMDNodes>::getTombstoneKey();
|
||||
return SizeChanged;
|
||||
}
|
||||
AAInfo = Intersection;
|
||||
}
|
||||
return SizeChanged;
|
||||
}
|
||||
|
||||
|
58
include/llvm/Analysis/CFLAliasAnalysisUtils.h
Normal file
58
include/llvm/Analysis/CFLAliasAnalysisUtils.h
Normal file
@ -0,0 +1,58 @@
|
||||
//=- CFLAliasAnalysisUtils.h - Utilities for CFL Alias Analysis ----*- C++-*-=//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
// \file
|
||||
// These are the utilities/helpers used by the CFL Alias Analyses available in
|
||||
// tree, i.e. Steensgaard's and Andersens'.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_CFLALIASANALYSISUTILS_H
|
||||
#define LLVM_ANALYSIS_CFLALIASANALYSISUTILS_H
|
||||
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/ValueHandle.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace cflaa {
|
||||
|
||||
template <typename AAResult> struct FunctionHandle final : public CallbackVH {
|
||||
FunctionHandle(Function *Fn, AAResult *Result)
|
||||
: CallbackVH(Fn), Result(Result) {
|
||||
assert(Fn != nullptr);
|
||||
assert(Result != nullptr);
|
||||
}
|
||||
|
||||
void deleted() override { removeSelfFromCache(); }
|
||||
void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
|
||||
|
||||
private:
|
||||
AAResult *Result;
|
||||
|
||||
void removeSelfFromCache() {
|
||||
assert(Result != nullptr);
|
||||
auto *Val = getValPtr();
|
||||
Result->evict(cast<Function>(Val));
|
||||
setValPtr(nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
static inline const Function *parentFunctionOfValue(const Value *Val) {
|
||||
if (auto *Inst = dyn_cast<Instruction>(Val)) {
|
||||
auto *Bb = Inst->getParent();
|
||||
return Bb->getParent();
|
||||
}
|
||||
|
||||
if (auto *Arg = dyn_cast<Argument>(Val))
|
||||
return Arg->getParent();
|
||||
return nullptr;
|
||||
} // namespace cflaa
|
||||
} // namespace llvm
|
||||
}
|
||||
|
||||
#endif // LLVM_ANALYSIS_CFLALIASANALYSISUTILS_H
|
@ -18,8 +18,8 @@
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/CFLAliasAnalysisUtils.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/ValueHandle.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include <forward_list>
|
||||
|
||||
@ -47,7 +47,7 @@ class CFLAndersAAResult : public AAResultBase<CFLAndersAAResult> {
|
||||
return false;
|
||||
}
|
||||
/// Evict the given function from cache
|
||||
void evict(const Function &Fn);
|
||||
void evict(const Function *Fn);
|
||||
|
||||
/// \brief Get the alias summary for the given function
|
||||
/// Return nullptr if the summary is not found or not available
|
||||
@ -57,27 +57,6 @@ class CFLAndersAAResult : public AAResultBase<CFLAndersAAResult> {
|
||||
AliasResult alias(const MemoryLocation &, const MemoryLocation &);
|
||||
|
||||
private:
|
||||
struct FunctionHandle final : public CallbackVH {
|
||||
FunctionHandle(Function *Fn, CFLAndersAAResult *Result)
|
||||
: CallbackVH(Fn), Result(Result) {
|
||||
assert(Fn != nullptr);
|
||||
assert(Result != nullptr);
|
||||
}
|
||||
|
||||
void deleted() override { removeSelfFromCache(); }
|
||||
void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
|
||||
|
||||
private:
|
||||
CFLAndersAAResult *Result;
|
||||
|
||||
void removeSelfFromCache() {
|
||||
assert(Result != nullptr);
|
||||
auto *Val = getValPtr();
|
||||
Result->evict(*cast<Function>(Val));
|
||||
setValPtr(nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Ensures that the given function is available in the cache.
|
||||
/// Returns the appropriate entry from the cache.
|
||||
const Optional<FunctionInfo> &ensureCached(const Function &);
|
||||
@ -97,7 +76,7 @@ class CFLAndersAAResult : public AAResultBase<CFLAndersAAResult> {
|
||||
/// that simply has empty sets.
|
||||
DenseMap<const Function *, Optional<FunctionInfo>> Cache;
|
||||
|
||||
std::forward_list<FunctionHandle> Handles;
|
||||
std::forward_list<cflaa::FunctionHandle<CFLAndersAAResult>> Handles;
|
||||
};
|
||||
|
||||
/// Analysis pass providing a never-invalidated alias analysis result.
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/CFLAliasAnalysisUtils.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/ValueHandle.h"
|
||||
@ -85,27 +86,6 @@ class CFLSteensAAResult : public AAResultBase<CFLSteensAAResult> {
|
||||
}
|
||||
|
||||
private:
|
||||
struct FunctionHandle final : public CallbackVH {
|
||||
FunctionHandle(Function *Fn, CFLSteensAAResult *Result)
|
||||
: CallbackVH(Fn), Result(Result) {
|
||||
assert(Fn != nullptr);
|
||||
assert(Result != nullptr);
|
||||
}
|
||||
|
||||
void deleted() override { removeSelfFromCache(); }
|
||||
void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
|
||||
|
||||
private:
|
||||
CFLSteensAAResult *Result;
|
||||
|
||||
void removeSelfFromCache() {
|
||||
assert(Result != nullptr);
|
||||
auto *Val = getValPtr();
|
||||
Result->evict(cast<Function>(Val));
|
||||
setValPtr(nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
const TargetLibraryInfo &TLI;
|
||||
|
||||
/// \brief Cached mapping of Functions to their StratifiedSets.
|
||||
@ -114,7 +94,7 @@ class CFLSteensAAResult : public AAResultBase<CFLSteensAAResult> {
|
||||
/// have any kind of recursion, it is discernable from a function
|
||||
/// that simply has empty sets.
|
||||
DenseMap<Function *, Optional<FunctionInfo>> Cache;
|
||||
std::forward_list<FunctionHandle> Handles;
|
||||
std::forward_list<cflaa::FunctionHandle<CFLSteensAAResult>> Handles;
|
||||
|
||||
FunctionInfo buildSetsFrom(Function *F);
|
||||
};
|
||||
|
@ -86,7 +86,6 @@ class IDFCalculator {
|
||||
private:
|
||||
DominatorTreeBase<BasicBlock> &DT;
|
||||
bool useLiveIn;
|
||||
DenseMap<DomTreeNode *, unsigned> DomLevels;
|
||||
const SmallPtrSetImpl<BasicBlock *> *LiveInBlocks;
|
||||
const SmallPtrSetImpl<BasicBlock *> *DefBlocks;
|
||||
};
|
||||
|
@ -139,7 +139,7 @@ class MemoryAccess
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and
|
||||
// dyn_cast
|
||||
static inline bool classof(const Value *V) {
|
||||
static bool classof(const Value *V) {
|
||||
unsigned ID = V->getValueID();
|
||||
return ID == MemoryUseVal || ID == MemoryPhiVal || ID == MemoryDefVal;
|
||||
}
|
||||
@ -241,7 +241,7 @@ class MemoryUseOrDef : public MemoryAccess {
|
||||
/// \brief Get the access that produces the memory state used by this Use.
|
||||
MemoryAccess *getDefiningAccess() const { return getOperand(0); }
|
||||
|
||||
static inline bool classof(const Value *MA) {
|
||||
static bool classof(const Value *MA) {
|
||||
return MA->getValueID() == MemoryUseVal || MA->getValueID() == MemoryDefVal;
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ class MemoryUse final : public MemoryUseOrDef {
|
||||
// allocate space for exactly one operand
|
||||
void *operator new(size_t s) { return User::operator new(s, 1); }
|
||||
|
||||
static inline bool classof(const Value *MA) {
|
||||
static bool classof(const Value *MA) {
|
||||
return MA->getValueID() == MemoryUseVal;
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ class MemoryDef final : public MemoryUseOrDef {
|
||||
// allocate space for exactly one operand
|
||||
void *operator new(size_t s) { return User::operator new(s, 1); }
|
||||
|
||||
static inline bool classof(const Value *MA) {
|
||||
static bool classof(const Value *MA) {
|
||||
return MA->getValueID() == MemoryDefVal;
|
||||
}
|
||||
|
||||
@ -526,7 +526,7 @@ class MemoryPhi final : public MemoryAccess {
|
||||
return getIncomingValue(Idx);
|
||||
}
|
||||
|
||||
static inline bool classof(const Value *V) {
|
||||
static bool classof(const Value *V) {
|
||||
return V->getValueID() == MemoryPhiVal;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class Value;
|
||||
///
|
||||
/// It allows reporting when optimizations are performed and when they are not
|
||||
/// along with the reasons for it. Hotness information of the corresponding
|
||||
/// code region can be included in the remark if DiagnosticHotnessRequested is
|
||||
/// code region can be included in the remark if DiagnosticsHotnessRequested is
|
||||
/// enabled in the LLVM context.
|
||||
class OptimizationRemarkEmitter {
|
||||
public:
|
||||
@ -45,10 +45,10 @@ class OptimizationRemarkEmitter {
|
||||
/// analysis pass).
|
||||
///
|
||||
/// Note that this ctor has a very different cost depending on whether
|
||||
/// F->getContext().getDiagnosticHotnessRequested() is on or not. If it's off
|
||||
/// F->getContext().getDiagnosticsHotnessRequested() is on or not. If it's off
|
||||
/// the operation is free.
|
||||
///
|
||||
/// Whereas if DiagnosticHotnessRequested is on, it is fairly expensive
|
||||
/// Whereas if DiagnosticsHotnessRequested is on, it is fairly expensive
|
||||
/// operation since BFI and all its required analyses are computed. This is
|
||||
/// for example useful for CGSCC passes that can't use function analyses
|
||||
/// passes in the old PM.
|
||||
|
@ -37,18 +37,38 @@
|
||||
#ifndef LLVM_ANALYSIS_REGIONINFO_H
|
||||
#define LLVM_ANALYSIS_REGIONINFO_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/DepthFirstIterator.h"
|
||||
#include "llvm/ADT/GraphTraits.h"
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/IR/CFG.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Dominators.h"
|
||||
#include "llvm/IR/PassManager.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class DominanceFrontier;
|
||||
class DominatorTree;
|
||||
class Loop;
|
||||
class LoopInfo;
|
||||
struct PostDominatorTree;
|
||||
class Region;
|
||||
template <class RegionTr> class RegionBase;
|
||||
class RegionInfo;
|
||||
template <class RegionTr> class RegionInfoBase;
|
||||
class RegionNode;
|
||||
|
||||
// Class to be specialized for different users of RegionInfo
|
||||
// (i.e. BasicBlocks or MachineBasicBlocks). This is only to avoid needing to
|
||||
// pass around an unreasonable number of template parameters.
|
||||
@ -59,37 +79,23 @@ struct RegionTraits {
|
||||
// RegionT
|
||||
// RegionNodeT
|
||||
// RegionInfoT
|
||||
typedef typename FuncT_::UnknownRegionTypeError BrokenT;
|
||||
using BrokenT = typename FuncT_::UnknownRegionTypeError;
|
||||
};
|
||||
|
||||
class DominatorTree;
|
||||
class DominanceFrontier;
|
||||
class Loop;
|
||||
class LoopInfo;
|
||||
struct PostDominatorTree;
|
||||
class raw_ostream;
|
||||
class Region;
|
||||
template <class RegionTr>
|
||||
class RegionBase;
|
||||
class RegionNode;
|
||||
class RegionInfo;
|
||||
template <class RegionTr>
|
||||
class RegionInfoBase;
|
||||
|
||||
template <>
|
||||
struct RegionTraits<Function> {
|
||||
typedef Function FuncT;
|
||||
typedef BasicBlock BlockT;
|
||||
typedef Region RegionT;
|
||||
typedef RegionNode RegionNodeT;
|
||||
typedef RegionInfo RegionInfoT;
|
||||
typedef DominatorTree DomTreeT;
|
||||
typedef DomTreeNode DomTreeNodeT;
|
||||
typedef DominanceFrontier DomFrontierT;
|
||||
typedef PostDominatorTree PostDomTreeT;
|
||||
typedef Instruction InstT;
|
||||
typedef Loop LoopT;
|
||||
typedef LoopInfo LoopInfoT;
|
||||
using FuncT = Function;
|
||||
using BlockT = BasicBlock;
|
||||
using RegionT = Region;
|
||||
using RegionNodeT = RegionNode;
|
||||
using RegionInfoT = RegionInfo;
|
||||
using DomTreeT = DominatorTree;
|
||||
using DomTreeNodeT = DomTreeNode;
|
||||
using DomFrontierT = DominanceFrontier;
|
||||
using PostDomTreeT = PostDominatorTree;
|
||||
using InstT = Instruction;
|
||||
using LoopT = Loop;
|
||||
using LoopInfoT = LoopInfo;
|
||||
|
||||
static unsigned getNumSuccessors(BasicBlock *BB) {
|
||||
return BB->getTerminator()->getNumSuccessors();
|
||||
@ -113,13 +119,10 @@ class RegionNodeBase {
|
||||
friend class RegionBase<Tr>;
|
||||
|
||||
public:
|
||||
typedef typename Tr::BlockT BlockT;
|
||||
typedef typename Tr::RegionT RegionT;
|
||||
using BlockT = typename Tr::BlockT;
|
||||
using RegionT = typename Tr::RegionT;
|
||||
|
||||
private:
|
||||
RegionNodeBase(const RegionNodeBase &) = delete;
|
||||
const RegionNodeBase &operator=(const RegionNodeBase &) = delete;
|
||||
|
||||
/// This is the entry basic block that starts this region node. If this is a
|
||||
/// BasicBlock RegionNode, then entry is just the basic block, that this
|
||||
/// RegionNode represents. Otherwise it is the entry of this (Sub)RegionNode.
|
||||
@ -150,6 +153,9 @@ class RegionNodeBase {
|
||||
: entry(Entry, isSubRegion), parent(Parent) {}
|
||||
|
||||
public:
|
||||
RegionNodeBase(const RegionNodeBase &) = delete;
|
||||
RegionNodeBase &operator=(const RegionNodeBase &) = delete;
|
||||
|
||||
/// @brief Get the parent Region of this RegionNode.
|
||||
///
|
||||
/// The parent Region is the Region this RegionNode belongs to. If for
|
||||
@ -247,24 +253,22 @@ class RegionNodeBase {
|
||||
/// tree, the second one creates a graphical representation using graphviz.
|
||||
template <class Tr>
|
||||
class RegionBase : public RegionNodeBase<Tr> {
|
||||
typedef typename Tr::FuncT FuncT;
|
||||
typedef typename Tr::BlockT BlockT;
|
||||
typedef typename Tr::RegionInfoT RegionInfoT;
|
||||
typedef typename Tr::RegionT RegionT;
|
||||
typedef typename Tr::RegionNodeT RegionNodeT;
|
||||
typedef typename Tr::DomTreeT DomTreeT;
|
||||
typedef typename Tr::LoopT LoopT;
|
||||
typedef typename Tr::LoopInfoT LoopInfoT;
|
||||
typedef typename Tr::InstT InstT;
|
||||
|
||||
typedef GraphTraits<BlockT *> BlockTraits;
|
||||
typedef GraphTraits<Inverse<BlockT *>> InvBlockTraits;
|
||||
typedef typename BlockTraits::ChildIteratorType SuccIterTy;
|
||||
typedef typename InvBlockTraits::ChildIteratorType PredIterTy;
|
||||
|
||||
friend class RegionInfoBase<Tr>;
|
||||
RegionBase(const RegionBase &) = delete;
|
||||
const RegionBase &operator=(const RegionBase &) = delete;
|
||||
|
||||
using FuncT = typename Tr::FuncT;
|
||||
using BlockT = typename Tr::BlockT;
|
||||
using RegionInfoT = typename Tr::RegionInfoT;
|
||||
using RegionT = typename Tr::RegionT;
|
||||
using RegionNodeT = typename Tr::RegionNodeT;
|
||||
using DomTreeT = typename Tr::DomTreeT;
|
||||
using LoopT = typename Tr::LoopT;
|
||||
using LoopInfoT = typename Tr::LoopInfoT;
|
||||
using InstT = typename Tr::InstT;
|
||||
|
||||
using BlockTraits = GraphTraits<BlockT *>;
|
||||
using InvBlockTraits = GraphTraits<Inverse<BlockT *>>;
|
||||
using SuccIterTy = typename BlockTraits::ChildIteratorType;
|
||||
using PredIterTy = typename InvBlockTraits::ChildIteratorType;
|
||||
|
||||
// Information necessary to manage this Region.
|
||||
RegionInfoT *RI;
|
||||
@ -274,12 +278,12 @@ class RegionBase : public RegionNodeBase<Tr> {
|
||||
// (The entry BasicBlock is part of RegionNode)
|
||||
BlockT *exit;
|
||||
|
||||
typedef std::vector<std::unique_ptr<RegionT>> RegionSet;
|
||||
using RegionSet = std::vector<std::unique_ptr<RegionT>>;
|
||||
|
||||
// The subregions of this region.
|
||||
RegionSet children;
|
||||
|
||||
typedef std::map<BlockT *, std::unique_ptr<RegionNodeT>> BBNodeMapT;
|
||||
using BBNodeMapT = std::map<BlockT *, std::unique_ptr<RegionNodeT>>;
|
||||
|
||||
// Save the BasicBlock RegionNodes that are element of this Region.
|
||||
mutable BBNodeMapT BBNodeMap;
|
||||
@ -308,6 +312,9 @@ class RegionBase : public RegionNodeBase<Tr> {
|
||||
RegionBase(BlockT *Entry, BlockT *Exit, RegionInfoT *RI, DomTreeT *DT,
|
||||
RegionT *Parent = nullptr);
|
||||
|
||||
RegionBase(const RegionBase &) = delete;
|
||||
RegionBase &operator=(const RegionBase &) = delete;
|
||||
|
||||
/// Delete the Region and all its subregions.
|
||||
~RegionBase();
|
||||
|
||||
@ -543,8 +550,8 @@ class RegionBase : public RegionNodeBase<Tr> {
|
||||
///
|
||||
/// These iterators iterator over all subregions of this Region.
|
||||
//@{
|
||||
typedef typename RegionSet::iterator iterator;
|
||||
typedef typename RegionSet::const_iterator const_iterator;
|
||||
using iterator = typename RegionSet::iterator;
|
||||
using const_iterator = typename RegionSet::const_iterator;
|
||||
|
||||
iterator begin() { return children.begin(); }
|
||||
iterator end() { return children.end(); }
|
||||
@ -563,12 +570,13 @@ class RegionBase : public RegionNodeBase<Tr> {
|
||||
class block_iterator_wrapper
|
||||
: public df_iterator<
|
||||
typename std::conditional<IsConst, const BlockT, BlockT>::type *> {
|
||||
typedef df_iterator<
|
||||
typename std::conditional<IsConst, const BlockT, BlockT>::type *> super;
|
||||
using super =
|
||||
df_iterator<
|
||||
typename std::conditional<IsConst, const BlockT, BlockT>::type *>;
|
||||
|
||||
public:
|
||||
typedef block_iterator_wrapper<IsConst> Self;
|
||||
typedef typename super::value_type value_type;
|
||||
using Self = block_iterator_wrapper<IsConst>;
|
||||
using value_type = typename super::value_type;
|
||||
|
||||
// Construct the begin iterator.
|
||||
block_iterator_wrapper(value_type Entry, value_type Exit)
|
||||
@ -592,8 +600,8 @@ class RegionBase : public RegionNodeBase<Tr> {
|
||||
}
|
||||
};
|
||||
|
||||
typedef block_iterator_wrapper<false> block_iterator;
|
||||
typedef block_iterator_wrapper<true> const_block_iterator;
|
||||
using block_iterator = block_iterator_wrapper<false>;
|
||||
using const_block_iterator = block_iterator_wrapper<true>;
|
||||
|
||||
block_iterator block_begin() { return block_iterator(getEntry(), getExit()); }
|
||||
|
||||
@ -604,8 +612,8 @@ class RegionBase : public RegionNodeBase<Tr> {
|
||||
}
|
||||
const_block_iterator block_end() const { return const_block_iterator(); }
|
||||
|
||||
typedef iterator_range<block_iterator> block_range;
|
||||
typedef iterator_range<const_block_iterator> const_block_range;
|
||||
using block_range = iterator_range<block_iterator>;
|
||||
using const_block_range = iterator_range<const_block_iterator>;
|
||||
|
||||
/// @brief Returns a range view of the basic blocks in the region.
|
||||
inline block_range blocks() {
|
||||
@ -626,14 +634,14 @@ class RegionBase : public RegionNodeBase<Tr> {
|
||||
/// are direct children of this Region. It does not iterate over any
|
||||
/// RegionNodes that are also element of a subregion of this Region.
|
||||
//@{
|
||||
typedef df_iterator<RegionNodeT *, df_iterator_default_set<RegionNodeT *>,
|
||||
false, GraphTraits<RegionNodeT *>>
|
||||
element_iterator;
|
||||
using element_iterator =
|
||||
df_iterator<RegionNodeT *, df_iterator_default_set<RegionNodeT *>, false,
|
||||
GraphTraits<RegionNodeT *>>;
|
||||
|
||||
typedef df_iterator<const RegionNodeT *,
|
||||
df_iterator_default_set<const RegionNodeT *>, false,
|
||||
GraphTraits<const RegionNodeT *>>
|
||||
const_element_iterator;
|
||||
using const_element_iterator =
|
||||
df_iterator<const RegionNodeT *,
|
||||
df_iterator_default_set<const RegionNodeT *>, false,
|
||||
GraphTraits<const RegionNodeT *>>;
|
||||
|
||||
element_iterator element_begin();
|
||||
element_iterator element_end();
|
||||
@ -661,29 +669,26 @@ inline raw_ostream &operator<<(raw_ostream &OS, const RegionNodeBase<Tr> &Node);
|
||||
/// Tree.
|
||||
template <class Tr>
|
||||
class RegionInfoBase {
|
||||
typedef typename Tr::BlockT BlockT;
|
||||
typedef typename Tr::FuncT FuncT;
|
||||
typedef typename Tr::RegionT RegionT;
|
||||
typedef typename Tr::RegionInfoT RegionInfoT;
|
||||
typedef typename Tr::DomTreeT DomTreeT;
|
||||
typedef typename Tr::DomTreeNodeT DomTreeNodeT;
|
||||
typedef typename Tr::PostDomTreeT PostDomTreeT;
|
||||
typedef typename Tr::DomFrontierT DomFrontierT;
|
||||
typedef GraphTraits<BlockT *> BlockTraits;
|
||||
typedef GraphTraits<Inverse<BlockT *>> InvBlockTraits;
|
||||
typedef typename BlockTraits::ChildIteratorType SuccIterTy;
|
||||
typedef typename InvBlockTraits::ChildIteratorType PredIterTy;
|
||||
|
||||
friend class RegionInfo;
|
||||
friend class MachineRegionInfo;
|
||||
typedef DenseMap<BlockT *, BlockT *> BBtoBBMap;
|
||||
typedef DenseMap<BlockT *, RegionT *> BBtoRegionMap;
|
||||
|
||||
using BlockT = typename Tr::BlockT;
|
||||
using FuncT = typename Tr::FuncT;
|
||||
using RegionT = typename Tr::RegionT;
|
||||
using RegionInfoT = typename Tr::RegionInfoT;
|
||||
using DomTreeT = typename Tr::DomTreeT;
|
||||
using DomTreeNodeT = typename Tr::DomTreeNodeT;
|
||||
using PostDomTreeT = typename Tr::PostDomTreeT;
|
||||
using DomFrontierT = typename Tr::DomFrontierT;
|
||||
using BlockTraits = GraphTraits<BlockT *>;
|
||||
using InvBlockTraits = GraphTraits<Inverse<BlockT *>>;
|
||||
using SuccIterTy = typename BlockTraits::ChildIteratorType;
|
||||
using PredIterTy = typename InvBlockTraits::ChildIteratorType;
|
||||
|
||||
using BBtoBBMap = DenseMap<BlockT *, BlockT *>;
|
||||
using BBtoRegionMap = DenseMap<BlockT *, RegionT *>;
|
||||
|
||||
RegionInfoBase();
|
||||
virtual ~RegionInfoBase();
|
||||
|
||||
RegionInfoBase(const RegionInfoBase &) = delete;
|
||||
const RegionInfoBase &operator=(const RegionInfoBase &) = delete;
|
||||
|
||||
RegionInfoBase(RegionInfoBase &&Arg)
|
||||
: DT(std::move(Arg.DT)), PDT(std::move(Arg.PDT)), DF(std::move(Arg.DF)),
|
||||
@ -691,6 +696,7 @@ class RegionInfoBase {
|
||||
BBtoRegion(std::move(Arg.BBtoRegion)) {
|
||||
Arg.wipe();
|
||||
}
|
||||
|
||||
RegionInfoBase &operator=(RegionInfoBase &&RHS) {
|
||||
DT = std::move(RHS.DT);
|
||||
PDT = std::move(RHS.PDT);
|
||||
@ -701,12 +707,14 @@ class RegionInfoBase {
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~RegionInfoBase();
|
||||
|
||||
DomTreeT *DT;
|
||||
PostDomTreeT *PDT;
|
||||
DomFrontierT *DF;
|
||||
|
||||
/// The top level region.
|
||||
RegionT *TopLevelRegion;
|
||||
RegionT *TopLevelRegion = nullptr;
|
||||
|
||||
/// Map every BB to the smallest region, that contains BB.
|
||||
BBtoRegionMap BBtoRegion;
|
||||
@ -785,6 +793,9 @@ class RegionInfoBase {
|
||||
void calculate(FuncT &F);
|
||||
|
||||
public:
|
||||
RegionInfoBase(const RegionInfoBase &) = delete;
|
||||
RegionInfoBase &operator=(const RegionInfoBase &) = delete;
|
||||
|
||||
static bool VerifyRegionInfo;
|
||||
static typename RegionT::PrintStyle printStyle;
|
||||
|
||||
@ -887,21 +898,22 @@ class Region : public RegionBase<RegionTraits<Function>> {
|
||||
|
||||
class RegionInfo : public RegionInfoBase<RegionTraits<Function>> {
|
||||
public:
|
||||
typedef RegionInfoBase<RegionTraits<Function>> Base;
|
||||
using Base = RegionInfoBase<RegionTraits<Function>>;
|
||||
|
||||
explicit RegionInfo();
|
||||
|
||||
~RegionInfo() override;
|
||||
|
||||
RegionInfo(RegionInfo &&Arg) : Base(std::move(static_cast<Base &>(Arg))) {
|
||||
updateRegionTree(*this, TopLevelRegion);
|
||||
}
|
||||
|
||||
RegionInfo &operator=(RegionInfo &&RHS) {
|
||||
Base::operator=(std::move(static_cast<Base &>(RHS)));
|
||||
updateRegionTree(*this, TopLevelRegion);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~RegionInfo() override;
|
||||
|
||||
/// Handle invalidation explicitly.
|
||||
bool invalidate(Function &F, const PreservedAnalyses &PA,
|
||||
FunctionAnalysisManager::Invalidator &);
|
||||
@ -931,8 +943,8 @@ class RegionInfoPass : public FunctionPass {
|
||||
|
||||
public:
|
||||
static char ID;
|
||||
explicit RegionInfoPass();
|
||||
|
||||
explicit RegionInfoPass();
|
||||
~RegionInfoPass() override;
|
||||
|
||||
RegionInfo &getRegionInfo() { return RI; }
|
||||
@ -953,10 +965,11 @@ class RegionInfoPass : public FunctionPass {
|
||||
/// \brief Analysis pass that exposes the \c RegionInfo for a function.
|
||||
class RegionInfoAnalysis : public AnalysisInfoMixin<RegionInfoAnalysis> {
|
||||
friend AnalysisInfoMixin<RegionInfoAnalysis>;
|
||||
|
||||
static AnalysisKey Key;
|
||||
|
||||
public:
|
||||
typedef RegionInfo Result;
|
||||
using Result = RegionInfo;
|
||||
|
||||
RegionInfo run(Function &F, FunctionAnalysisManager &AM);
|
||||
};
|
||||
@ -967,6 +980,7 @@ class RegionInfoPrinterPass : public PassInfoMixin<RegionInfoPrinterPass> {
|
||||
|
||||
public:
|
||||
explicit RegionInfoPrinterPass(raw_ostream &OS);
|
||||
|
||||
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
|
||||
};
|
||||
|
||||
@ -995,8 +1009,8 @@ RegionNodeBase<RegionTraits<Function>>::getNodeAs<Region>() const {
|
||||
template <class Tr>
|
||||
inline raw_ostream &operator<<(raw_ostream &OS,
|
||||
const RegionNodeBase<Tr> &Node) {
|
||||
typedef typename Tr::BlockT BlockT;
|
||||
typedef typename Tr::RegionT RegionT;
|
||||
using BlockT = typename Tr::BlockT;
|
||||
using RegionT = typename Tr::RegionT;
|
||||
|
||||
if (Node.isSubRegion())
|
||||
return OS << Node.template getNodeAs<RegionT>()->getNameStr();
|
||||
@ -1008,5 +1022,6 @@ extern template class RegionBase<RegionTraits<Function>>;
|
||||
extern template class RegionNodeBase<RegionTraits<Function>>;
|
||||
extern template class RegionInfoBase<RegionTraits<Function>>;
|
||||
|
||||
} // End llvm namespace
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_ANALYSIS_REGIONINFO_H
|
||||
|
@ -12,7 +12,11 @@
|
||||
#ifndef LLVM_ANALYSIS_REGIONINFOIMPL_H
|
||||
#define LLVM_ANALYSIS_REGIONINFOIMPL_H
|
||||
|
||||
#include "llvm/ADT/GraphTraits.h"
|
||||
#include "llvm/ADT/PostOrderIterator.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Analysis/DominanceFrontier.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/Analysis/PostDominators.h"
|
||||
@ -20,9 +24,15 @@
|
||||
#include "llvm/Analysis/RegionIterator.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -303,7 +313,8 @@ RegionBase<Tr>::element_end() const {
|
||||
|
||||
template <class Tr>
|
||||
typename Tr::RegionT *RegionBase<Tr>::getSubRegionNode(BlockT *BB) const {
|
||||
typedef typename Tr::RegionT RegionT;
|
||||
using RegionT = typename Tr::RegionT;
|
||||
|
||||
RegionT *R = RI->getRegionFor(BB);
|
||||
|
||||
if (!R || R == this)
|
||||
@ -330,7 +341,8 @@ typename Tr::RegionNodeT *RegionBase<Tr>::getBBNode(BlockT *BB) const {
|
||||
if (at == BBNodeMap.end()) {
|
||||
auto Deconst = const_cast<RegionBase<Tr> *>(this);
|
||||
typename BBNodeMapT::value_type V = {
|
||||
BB, make_unique<RegionNodeT>(static_cast<RegionT *>(Deconst), BB)};
|
||||
BB,
|
||||
llvm::make_unique<RegionNodeT>(static_cast<RegionT *>(Deconst), BB)};
|
||||
at = BBNodeMap.insert(std::move(V)).first;
|
||||
}
|
||||
return at->second.get();
|
||||
@ -357,10 +369,10 @@ void RegionBase<Tr>::transferChildrenTo(RegionT *To) {
|
||||
template <class Tr>
|
||||
void RegionBase<Tr>::addSubRegion(RegionT *SubRegion, bool moveChildren) {
|
||||
assert(!SubRegion->parent && "SubRegion already has a parent!");
|
||||
assert(find_if(*this,
|
||||
[&](const std::unique_ptr<RegionT> &R) {
|
||||
return R.get() == SubRegion;
|
||||
}) == children.end() &&
|
||||
assert(llvm::find_if(*this,
|
||||
[&](const std::unique_ptr<RegionT> &R) {
|
||||
return R.get() == SubRegion;
|
||||
}) == children.end() &&
|
||||
"Subregion already exists!");
|
||||
|
||||
SubRegion->parent = static_cast<RegionT *>(this);
|
||||
@ -402,7 +414,7 @@ typename Tr::RegionT *RegionBase<Tr>::removeSubRegion(RegionT *Child) {
|
||||
assert(Child->parent == this && "Child is not a child of this region!");
|
||||
Child->parent = nullptr;
|
||||
typename RegionSet::iterator I =
|
||||
find_if(children, [&](const std::unique_ptr<RegionT> &R) {
|
||||
llvm::find_if(children, [&](const std::unique_ptr<RegionT> &R) {
|
||||
return R.get() == Child;
|
||||
});
|
||||
assert(I != children.end() && "Region does not exit. Unable to remove.");
|
||||
@ -505,8 +517,7 @@ void RegionBase<Tr>::clearNodeCache() {
|
||||
//
|
||||
|
||||
template <class Tr>
|
||||
RegionInfoBase<Tr>::RegionInfoBase()
|
||||
: TopLevelRegion(nullptr) {}
|
||||
RegionInfoBase<Tr>::RegionInfoBase() = default;
|
||||
|
||||
template <class Tr>
|
||||
RegionInfoBase<Tr>::~RegionInfoBase() {
|
||||
@ -543,7 +554,8 @@ bool RegionInfoBase<Tr>::isCommonDomFrontier(BlockT *BB, BlockT *entry,
|
||||
template <class Tr>
|
||||
bool RegionInfoBase<Tr>::isRegion(BlockT *entry, BlockT *exit) const {
|
||||
assert(entry && exit && "entry and exit must not be null!");
|
||||
typedef typename DomFrontierT::DomSetType DST;
|
||||
|
||||
using DST = typename DomFrontierT::DomSetType;
|
||||
|
||||
DST *entrySuccs = &DF->find(entry)->second;
|
||||
|
||||
@ -689,7 +701,8 @@ void RegionInfoBase<Tr>::findRegionsWithEntry(BlockT *entry,
|
||||
|
||||
template <class Tr>
|
||||
void RegionInfoBase<Tr>::scanForRegions(FuncT &F, BBtoBBMap *ShortCut) {
|
||||
typedef typename std::add_pointer<FuncT>::type FuncPtrT;
|
||||
using FuncPtrT = typename std::add_pointer<FuncT>::type;
|
||||
|
||||
BlockT *entry = GraphTraits<FuncPtrT>::getEntryNode(&F);
|
||||
DomTreeNodeT *N = DT->getNode(entry);
|
||||
|
||||
@ -876,7 +889,7 @@ RegionInfoBase<Tr>::getCommonRegion(SmallVectorImpl<BlockT *> &BBs) const {
|
||||
|
||||
template <class Tr>
|
||||
void RegionInfoBase<Tr>::calculate(FuncT &F) {
|
||||
typedef typename std::add_pointer<FuncT>::type FuncPtrT;
|
||||
using FuncPtrT = typename std::add_pointer<FuncT>::type;
|
||||
|
||||
// ShortCut a function where for every BB the exit of the largest region
|
||||
// starting with BB is stored. These regions can be threated as single BBS.
|
||||
@ -892,4 +905,4 @@ void RegionInfoBase<Tr>::calculate(FuncT &F) {
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_ANALYSIS_REGIONINFOIMPL_H
|
||||
|
@ -8,17 +8,23 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
// This file defines the iterators to iterate over the elements of a Region.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_REGIONITERATOR_H
|
||||
#define LLVM_ANALYSIS_REGIONITERATOR_H
|
||||
|
||||
#include "llvm/ADT/DepthFirstIterator.h"
|
||||
#include "llvm/ADT/GraphTraits.h"
|
||||
#include "llvm/ADT/PointerIntPair.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/Analysis/RegionInfo.h"
|
||||
#include "llvm/IR/CFG.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BasicBlock;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// @brief Hierarchical RegionNode successor iterator.
|
||||
///
|
||||
@ -33,10 +39,9 @@ namespace llvm {
|
||||
template <class NodeRef, class BlockT, class RegionT>
|
||||
class RNSuccIterator
|
||||
: public std::iterator<std::forward_iterator_tag, NodeRef> {
|
||||
typedef std::iterator<std::forward_iterator_tag, NodeRef> super;
|
||||
|
||||
typedef GraphTraits<BlockT*> BlockTraits;
|
||||
typedef typename BlockTraits::ChildIteratorType SuccIterTy;
|
||||
using super = std::iterator<std::forward_iterator_tag, NodeRef>;
|
||||
using BlockTraits = GraphTraits<BlockT *>;
|
||||
using SuccIterTy = typename BlockTraits::ChildIteratorType;
|
||||
|
||||
// The iterator works in two modes, bb mode or region mode.
|
||||
enum ItMode {
|
||||
@ -92,16 +97,15 @@ class RNSuccIterator
|
||||
inline bool isExit(BlockT* BB) const {
|
||||
return getNode()->getParent()->getExit() == BB;
|
||||
}
|
||||
public:
|
||||
typedef RNSuccIterator<NodeRef, BlockT, RegionT> Self;
|
||||
|
||||
typedef typename super::value_type value_type;
|
||||
public:
|
||||
using Self = RNSuccIterator<NodeRef, BlockT, RegionT>;
|
||||
using value_type = typename super::value_type;
|
||||
|
||||
/// @brief Create begin iterator of a RegionNode.
|
||||
inline RNSuccIterator(NodeRef node)
|
||||
: Node(node, node->isSubRegion() ? ItRgBegin : ItBB),
|
||||
BItor(BlockTraits::child_begin(node->getEntry())) {
|
||||
|
||||
// Skip the exit block
|
||||
if (!isRegionMode())
|
||||
while (BlockTraits::child_end(node->getEntry()) != BItor && isExit(*BItor))
|
||||
@ -153,7 +157,6 @@ class RNSuccIterator
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// @brief Flat RegionNode iterator.
|
||||
///
|
||||
@ -163,16 +166,16 @@ class RNSuccIterator
|
||||
template <class NodeRef, class BlockT, class RegionT>
|
||||
class RNSuccIterator<FlatIt<NodeRef>, BlockT, RegionT>
|
||||
: public std::iterator<std::forward_iterator_tag, NodeRef> {
|
||||
typedef std::iterator<std::forward_iterator_tag, NodeRef> super;
|
||||
typedef GraphTraits<BlockT*> BlockTraits;
|
||||
typedef typename BlockTraits::ChildIteratorType SuccIterTy;
|
||||
using super = std::iterator<std::forward_iterator_tag, NodeRef>;
|
||||
using BlockTraits = GraphTraits<BlockT *>;
|
||||
using SuccIterTy = typename BlockTraits::ChildIteratorType;
|
||||
|
||||
NodeRef Node;
|
||||
SuccIterTy Itor;
|
||||
|
||||
public:
|
||||
typedef RNSuccIterator<FlatIt<NodeRef>, BlockT, RegionT> Self;
|
||||
typedef typename super::value_type value_type;
|
||||
using Self = RNSuccIterator<FlatIt<NodeRef>, BlockT, RegionT>;
|
||||
using value_type = typename super::value_type;
|
||||
|
||||
/// @brief Create the iterator from a RegionNode.
|
||||
///
|
||||
@ -255,8 +258,8 @@ inline RNSuccIterator<NodeRef, BlockT, RegionT> succ_end(NodeRef Node) {
|
||||
|
||||
#define RegionNodeGraphTraits(NodeT, BlockT, RegionT) \
|
||||
template <> struct GraphTraits<NodeT *> { \
|
||||
typedef NodeT *NodeRef; \
|
||||
typedef RNSuccIterator<NodeRef, BlockT, RegionT> ChildIteratorType; \
|
||||
using NodeRef = NodeT *; \
|
||||
using ChildIteratorType = RNSuccIterator<NodeRef, BlockT, RegionT>; \
|
||||
static NodeRef getEntryNode(NodeRef N) { return N; } \
|
||||
static inline ChildIteratorType child_begin(NodeRef N) { \
|
||||
return RNSuccIterator<NodeRef, BlockT, RegionT>(N); \
|
||||
@ -266,9 +269,9 @@ inline RNSuccIterator<NodeRef, BlockT, RegionT> succ_end(NodeRef Node) {
|
||||
} \
|
||||
}; \
|
||||
template <> struct GraphTraits<FlatIt<NodeT *>> { \
|
||||
typedef NodeT *NodeRef; \
|
||||
typedef RNSuccIterator<FlatIt<NodeRef>, BlockT, RegionT> \
|
||||
ChildIteratorType; \
|
||||
using NodeRef = NodeT *; \
|
||||
using ChildIteratorType = \
|
||||
RNSuccIterator<FlatIt<NodeRef>, BlockT, RegionT>; \
|
||||
static NodeRef getEntryNode(NodeRef N) { return N; } \
|
||||
static inline ChildIteratorType child_begin(NodeRef N) { \
|
||||
return RNSuccIterator<FlatIt<NodeRef>, BlockT, RegionT>(N); \
|
||||
@ -280,7 +283,7 @@ inline RNSuccIterator<NodeRef, BlockT, RegionT> succ_end(NodeRef Node) {
|
||||
|
||||
#define RegionGraphTraits(RegionT, NodeT) \
|
||||
template <> struct GraphTraits<RegionT *> : public GraphTraits<NodeT *> { \
|
||||
typedef df_iterator<NodeRef> nodes_iterator; \
|
||||
using nodes_iterator = df_iterator<NodeRef>; \
|
||||
static NodeRef getEntryNode(RegionT *R) { \
|
||||
return R->getNode(R->getEntry()); \
|
||||
} \
|
||||
@ -294,9 +297,9 @@ inline RNSuccIterator<NodeRef, BlockT, RegionT> succ_end(NodeRef Node) {
|
||||
template <> \
|
||||
struct GraphTraits<FlatIt<RegionT *>> \
|
||||
: public GraphTraits<FlatIt<NodeT *>> { \
|
||||
typedef df_iterator<NodeRef, df_iterator_default_set<NodeRef>, false, \
|
||||
GraphTraits<FlatIt<NodeRef>>> \
|
||||
nodes_iterator; \
|
||||
using nodes_iterator = \
|
||||
df_iterator<NodeRef, df_iterator_default_set<NodeRef>, false, \
|
||||
GraphTraits<FlatIt<NodeRef>>>; \
|
||||
static NodeRef getEntryNode(RegionT *R) { \
|
||||
return R->getBBNode(R->getEntry()); \
|
||||
} \
|
||||
@ -315,17 +318,19 @@ RegionGraphTraits(Region, RegionNode);
|
||||
RegionGraphTraits(const Region, const RegionNode);
|
||||
|
||||
template <> struct GraphTraits<RegionInfo*>
|
||||
: public GraphTraits<FlatIt<RegionNode*> > {
|
||||
typedef df_iterator<NodeRef, df_iterator_default_set<NodeRef>, false,
|
||||
GraphTraits<FlatIt<NodeRef>>>
|
||||
nodes_iterator;
|
||||
: public GraphTraits<FlatIt<RegionNode*>> {
|
||||
using nodes_iterator =
|
||||
df_iterator<NodeRef, df_iterator_default_set<NodeRef>, false,
|
||||
GraphTraits<FlatIt<NodeRef>>>;
|
||||
|
||||
static NodeRef getEntryNode(RegionInfo *RI) {
|
||||
return GraphTraits<FlatIt<Region*> >::getEntryNode(RI->getTopLevelRegion());
|
||||
return GraphTraits<FlatIt<Region*>>::getEntryNode(RI->getTopLevelRegion());
|
||||
}
|
||||
|
||||
static nodes_iterator nodes_begin(RegionInfo* RI) {
|
||||
return nodes_iterator::begin(getEntryNode(RI));
|
||||
}
|
||||
|
||||
static nodes_iterator nodes_end(RegionInfo *RI) {
|
||||
return nodes_iterator::end(getEntryNode(RI));
|
||||
}
|
||||
@ -333,21 +338,23 @@ template <> struct GraphTraits<RegionInfo*>
|
||||
|
||||
template <> struct GraphTraits<RegionInfoPass*>
|
||||
: public GraphTraits<RegionInfo *> {
|
||||
typedef df_iterator<NodeRef, df_iterator_default_set<NodeRef>, false,
|
||||
GraphTraits<FlatIt<NodeRef>>>
|
||||
nodes_iterator;
|
||||
using nodes_iterator =
|
||||
df_iterator<NodeRef, df_iterator_default_set<NodeRef>, false,
|
||||
GraphTraits<FlatIt<NodeRef>>>;
|
||||
|
||||
static NodeRef getEntryNode(RegionInfoPass *RI) {
|
||||
return GraphTraits<RegionInfo*>::getEntryNode(&RI->getRegionInfo());
|
||||
}
|
||||
|
||||
static nodes_iterator nodes_begin(RegionInfoPass* RI) {
|
||||
return GraphTraits<RegionInfo*>::nodes_begin(&RI->getRegionInfo());
|
||||
}
|
||||
|
||||
static nodes_iterator nodes_end(RegionInfoPass *RI) {
|
||||
return GraphTraits<RegionInfo*>::nodes_end(&RI->getRegionInfo());
|
||||
}
|
||||
};
|
||||
|
||||
} // End namespace llvm
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_ANALYSIS_REGIONITERATOR_H
|
||||
|
@ -262,7 +262,7 @@ class SCEVEqualPredicate final : public SCEVPredicate {
|
||||
const SCEVConstant *getRHS() const { return RHS; }
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEVPredicate *P) {
|
||||
static bool classof(const SCEVPredicate *P) {
|
||||
return P->getKind() == P_Equal;
|
||||
}
|
||||
};
|
||||
@ -360,7 +360,7 @@ class SCEVWrapPredicate final : public SCEVPredicate {
|
||||
bool isAlwaysTrue() const override;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEVPredicate *P) {
|
||||
static bool classof(const SCEVPredicate *P) {
|
||||
return P->getKind() == P_Wrap;
|
||||
}
|
||||
};
|
||||
@ -406,7 +406,7 @@ class SCEVUnionPredicate final : public SCEVPredicate {
|
||||
unsigned getComplexity() const override { return Preds.size(); }
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEVPredicate *P) {
|
||||
static bool classof(const SCEVPredicate *P) {
|
||||
return P->getKind() == P_Union;
|
||||
}
|
||||
};
|
||||
@ -1197,20 +1197,8 @@ class ScalarEvolution {
|
||||
const SCEV *getConstant(const APInt &Val);
|
||||
const SCEV *getConstant(Type *Ty, uint64_t V, bool isSigned = false);
|
||||
const SCEV *getTruncateExpr(const SCEV *Op, Type *Ty);
|
||||
|
||||
typedef SmallDenseMap<std::pair<const SCEV *, Type *>, const SCEV *, 8>
|
||||
ExtendCacheTy;
|
||||
const SCEV *getZeroExtendExpr(const SCEV *Op, Type *Ty);
|
||||
const SCEV *getZeroExtendExprCached(const SCEV *Op, Type *Ty,
|
||||
ExtendCacheTy &Cache);
|
||||
const SCEV *getZeroExtendExprImpl(const SCEV *Op, Type *Ty,
|
||||
ExtendCacheTy &Cache);
|
||||
|
||||
const SCEV *getSignExtendExpr(const SCEV *Op, Type *Ty);
|
||||
const SCEV *getSignExtendExprCached(const SCEV *Op, Type *Ty,
|
||||
ExtendCacheTy &Cache);
|
||||
const SCEV *getSignExtendExprImpl(const SCEV *Op, Type *Ty,
|
||||
ExtendCacheTy &Cache);
|
||||
const SCEV *getZeroExtendExpr(const SCEV *Op, Type *Ty, unsigned Depth = 0);
|
||||
const SCEV *getSignExtendExpr(const SCEV *Op, Type *Ty, unsigned Depth = 0);
|
||||
const SCEV *getAnyExtendExpr(const SCEV *Op, Type *Ty);
|
||||
const SCEV *getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
|
||||
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
|
||||
|
@ -46,7 +46,7 @@ namespace llvm {
|
||||
Type *getType() const { return V->getType(); }
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scConstant;
|
||||
}
|
||||
};
|
||||
@ -65,7 +65,7 @@ namespace llvm {
|
||||
Type *getType() const { return Ty; }
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scTruncate ||
|
||||
S->getSCEVType() == scZeroExtend ||
|
||||
S->getSCEVType() == scSignExtend;
|
||||
@ -82,7 +82,7 @@ namespace llvm {
|
||||
|
||||
public:
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scTruncate;
|
||||
}
|
||||
};
|
||||
@ -97,7 +97,7 @@ namespace llvm {
|
||||
|
||||
public:
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scZeroExtend;
|
||||
}
|
||||
};
|
||||
@ -112,7 +112,7 @@ namespace llvm {
|
||||
|
||||
public:
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scSignExtend;
|
||||
}
|
||||
};
|
||||
@ -167,7 +167,7 @@ namespace llvm {
|
||||
}
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scAddExpr ||
|
||||
S->getSCEVType() == scMulExpr ||
|
||||
S->getSCEVType() == scSMaxExpr ||
|
||||
@ -185,7 +185,7 @@ namespace llvm {
|
||||
|
||||
public:
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scAddExpr ||
|
||||
S->getSCEVType() == scMulExpr ||
|
||||
S->getSCEVType() == scSMaxExpr ||
|
||||
@ -217,7 +217,7 @@ namespace llvm {
|
||||
}
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scAddExpr;
|
||||
}
|
||||
};
|
||||
@ -234,7 +234,7 @@ namespace llvm {
|
||||
|
||||
public:
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scMulExpr;
|
||||
}
|
||||
};
|
||||
@ -263,7 +263,7 @@ namespace llvm {
|
||||
}
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scUDivExpr;
|
||||
}
|
||||
};
|
||||
@ -345,7 +345,7 @@ namespace llvm {
|
||||
}
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scAddRecExpr;
|
||||
}
|
||||
};
|
||||
@ -363,7 +363,7 @@ namespace llvm {
|
||||
|
||||
public:
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scSMaxExpr;
|
||||
}
|
||||
};
|
||||
@ -382,7 +382,7 @@ namespace llvm {
|
||||
|
||||
public:
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scUMaxExpr;
|
||||
}
|
||||
};
|
||||
@ -428,7 +428,7 @@ namespace llvm {
|
||||
Type *getType() const { return getValPtr()->getType(); }
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const SCEV *S) {
|
||||
static bool classof(const SCEV *S) {
|
||||
return S->getSCEVType() == scUnknown;
|
||||
}
|
||||
};
|
||||
|
@ -216,9 +216,23 @@ class TargetTransformInfo {
|
||||
/// other context they may not be folded. This routine can distinguish such
|
||||
/// cases.
|
||||
///
|
||||
/// \p Operands is a list of operands which can be a result of transformations
|
||||
/// of the current operands. The number of the operands on the list must equal
|
||||
/// to the number of the current operands the IR user has. Their order on the
|
||||
/// list must be the same as the order of the current operands the IR user
|
||||
/// has.
|
||||
///
|
||||
/// The returned cost is defined in terms of \c TargetCostConstants, see its
|
||||
/// comments for a detailed explanation of the cost values.
|
||||
int getUserCost(const User *U) const;
|
||||
int getUserCost(const User *U, ArrayRef<const Value *> Operands) const;
|
||||
|
||||
/// \brief This is a helper function which calls the two-argument getUserCost
|
||||
/// with \p Operands which are the current operands U has.
|
||||
int getUserCost(const User *U) const {
|
||||
SmallVector<const Value *, 4> Operands(U->value_op_begin(),
|
||||
U->value_op_end());
|
||||
return getUserCost(U, Operands);
|
||||
}
|
||||
|
||||
/// \brief Return true if branch divergence exists.
|
||||
///
|
||||
@ -366,7 +380,8 @@ class TargetTransformInfo {
|
||||
/// \brief Get target-customized preferences for the generic loop unrolling
|
||||
/// transformation. The caller will initialize UP with the current
|
||||
/// target-independent defaults.
|
||||
void getUnrollingPreferences(Loop *L, UnrollingPreferences &UP) const;
|
||||
void getUnrollingPreferences(Loop *L, ScalarEvolution &,
|
||||
UnrollingPreferences &UP) const;
|
||||
|
||||
/// @}
|
||||
|
||||
@ -823,13 +838,15 @@ class TargetTransformInfo::Concept {
|
||||
ArrayRef<const Value *> Arguments) = 0;
|
||||
virtual unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI,
|
||||
unsigned &JTSize) = 0;
|
||||
virtual int getUserCost(const User *U) = 0;
|
||||
virtual int
|
||||
getUserCost(const User *U, ArrayRef<const Value *> Operands) = 0;
|
||||
virtual bool hasBranchDivergence() = 0;
|
||||
virtual bool isSourceOfDivergence(const Value *V) = 0;
|
||||
virtual bool isAlwaysUniform(const Value *V) = 0;
|
||||
virtual unsigned getFlatAddressSpace() = 0;
|
||||
virtual bool isLoweredToCall(const Function *F) = 0;
|
||||
virtual void getUnrollingPreferences(Loop *L, UnrollingPreferences &UP) = 0;
|
||||
virtual void getUnrollingPreferences(Loop *L, ScalarEvolution &,
|
||||
UnrollingPreferences &UP) = 0;
|
||||
virtual bool isLegalAddImmediate(int64_t Imm) = 0;
|
||||
virtual bool isLegalICmpImmediate(int64_t Imm) = 0;
|
||||
virtual bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV,
|
||||
@ -998,7 +1015,9 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
|
||||
ArrayRef<const Value *> Arguments) override {
|
||||
return Impl.getIntrinsicCost(IID, RetTy, Arguments);
|
||||
}
|
||||
int getUserCost(const User *U) override { return Impl.getUserCost(U); }
|
||||
int getUserCost(const User *U, ArrayRef<const Value *> Operands) override {
|
||||
return Impl.getUserCost(U, Operands);
|
||||
}
|
||||
bool hasBranchDivergence() override { return Impl.hasBranchDivergence(); }
|
||||
bool isSourceOfDivergence(const Value *V) override {
|
||||
return Impl.isSourceOfDivergence(V);
|
||||
@ -1015,8 +1034,9 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
|
||||
bool isLoweredToCall(const Function *F) override {
|
||||
return Impl.isLoweredToCall(F);
|
||||
}
|
||||
void getUnrollingPreferences(Loop *L, UnrollingPreferences &UP) override {
|
||||
return Impl.getUnrollingPreferences(L, UP);
|
||||
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
|
||||
UnrollingPreferences &UP) override {
|
||||
return Impl.getUnrollingPreferences(L, SE, UP);
|
||||
}
|
||||
bool isLegalAddImmediate(int64_t Imm) override {
|
||||
return Impl.isLegalAddImmediate(Imm);
|
||||
|
@ -217,7 +217,8 @@ class TargetTransformInfoImplBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
void getUnrollingPreferences(Loop *, TTI::UnrollingPreferences &) {}
|
||||
void getUnrollingPreferences(Loop *, ScalarEvolution &,
|
||||
TTI::UnrollingPreferences &) {}
|
||||
|
||||
bool isLegalAddImmediate(int64_t Imm) { return false; }
|
||||
|
||||
@ -684,14 +685,14 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
|
||||
return static_cast<T *>(this)->getIntrinsicCost(IID, RetTy, ParamTys);
|
||||
}
|
||||
|
||||
unsigned getUserCost(const User *U) {
|
||||
unsigned getUserCost(const User *U, ArrayRef<const Value *> Operands) {
|
||||
if (isa<PHINode>(U))
|
||||
return TTI::TCC_Free; // Model all PHI nodes as free.
|
||||
|
||||
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(U)) {
|
||||
SmallVector<Value *, 4> Indices(GEP->idx_begin(), GEP->idx_end());
|
||||
return static_cast<T *>(this)->getGEPCost(
|
||||
GEP->getSourceElementType(), GEP->getPointerOperand(), Indices);
|
||||
return static_cast<T *>(this)->getGEPCost(GEP->getSourceElementType(),
|
||||
GEP->getPointerOperand(),
|
||||
Operands.drop_front());
|
||||
}
|
||||
|
||||
if (auto CS = ImmutableCallSite(U)) {
|
||||
|
@ -382,7 +382,7 @@ enum RelocationTypesARM64 {
|
||||
IMAGE_REL_ARM64_ADDR32 = 0x0001,
|
||||
IMAGE_REL_ARM64_ADDR32NB = 0x0002,
|
||||
IMAGE_REL_ARM64_BRANCH26 = 0x0003,
|
||||
IMAGE_REL_ARM64_PAGEBASE_REL2 = 0x0004,
|
||||
IMAGE_REL_ARM64_PAGEBASE_REL21 = 0x0004,
|
||||
IMAGE_REL_ARM64_REL21 = 0x0005,
|
||||
IMAGE_REL_ARM64_PAGEOFFSET_12A = 0x0006,
|
||||
IMAGE_REL_ARM64_PAGEOFFSET_12L = 0x0007,
|
||||
|
@ -62,6 +62,9 @@ enum LLVMConstants : uint32_t {
|
||||
const uint32_t DW_CIE_ID = UINT32_MAX;
|
||||
const uint64_t DW64_CIE_ID = UINT64_MAX;
|
||||
|
||||
// Identifier of an invalid DIE offset in the .debug_info section.
|
||||
const uint32_t DW_INVALID_OFFSET = UINT32_MAX;
|
||||
|
||||
enum Tag : uint16_t {
|
||||
#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) DW_TAG_##NAME = ID,
|
||||
#include "llvm/BinaryFormat/Dwarf.def"
|
||||
|
@ -112,6 +112,11 @@ struct WasmRelocation {
|
||||
int64_t Addend; // A value to add to the symbol.
|
||||
};
|
||||
|
||||
struct WasmLinkingData {
|
||||
uint32_t DataSize;
|
||||
uint32_t DataAlignment;
|
||||
};
|
||||
|
||||
enum : unsigned {
|
||||
WASM_SEC_CUSTOM = 0, // Custom / User-defined section
|
||||
WASM_SEC_TYPE = 1, // Function signature declarations
|
||||
@ -175,8 +180,10 @@ enum class ValType {
|
||||
|
||||
// Linking metadata kinds.
|
||||
enum : unsigned {
|
||||
WASM_STACK_POINTER = 0x1,
|
||||
WASM_SYMBOL_INFO = 0x2,
|
||||
WASM_STACK_POINTER = 0x1,
|
||||
WASM_SYMBOL_INFO = 0x2,
|
||||
WASM_DATA_SIZE = 0x3,
|
||||
WASM_DATA_ALIGNMENT = 0x4,
|
||||
};
|
||||
|
||||
enum : unsigned {
|
||||
|
@ -111,9 +111,14 @@ namespace llvm {
|
||||
|
||||
struct BitcodeFileContents {
|
||||
std::vector<BitcodeModule> Mods;
|
||||
StringRef Symtab, StrtabForSymtab;
|
||||
};
|
||||
|
||||
/// Returns the contents of a bitcode file.
|
||||
/// Returns the contents of a bitcode file. This includes the raw contents of
|
||||
/// the symbol table embedded in the bitcode file. Clients which require a
|
||||
/// symbol table should prefer to use irsymtab::read instead of this function
|
||||
/// because it creates a reader for the irsymtab and handles upgrading bitcode
|
||||
/// files without a symbol table or with an old symbol table.
|
||||
Expected<BitcodeFileContents> getBitcodeFileContents(MemoryBufferRef Buffer);
|
||||
|
||||
/// Returns a list of modules in the specified bitcode buffer.
|
||||
|
@ -28,18 +28,34 @@ namespace llvm {
|
||||
std::unique_ptr<BitstreamWriter> Stream;
|
||||
|
||||
StringTableBuilder StrtabBuilder{StringTableBuilder::RAW};
|
||||
bool WroteStrtab = false;
|
||||
|
||||
// Owns any strings created by the irsymtab writer until we create the
|
||||
// string table.
|
||||
BumpPtrAllocator Alloc;
|
||||
|
||||
bool WroteStrtab = false, WroteSymtab = false;
|
||||
|
||||
void writeBlob(unsigned Block, unsigned Record, StringRef Blob);
|
||||
|
||||
std::vector<Module *> Mods;
|
||||
|
||||
public:
|
||||
/// Create a BitcodeWriter that writes to Buffer.
|
||||
BitcodeWriter(SmallVectorImpl<char> &Buffer);
|
||||
|
||||
~BitcodeWriter();
|
||||
|
||||
/// Attempt to write a symbol table to the bitcode file. This must be called
|
||||
/// at most once after all modules have been written.
|
||||
///
|
||||
/// A reader does not require a symbol table to interpret a bitcode file;
|
||||
/// the symbol table is needed only to improve link-time performance. So
|
||||
/// this function may decide not to write a symbol table. It may so decide
|
||||
/// if, for example, the target is unregistered or the IR is malformed.
|
||||
void writeSymtab();
|
||||
|
||||
/// Write the bitcode file's string table. This must be called exactly once
|
||||
/// after all modules have been written.
|
||||
/// after all modules and the optional symbol table have been written.
|
||||
void writeStrtab();
|
||||
|
||||
/// Copy the string table for another module into this bitcode file. This
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
namespace llvm {
|
||||
namespace bitc {
|
||||
// The only top-level block types are MODULE, IDENTIFICATION and STRTAB.
|
||||
// The only top-level block types are MODULE, IDENTIFICATION, STRTAB and SYMTAB.
|
||||
enum BlockIDs {
|
||||
// Blocks
|
||||
MODULE_BLOCK_ID = FIRST_APPLICATION_BLOCKID,
|
||||
@ -57,6 +57,8 @@ enum BlockIDs {
|
||||
STRTAB_BLOCK_ID,
|
||||
|
||||
FULL_LTO_GLOBALVAL_SUMMARY_BLOCK_ID,
|
||||
|
||||
SYMTAB_BLOCK_ID,
|
||||
};
|
||||
|
||||
/// Identification block contains a string that describes the producer details,
|
||||
@ -571,6 +573,10 @@ enum StrtabCodes {
|
||||
STRTAB_BLOB = 1,
|
||||
};
|
||||
|
||||
enum SymtabCodes {
|
||||
SYMTAB_BLOB = 1,
|
||||
};
|
||||
|
||||
} // End bitc namespace
|
||||
} // End llvm namespace
|
||||
|
||||
|
@ -277,7 +277,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
|
||||
|
||||
unsigned getInliningThresholdMultiplier() { return 1; }
|
||||
|
||||
void getUnrollingPreferences(Loop *L, TTI::UnrollingPreferences &UP) {
|
||||
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
|
||||
TTI::UnrollingPreferences &UP) {
|
||||
// This unrolling functionality is target independent, but to provide some
|
||||
// motivation for its intended use, for x86:
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/CodeGen/GlobalISel/CallLowering.h - Call lowering --*- C++ -*-===//
|
||||
//===- llvm/CodeGen/GlobalISel/CallLowering.h - Call lowering ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -15,21 +15,31 @@
|
||||
#ifndef LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H
|
||||
#define LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/CodeGen/CallingConvLower.h"
|
||||
#include "llvm/CodeGen/ValueTypes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/CodeGen/MachineValueType.h"
|
||||
#include "llvm/IR/CallSite.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Target/TargetCallingConv.h"
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
namespace llvm {
|
||||
// Forward declarations.
|
||||
|
||||
class DataLayout;
|
||||
class Function;
|
||||
class MachineIRBuilder;
|
||||
class MachineOperand;
|
||||
struct MachinePointerInfo;
|
||||
class MachineRegisterInfo;
|
||||
class TargetLowering;
|
||||
class Type;
|
||||
class Value;
|
||||
|
||||
class CallLowering {
|
||||
const TargetLowering *TLI;
|
||||
|
||||
public:
|
||||
struct ArgInfo {
|
||||
unsigned Reg;
|
||||
@ -49,6 +59,12 @@ class CallLowering {
|
||||
/// arugment should go, exactly what happens can vary slightly. This
|
||||
/// class abstracts the differences.
|
||||
struct ValueHandler {
|
||||
ValueHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI,
|
||||
CCAssignFn *AssignFn)
|
||||
: MIRBuilder(MIRBuilder), MRI(MRI), AssignFn(AssignFn) {}
|
||||
|
||||
virtual ~ValueHandler() = default;
|
||||
|
||||
/// Materialize a VReg containing the address of the specified
|
||||
/// stack-based object. This is either based on a FrameIndex or
|
||||
/// direct SP manipulation, depending on the context. \p MPO
|
||||
@ -89,12 +105,6 @@ class CallLowering {
|
||||
return AssignFn(ValNo, ValVT, LocVT, LocInfo, Info.Flags, State);
|
||||
}
|
||||
|
||||
ValueHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI,
|
||||
CCAssignFn *AssignFn)
|
||||
: MIRBuilder(MIRBuilder), MRI(MRI), AssignFn(AssignFn) {}
|
||||
|
||||
virtual ~ValueHandler() {}
|
||||
|
||||
MachineIRBuilder &MIRBuilder;
|
||||
MachineRegisterInfo &MRI;
|
||||
CCAssignFn *AssignFn;
|
||||
@ -112,7 +122,6 @@ class CallLowering {
|
||||
return static_cast<const XXXTargetLowering *>(TLI);
|
||||
}
|
||||
|
||||
|
||||
template <typename FuncInfoTy>
|
||||
void setArgFlags(ArgInfo &Arg, unsigned OpNum, const DataLayout &DL,
|
||||
const FuncInfoTy &FuncInfo) const;
|
||||
@ -126,7 +135,7 @@ class CallLowering {
|
||||
|
||||
public:
|
||||
CallLowering(const TargetLowering *TLI) : TLI(TLI) {}
|
||||
virtual ~CallLowering() {}
|
||||
virtual ~CallLowering() = default;
|
||||
|
||||
/// This hook must be implemented to lower outgoing return values, described
|
||||
/// by \p Val, into the specified virtual register \p VReg.
|
||||
@ -200,6 +209,7 @@ class CallLowering {
|
||||
unsigned ResReg, ArrayRef<unsigned> ArgRegs,
|
||||
std::function<unsigned()> GetCalleeReg) const;
|
||||
};
|
||||
} // End namespace llvm.
|
||||
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/CodeGen/GlobalISel/IRTranslator.h - IRTranslator ---*- C++ -*-===//
|
||||
//===- llvm/CodeGen/GlobalISel/IRTranslator.h - IRTranslator ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -19,24 +19,33 @@
|
||||
#ifndef LLVM_CODEGEN_GLOBALISEL_IRTRANSLATOR_H
|
||||
#define LLVM_CODEGEN_GLOBALISEL_IRTRANSLATOR_H
|
||||
|
||||
#include "Types.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
|
||||
#include "llvm/CodeGen/GlobalISel/Types.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
namespace llvm {
|
||||
// Forward declarations.
|
||||
|
||||
class AllocaInst;
|
||||
class BasicBlock;
|
||||
class CallInst;
|
||||
class CallLowering;
|
||||
class Constant;
|
||||
class DataLayout;
|
||||
class Instruction;
|
||||
class MachineBasicBlock;
|
||||
class MachineFunction;
|
||||
class MachineInstr;
|
||||
class OptimizationRemarkEmitter;
|
||||
class MachineRegisterInfo;
|
||||
class OptimizationRemarkEmitter;
|
||||
class PHINode;
|
||||
class TargetPassConfig;
|
||||
class User;
|
||||
class Value;
|
||||
|
||||
// Technically the pass should run on an hypothetical MachineModule,
|
||||
// since it should translate Global into some sort of MachineGlobal.
|
||||
@ -53,6 +62,7 @@ class IRTranslator : public MachineFunctionPass {
|
||||
private:
|
||||
/// Interface used to lower the everything related to calls.
|
||||
const CallLowering *CLI;
|
||||
|
||||
/// Mapping of the values of the current LLVM IR function
|
||||
/// to the related virtual registers.
|
||||
ValueToVReg ValToVReg;
|
||||
@ -67,7 +77,7 @@ class IRTranslator : public MachineFunctionPass {
|
||||
// a mapping between the edges arriving at the BasicBlock to the corresponding
|
||||
// created MachineBasicBlocks. Some BasicBlocks that get translated to a
|
||||
// single MachineBasicBlock may also end up in this Map.
|
||||
typedef std::pair<const BasicBlock *, const BasicBlock *> CFGEdge;
|
||||
using CFGEdge = std::pair<const BasicBlock *, const BasicBlock *>;
|
||||
DenseMap<CFGEdge, SmallVector<MachineBasicBlock *, 1>> MachinePreds;
|
||||
|
||||
// List of stubbed PHI instructions, for values and basic blocks to be filled
|
||||
@ -165,7 +175,6 @@ class IRTranslator : public MachineFunctionPass {
|
||||
return translateCompare(U, MIRBuilder);
|
||||
}
|
||||
|
||||
|
||||
/// Add remaining operands onto phis we've translated. Executed after all
|
||||
/// MachineBasicBlocks for the function have been created.
|
||||
void finishPendingPhis();
|
||||
@ -356,7 +365,7 @@ class IRTranslator : public MachineFunctionPass {
|
||||
MachineFunction *MF;
|
||||
|
||||
/// MachineRegisterInfo used to create virtual registers.
|
||||
MachineRegisterInfo *MRI;
|
||||
MachineRegisterInfo *MRI = nullptr;
|
||||
|
||||
const DataLayout *DL;
|
||||
|
||||
@ -430,5 +439,6 @@ class IRTranslator : public MachineFunctionPass {
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
};
|
||||
|
||||
} // End namespace llvm.
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_GLOBALISEL_IRTRANSLATOR_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//==-- llvm/CodeGen/GlobalISel/InstructionSelector.h -------------*- C++ -*-==//
|
||||
//===- llvm/CodeGen/GlobalISel/InstructionSelector.h ------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -16,15 +16,16 @@
|
||||
#ifndef LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECTOR_H
|
||||
#define LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECTOR_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include <bitset>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MachineInstr;
|
||||
class MachineInstrBuilder;
|
||||
class MachineFunction;
|
||||
class MachineOperand;
|
||||
class MachineRegisterInfo;
|
||||
class RegisterBankInfo;
|
||||
@ -60,7 +61,7 @@ class PredicateBitsetImpl : public std::bitset<MaxPredicates> {
|
||||
/// Provides the logic to select generic machine instructions.
|
||||
class InstructionSelector {
|
||||
public:
|
||||
virtual ~InstructionSelector() {}
|
||||
virtual ~InstructionSelector() = default;
|
||||
|
||||
/// Select the (possibly generic) instruction \p I to only use target-specific
|
||||
/// opcodes. It is OK to insert multiple instructions, but they cannot be
|
||||
@ -76,7 +77,7 @@ class InstructionSelector {
|
||||
virtual bool select(MachineInstr &I) const = 0;
|
||||
|
||||
protected:
|
||||
typedef std::function<void(MachineInstrBuilder &)> ComplexRendererFn;
|
||||
using ComplexRendererFn = std::function<void(MachineInstrBuilder &)>;
|
||||
|
||||
InstructionSelector();
|
||||
|
||||
@ -110,6 +111,6 @@ class InstructionSelector {
|
||||
bool isObviouslySafeToFold(MachineInstr &MI) const;
|
||||
};
|
||||
|
||||
} // End namespace llvm.
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECTOR_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//==-- llvm/CodeGen/GlobalISel/LegalizerInfo.h -------------------*- C++ -*-==//
|
||||
//===- llvm/CodeGen/GlobalISel/LegalizerInfo.h ------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -12,33 +12,36 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CODEGEN_GLOBALISEL_MACHINELEGALIZER_H
|
||||
#define LLVM_CODEGEN_GLOBALISEL_MACHINELEGALIZER_H
|
||||
#ifndef LLVM_CODEGEN_GLOBALISEL_LEGALIZERINFO_H
|
||||
#define LLVM_CODEGEN_GLOBALISEL_LEGALIZERINFO_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/CodeGen/LowLevelType.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Support/LowLevelTypeImpl.h"
|
||||
#include "llvm/Target/TargetOpcodes.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <cassert>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
namespace llvm {
|
||||
class LLVMContext;
|
||||
|
||||
class MachineInstr;
|
||||
class MachineIRBuilder;
|
||||
class MachineRegisterInfo;
|
||||
class Type;
|
||||
class VectorType;
|
||||
|
||||
/// Legalization is decided based on an instruction's opcode, which type slot
|
||||
/// we're considering, and what the existing type is. These aspects are gathered
|
||||
/// together for convenience in the InstrAspect class.
|
||||
struct InstrAspect {
|
||||
unsigned Opcode;
|
||||
unsigned Idx;
|
||||
unsigned Idx = 0;
|
||||
LLT Type;
|
||||
|
||||
InstrAspect(unsigned Opcode, LLT Type) : Opcode(Opcode), Idx(0), Type(Type) {}
|
||||
InstrAspect(unsigned Opcode, LLT Type) : Opcode(Opcode), Type(Type) {}
|
||||
InstrAspect(unsigned Opcode, unsigned Idx, LLT Type)
|
||||
: Opcode(Opcode), Idx(Idx), Type(Type) {}
|
||||
|
||||
@ -104,6 +107,19 @@ class LegalizerInfo {
|
||||
/// before any query is made or incorrect results may be returned.
|
||||
void computeTables();
|
||||
|
||||
static bool needsLegalizingToDifferentSize(const LegalizeAction Action) {
|
||||
switch (Action) {
|
||||
case NarrowScalar:
|
||||
case WidenScalar:
|
||||
case FewerElements:
|
||||
case MoreElements:
|
||||
case Unsupported:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// More friendly way to set an action for common types that have an LLT
|
||||
/// representation.
|
||||
void setAction(const InstrAspect &Aspect, LegalizeAction Action) {
|
||||
@ -125,7 +141,6 @@ class LegalizerInfo {
|
||||
ScalarInVectorActions[std::make_pair(Opcode, ScalarTy)] = Action;
|
||||
}
|
||||
|
||||
|
||||
/// Determine what action should be taken to legalize the given generic
|
||||
/// instruction opcode, type-index and type. Requires computeTables to have
|
||||
/// been called.
|
||||
@ -145,8 +160,8 @@ class LegalizerInfo {
|
||||
|
||||
/// Iterate the given function (typically something like doubling the width)
|
||||
/// on Ty until we find a legal type for this operation.
|
||||
Optional<LLT> findLegalType(const InstrAspect &Aspect,
|
||||
function_ref<LLT(LLT)> NextType) const {
|
||||
Optional<LLT> findLegalizableSize(const InstrAspect &Aspect,
|
||||
function_ref<LLT(LLT)> NextType) const {
|
||||
LegalizeAction Action;
|
||||
const TypeMap &Map = Actions[Aspect.Opcode - FirstOp][Aspect.Idx];
|
||||
LLT Ty = Aspect.Type;
|
||||
@ -158,10 +173,9 @@ class LegalizerInfo {
|
||||
if (DefaultIt == DefaultActions.end())
|
||||
return None;
|
||||
Action = DefaultIt->second;
|
||||
}
|
||||
else
|
||||
} else
|
||||
Action = ActionIt->second;
|
||||
} while(Action != Legal);
|
||||
} while (needsLegalizingToDifferentSize(Action));
|
||||
return Ty;
|
||||
}
|
||||
|
||||
@ -203,18 +217,17 @@ class LegalizerInfo {
|
||||
static const int FirstOp = TargetOpcode::PRE_ISEL_GENERIC_OPCODE_START;
|
||||
static const int LastOp = TargetOpcode::PRE_ISEL_GENERIC_OPCODE_END;
|
||||
|
||||
typedef DenseMap<LLT, LegalizeAction> TypeMap;
|
||||
typedef DenseMap<std::pair<unsigned, LLT>, LegalizeAction> SIVActionMap;
|
||||
using TypeMap = DenseMap<LLT, LegalizeAction>;
|
||||
using SIVActionMap = DenseMap<std::pair<unsigned, LLT>, LegalizeAction>;
|
||||
|
||||
SmallVector<TypeMap, 1> Actions[LastOp - FirstOp + 1];
|
||||
SIVActionMap ScalarInVectorActions;
|
||||
DenseMap<std::pair<unsigned, LLT>, uint16_t> MaxLegalVectorElts;
|
||||
DenseMap<unsigned, LegalizeAction> DefaultActions;
|
||||
|
||||
bool TablesInitialized;
|
||||
bool TablesInitialized = false;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
} // End namespace llvm.
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CODEGEN_GLOBALISEL_LEGALIZERINFO_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//== llvm/CodeGen/GlobalISel/RegBankSelect.h - Reg Bank Selector -*- C++ -*-==//
|
||||
//=- llvm/CodeGen/GlobalISel/RegBankSelect.h - Reg Bank Selector --*- C++ -*-=//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -64,20 +64,27 @@
|
||||
#ifndef LLVM_CODEGEN_GLOBALISEL_REGBANKSELECT_H
|
||||
#define LLVM_CODEGEN_GLOBALISEL_REGBANKSELECT_H
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
|
||||
#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
|
||||
#include "llvm/CodeGen/MachineBasicBlock.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineOptimizationRemarkEmitter.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
// Forward declarations.
|
||||
|
||||
class BlockFrequency;
|
||||
class MachineBranchProbabilityInfo;
|
||||
class MachineBlockFrequencyInfo;
|
||||
class MachineBranchProbabilityInfo;
|
||||
class MachineOperand;
|
||||
class MachineRegisterInfo;
|
||||
class Pass;
|
||||
class raw_ostream;
|
||||
class TargetPassConfig;
|
||||
class TargetRegisterInfo;
|
||||
class raw_ostream;
|
||||
|
||||
/// This pass implements the reg bank selector pass used in the GlobalISel
|
||||
/// pipeline. At the end of this pass, all register operands have been assigned
|
||||
@ -105,6 +112,7 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
protected:
|
||||
/// Tell if the insert point has already been materialized.
|
||||
bool WasMaterialized = false;
|
||||
|
||||
/// Materialize the insertion point.
|
||||
///
|
||||
/// If isSplit() is true, this involves actually splitting
|
||||
@ -128,7 +136,7 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
virtual MachineBasicBlock::iterator getPointImpl() = 0;
|
||||
|
||||
public:
|
||||
virtual ~InsertPoint() {}
|
||||
virtual ~InsertPoint() = default;
|
||||
|
||||
/// The first call to this method will cause the splitting to
|
||||
/// happen if need be, then sub sequent calls just return
|
||||
@ -197,6 +205,7 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
private:
|
||||
/// Insertion point.
|
||||
MachineInstr &Instr;
|
||||
|
||||
/// Does the insertion point is before or after Instr.
|
||||
bool Before;
|
||||
|
||||
@ -216,6 +225,7 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
public:
|
||||
/// Create an insertion point before (\p Before=true) or after \p Instr.
|
||||
InstrInsertPoint(MachineInstr &Instr, bool Before = true);
|
||||
|
||||
bool isSplit() const override;
|
||||
uint64_t frequency(const Pass &P) const override;
|
||||
|
||||
@ -228,6 +238,7 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
private:
|
||||
/// Insertion point.
|
||||
MachineBasicBlock &MBB;
|
||||
|
||||
/// Does the insertion point is at the beginning or end of MBB.
|
||||
bool Beginning;
|
||||
|
||||
@ -252,6 +263,7 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
assert((Beginning || MBB.getFirstTerminator() == MBB.end()) &&
|
||||
"Invalid end point");
|
||||
}
|
||||
|
||||
bool isSplit() const override { return false; }
|
||||
uint64_t frequency(const Pass &P) const override;
|
||||
bool canMaterialize() const override { return true; };
|
||||
@ -262,10 +274,12 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
private:
|
||||
/// Source of the edge.
|
||||
MachineBasicBlock &Src;
|
||||
|
||||
/// Destination of the edge.
|
||||
/// After the materialization is done, this hold the basic block
|
||||
/// that resulted from the splitting.
|
||||
MachineBasicBlock *DstOrSplit;
|
||||
|
||||
/// P is used to update the analysis passes as applicable.
|
||||
Pass &P;
|
||||
|
||||
@ -286,9 +300,11 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
public:
|
||||
EdgeInsertPoint(MachineBasicBlock &Src, MachineBasicBlock &Dst, Pass &P)
|
||||
: InsertPoint(), Src(Src), DstOrSplit(&Dst), P(P) {}
|
||||
|
||||
bool isSplit() const override {
|
||||
return Src.succ_size() > 1 && DstOrSplit->pred_size() > 1;
|
||||
}
|
||||
|
||||
uint64_t frequency(const Pass &P) const override;
|
||||
bool canMaterialize() const override;
|
||||
};
|
||||
@ -311,9 +327,9 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
|
||||
/// \name Convenient types for a list of insertion points.
|
||||
/// @{
|
||||
typedef SmallVector<std::unique_ptr<InsertPoint>, 2> InsertionPoints;
|
||||
typedef InsertionPoints::iterator insertpt_iterator;
|
||||
typedef InsertionPoints::const_iterator const_insertpt_iterator;
|
||||
using InsertionPoints = SmallVector<std::unique_ptr<InsertPoint>, 2>;
|
||||
using insertpt_iterator = InsertionPoints::iterator;
|
||||
using const_insertpt_iterator = InsertionPoints::const_iterator;
|
||||
/// @}
|
||||
|
||||
private:
|
||||
@ -324,7 +340,7 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
/// Are all the insert points materializeable?
|
||||
bool CanMaterialize;
|
||||
/// Is there any of the insert points needing splitting?
|
||||
bool HasSplit;
|
||||
bool HasSplit = false;
|
||||
/// Insertion point for the repair code.
|
||||
/// The repairing code needs to happen just before these points.
|
||||
InsertionPoints InsertPoints;
|
||||
@ -407,10 +423,10 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
private:
|
||||
/// Cost of the local instructions.
|
||||
/// This cost is free of basic block frequency.
|
||||
uint64_t LocalCost;
|
||||
uint64_t LocalCost = 0;
|
||||
/// Cost of the non-local instructions.
|
||||
/// This cost should include the frequency of the related blocks.
|
||||
uint64_t NonLocalCost;
|
||||
uint64_t NonLocalCost = 0;
|
||||
/// Frequency of the block where the local instructions live.
|
||||
uint64_t LocalFreq;
|
||||
|
||||
@ -468,22 +484,22 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
|
||||
/// Interface to the target lowering info related
|
||||
/// to register banks.
|
||||
const RegisterBankInfo *RBI;
|
||||
const RegisterBankInfo *RBI = nullptr;
|
||||
|
||||
/// MRI contains all the register class/bank information that this
|
||||
/// pass uses and updates.
|
||||
MachineRegisterInfo *MRI;
|
||||
MachineRegisterInfo *MRI = nullptr;
|
||||
|
||||
/// Information on the register classes for the current function.
|
||||
const TargetRegisterInfo *TRI;
|
||||
const TargetRegisterInfo *TRI = nullptr;
|
||||
|
||||
/// Get the frequency of blocks.
|
||||
/// This is required for non-fast mode.
|
||||
MachineBlockFrequencyInfo *MBFI;
|
||||
MachineBlockFrequencyInfo *MBFI = nullptr;
|
||||
|
||||
/// Get the frequency of the edges.
|
||||
/// This is required for non-fast mode.
|
||||
MachineBranchProbabilityInfo *MBPI;
|
||||
MachineBranchProbabilityInfo *MBPI = nullptr;
|
||||
|
||||
/// Current optimization remark emitter. Used to report failures.
|
||||
std::unique_ptr<MachineOptimizationRemarkEmitter> MORE;
|
||||
@ -644,6 +660,6 @@ class RegBankSelect : public MachineFunctionPass {
|
||||
bool runOnMachineFunction(MachineFunction &MF) override;
|
||||
};
|
||||
|
||||
} // End namespace llvm.
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CODEGEN_GLOBALISEL_REGBANKSELECT_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//==-- llvm/CodeGen/GlobalISel/RegisterBankInfo.h ----------------*- C++ -*-==//
|
||||
//===- llvm/CodeGen/GlobalISel/RegisterBankInfo.h ---------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -12,26 +12,27 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CODEGEN_GLOBALISEL_REGBANKINFO_H
|
||||
#define LLVM_CODEGEN_GLOBALISEL_REGBANKINFO_H
|
||||
#ifndef LLVM_CODEGEN_GLOBALISEL_REGISTERBANKINFO_H
|
||||
#define LLVM_CODEGEN_GLOBALISEL_REGISTERBANKINFO_H
|
||||
|
||||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/Hashing.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
|
||||
#include "llvm/CodeGen/MachineValueType.h" // For SimpleValueType.
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <memory> // For unique_ptr.
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MachineInstr;
|
||||
class MachineRegisterInfo;
|
||||
class TargetInstrInfo;
|
||||
class TargetRegisterInfo;
|
||||
class raw_ostream;
|
||||
class RegisterBank;
|
||||
class TargetInstrInfo;
|
||||
class TargetRegisterClass;
|
||||
class TargetRegisterInfo;
|
||||
|
||||
/// Holds all the information related to register banks.
|
||||
class RegisterBankInfo {
|
||||
@ -48,10 +49,12 @@ class RegisterBankInfo {
|
||||
/// original value. The bits are counted from less significant
|
||||
/// bits to most significant bits.
|
||||
unsigned StartIdx;
|
||||
|
||||
/// Length of this mapping in bits. This is how many bits this
|
||||
/// partial mapping covers in the original value:
|
||||
/// from StartIdx to StartIdx + Length -1.
|
||||
unsigned Length;
|
||||
|
||||
/// Register bank where the partial value lives.
|
||||
const RegisterBank *RegBank;
|
||||
|
||||
@ -180,13 +183,16 @@ class RegisterBankInfo {
|
||||
/// Identifier of the mapping.
|
||||
/// This is used to communicate between the target and the optimizers
|
||||
/// which mapping should be realized.
|
||||
unsigned ID;
|
||||
unsigned ID = InvalidMappingID;
|
||||
|
||||
/// Cost of this mapping.
|
||||
unsigned Cost;
|
||||
unsigned Cost = 0;
|
||||
|
||||
/// Mapping of all the operands.
|
||||
const ValueMapping *OperandsMapping;
|
||||
|
||||
/// Number of operands.
|
||||
unsigned NumOperands;
|
||||
unsigned NumOperands = 0;
|
||||
|
||||
const ValueMapping &getOperandMapping(unsigned i) {
|
||||
assert(i < getNumOperands() && "Out of bound operand");
|
||||
@ -213,7 +219,7 @@ class RegisterBankInfo {
|
||||
|
||||
/// Default constructor.
|
||||
/// Use this constructor to express that the mapping is invalid.
|
||||
InstructionMapping() : ID(InvalidMappingID), Cost(0), NumOperands(0) {}
|
||||
InstructionMapping() = default;
|
||||
|
||||
/// Get the cost.
|
||||
unsigned getCost() const { return Cost; }
|
||||
@ -264,7 +270,7 @@ class RegisterBankInfo {
|
||||
/// Convenient type to represent the alternatives for mapping an
|
||||
/// instruction.
|
||||
/// \todo When we move to TableGen this should be an array ref.
|
||||
typedef SmallVector<const InstructionMapping *, 4> InstructionMappings;
|
||||
using InstructionMappings = SmallVector<const InstructionMapping *, 4>;
|
||||
|
||||
/// Helper class used to get/create the virtual registers that will be used
|
||||
/// to replace the MachineOperand when applying a mapping.
|
||||
@ -273,12 +279,16 @@ class RegisterBankInfo {
|
||||
/// OpIdx-th operand starts. -1 means we do not have such mapping yet.
|
||||
/// Note: We use a SmallVector to avoid heap allocation for most cases.
|
||||
SmallVector<int, 8> OpToNewVRegIdx;
|
||||
|
||||
/// Hold the registers that will be used to map MI with InstrMapping.
|
||||
SmallVector<unsigned, 8> NewVRegs;
|
||||
|
||||
/// Current MachineRegisterInfo, used to create new virtual registers.
|
||||
MachineRegisterInfo &MRI;
|
||||
|
||||
/// Instruction being remapped.
|
||||
MachineInstr &MI;
|
||||
|
||||
/// New mapping of the instruction.
|
||||
const InstructionMapping &InstrMapping;
|
||||
|
||||
@ -373,6 +383,7 @@ class RegisterBankInfo {
|
||||
protected:
|
||||
/// Hold the set of supported register banks.
|
||||
RegisterBank **RegBanks;
|
||||
|
||||
/// Total number of register banks.
|
||||
unsigned NumRegBanks;
|
||||
|
||||
@ -729,6 +740,7 @@ operator<<(raw_ostream &OS, const RegisterBankInfo::OperandsMapper &OpdMapper) {
|
||||
/// Hashing function for PartialMapping.
|
||||
/// It is required for the hashing of ValueMapping.
|
||||
hash_code hash_value(const RegisterBankInfo::PartialMapping &PartMapping);
|
||||
} // End namespace llvm.
|
||||
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_GLOBALISEL_REGISTERBANKINFO_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/CodeGen/GlobalISel/Types.h - Types used by GISel ----*- C++ -*-===//
|
||||
//===- llvm/CodeGen/GlobalISel/Types.h - Types used by GISel ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -16,17 +16,19 @@
|
||||
#define LLVM_CODEGEN_GLOBALISEL_TYPES_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Value;
|
||||
|
||||
/// Map a value to a virtual register.
|
||||
/// For now, we chose to map aggregate types to on single virtual
|
||||
/// register. This might be revisited if it turns out to be inefficient.
|
||||
/// PR26161 tracks that.
|
||||
/// Note: We need to expose this type to the target hooks for thing like
|
||||
/// ABI lowering that would be used during IRTranslation.
|
||||
typedef DenseMap<const Value *, unsigned> ValueToVReg;
|
||||
using ValueToVReg = DenseMap<const Value *, unsigned>;
|
||||
|
||||
} // End namespace llvm.
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_GLOBALISEL_TYPES_H
|
||||
|
@ -134,7 +134,7 @@ using MNV = DiagnosticInfoMIROptimization::MachineArgument;
|
||||
///
|
||||
/// It allows reporting when optimizations are performed and when they are not
|
||||
/// along with the reasons for it. Hotness information of the corresponding
|
||||
/// code region can be included in the remark if DiagnosticHotnessRequested is
|
||||
/// code region can be included in the remark if DiagnosticsHotnessRequested is
|
||||
/// enabled in the LLVM context.
|
||||
class MachineOptimizationRemarkEmitter {
|
||||
public:
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- llvm/CodeGen/MachinePassRegistry.h ----------------------*- C++ -*-===//
|
||||
//===- llvm/CodeGen/MachinePassRegistry.h -----------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -18,13 +18,13 @@
|
||||
#ifndef LLVM_CODEGEN_MACHINEPASSREGISTRY_H
|
||||
#define LLVM_CODEGEN_MACHINEPASSREGISTRY_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
typedef void *(*MachinePassCtor)();
|
||||
|
||||
using MachinePassCtor = void *(*)();
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
@ -34,36 +34,30 @@ typedef void *(*MachinePassCtor)();
|
||||
//===----------------------------------------------------------------------===//
|
||||
class MachinePassRegistryListener {
|
||||
virtual void anchor();
|
||||
|
||||
public:
|
||||
MachinePassRegistryListener() {}
|
||||
virtual ~MachinePassRegistryListener() {}
|
||||
MachinePassRegistryListener() = default;
|
||||
virtual ~MachinePassRegistryListener() = default;
|
||||
|
||||
virtual void NotifyAdd(StringRef N, MachinePassCtor C, StringRef D) = 0;
|
||||
virtual void NotifyRemove(StringRef N) = 0;
|
||||
};
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// MachinePassRegistryNode - Machine pass node stored in registration list.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
class MachinePassRegistryNode {
|
||||
|
||||
private:
|
||||
|
||||
MachinePassRegistryNode *Next; // Next function pass in list.
|
||||
MachinePassRegistryNode *Next = nullptr; // Next function pass in list.
|
||||
StringRef Name; // Name of function pass.
|
||||
StringRef Description; // Description string.
|
||||
MachinePassCtor Ctor; // Function pass creator.
|
||||
|
||||
public:
|
||||
|
||||
MachinePassRegistryNode(const char *N, const char *D, MachinePassCtor C)
|
||||
: Next(nullptr)
|
||||
, Name(N)
|
||||
, Description(D)
|
||||
, Ctor(C)
|
||||
{}
|
||||
: Name(N), Description(D), Ctor(C) {}
|
||||
|
||||
// Accessors
|
||||
MachinePassRegistryNode *getNext() const { return Next; }
|
||||
@ -72,25 +66,20 @@ class MachinePassRegistryNode {
|
||||
StringRef getDescription() const { return Description; }
|
||||
MachinePassCtor getCtor() const { return Ctor; }
|
||||
void setNext(MachinePassRegistryNode *N) { Next = N; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// MachinePassRegistry - Track the registration of machine passes.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
class MachinePassRegistry {
|
||||
|
||||
private:
|
||||
|
||||
MachinePassRegistryNode *List; // List of registry nodes.
|
||||
MachinePassCtor Default; // Default function pass creator.
|
||||
MachinePassRegistryListener* Listener;// Listener for list adds are removes.
|
||||
MachinePassRegistryListener *Listener; // Listener for list adds are removes.
|
||||
|
||||
public:
|
||||
|
||||
// NO CONSTRUCTOR - we don't want static constructor ordering to mess
|
||||
// with the registry.
|
||||
|
||||
@ -109,10 +98,8 @@ class MachinePassRegistry {
|
||||
/// Remove - Removes a function pass from the registration list.
|
||||
///
|
||||
void Remove(MachinePassRegistryNode *Node);
|
||||
|
||||
};
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// RegisterPassParser class - Handle the addition of new machine passes.
|
||||
@ -142,7 +129,6 @@ class RegisterPassParser : public MachinePassRegistryListener,
|
||||
}
|
||||
|
||||
// Implement the MachinePassRegistryListener callbacks.
|
||||
//
|
||||
void NotifyAdd(StringRef N, MachinePassCtor C, StringRef D) override {
|
||||
this->addLiteralOption(N, (typename RegistryClass::FunctionPassCtor)C, D);
|
||||
}
|
||||
@ -151,7 +137,6 @@ class RegisterPassParser : public MachinePassRegistryListener,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CODEGEN_MACHINEPASSREGISTRY_H
|
||||
|
@ -32,7 +32,7 @@
|
||||
//
|
||||
// ScheduleDAGInstrs *<Target>PassConfig::
|
||||
// createMachineScheduler(MachineSchedContext *C) {
|
||||
// return new ScheduleDAGMI(C, CustomStrategy(C));
|
||||
// return new ScheduleDAGMILive(C, CustomStrategy(C));
|
||||
// }
|
||||
//
|
||||
// The DAG builder can also be customized in a sense by adding DAG mutations
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -232,8 +233,7 @@ namespace llvm {
|
||||
Any = 255
|
||||
};
|
||||
|
||||
SimpleValueType SimpleTy;
|
||||
|
||||
SimpleValueType SimpleTy = INVALID_SIMPLE_VALUE_TYPE;
|
||||
|
||||
// A class to represent the number of elements in a vector
|
||||
//
|
||||
@ -270,7 +270,7 @@ namespace llvm {
|
||||
}
|
||||
};
|
||||
|
||||
constexpr MVT() : SimpleTy(INVALID_SIMPLE_VALUE_TYPE) {}
|
||||
constexpr MVT() = default;
|
||||
constexpr MVT(SimpleValueType SVT) : SimpleTy(SVT) {}
|
||||
|
||||
bool operator>(const MVT& S) const { return SimpleTy > S.SimpleTy; }
|
||||
@ -780,7 +780,6 @@ namespace llvm {
|
||||
return getSizeInBits() <= VT.getSizeInBits();
|
||||
}
|
||||
|
||||
|
||||
static MVT getFloatingPointVT(unsigned BitWidth) {
|
||||
switch (BitWidth) {
|
||||
default:
|
||||
@ -982,9 +981,12 @@ namespace llvm {
|
||||
/// A simple iterator over the MVT::SimpleValueType enum.
|
||||
struct mvt_iterator {
|
||||
SimpleValueType VT;
|
||||
|
||||
mvt_iterator(SimpleValueType VT) : VT(VT) {}
|
||||
|
||||
MVT operator*() const { return VT; }
|
||||
bool operator!=(const mvt_iterator &LHS) const { return VT != LHS.VT; }
|
||||
|
||||
mvt_iterator& operator++() {
|
||||
VT = (MVT::SimpleValueType)((int)VT + 1);
|
||||
assert((int)VT <= MVT::MAX_ALLOWED_VALUETYPE &&
|
||||
@ -992,8 +994,9 @@ namespace llvm {
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
/// A range of the MVT::SimpleValueType enum.
|
||||
typedef iterator_range<mvt_iterator> mvt_range;
|
||||
using mvt_range = iterator_range<mvt_iterator>;
|
||||
|
||||
public:
|
||||
/// SimpleValueType Iteration
|
||||
@ -1001,32 +1004,39 @@ namespace llvm {
|
||||
static mvt_range all_valuetypes() {
|
||||
return mvt_range(MVT::FIRST_VALUETYPE, MVT::LAST_VALUETYPE);
|
||||
}
|
||||
|
||||
static mvt_range integer_valuetypes() {
|
||||
return mvt_range(MVT::FIRST_INTEGER_VALUETYPE,
|
||||
(MVT::SimpleValueType)(MVT::LAST_INTEGER_VALUETYPE + 1));
|
||||
}
|
||||
|
||||
static mvt_range fp_valuetypes() {
|
||||
return mvt_range(MVT::FIRST_FP_VALUETYPE,
|
||||
(MVT::SimpleValueType)(MVT::LAST_FP_VALUETYPE + 1));
|
||||
}
|
||||
|
||||
static mvt_range vector_valuetypes() {
|
||||
return mvt_range(MVT::FIRST_VECTOR_VALUETYPE,
|
||||
(MVT::SimpleValueType)(MVT::LAST_VECTOR_VALUETYPE + 1));
|
||||
}
|
||||
|
||||
static mvt_range integer_vector_valuetypes() {
|
||||
return mvt_range(
|
||||
MVT::FIRST_INTEGER_VECTOR_VALUETYPE,
|
||||
(MVT::SimpleValueType)(MVT::LAST_INTEGER_VECTOR_VALUETYPE + 1));
|
||||
}
|
||||
|
||||
static mvt_range fp_vector_valuetypes() {
|
||||
return mvt_range(
|
||||
MVT::FIRST_FP_VECTOR_VALUETYPE,
|
||||
(MVT::SimpleValueType)(MVT::LAST_FP_VECTOR_VALUETYPE + 1));
|
||||
}
|
||||
|
||||
static mvt_range integer_scalable_vector_valuetypes() {
|
||||
return mvt_range(MVT::FIRST_INTEGER_SCALABLE_VALUETYPE,
|
||||
(MVT::SimpleValueType)(MVT::LAST_INTEGER_SCALABLE_VALUETYPE + 1));
|
||||
}
|
||||
|
||||
static mvt_range fp_scalable_vector_valuetypes() {
|
||||
return mvt_range(MVT::FIRST_FP_SCALABLE_VALUETYPE,
|
||||
(MVT::SimpleValueType)(MVT::LAST_FP_SCALABLE_VALUETYPE + 1));
|
||||
@ -1034,6 +1044,6 @@ namespace llvm {
|
||||
/// @}
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CODEGEN_MACHINEVALUETYPE_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- MacroFusion.h - Macro Fusion ------------------------===//
|
||||
//===- MacroFusion.h - Macro Fusion -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -12,19 +12,26 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_CODEGEN_MACROFUSION_H
|
||||
#define LLVM_CODEGEN_MACROFUSION_H
|
||||
|
||||
#include <functional>
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
#include "llvm/CodeGen/MachineScheduler.h"
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MachineInstr;
|
||||
class ScheduleDAGMutation;
|
||||
class TargetInstrInfo;
|
||||
class TargetSubtargetInfo;
|
||||
|
||||
/// \brief Check if the instr pair, FirstMI and SecondMI, should be fused
|
||||
/// together. Given SecondMI, when FirstMI is unspecified, then check if
|
||||
/// SecondMI may be part of a fused pair at all.
|
||||
typedef std::function<bool(const TargetInstrInfo &TII,
|
||||
const TargetSubtargetInfo &TSI,
|
||||
const MachineInstr *FirstMI,
|
||||
const MachineInstr &SecondMI)> ShouldSchedulePredTy;
|
||||
using ShouldSchedulePredTy = std::function<bool(const TargetInstrInfo &TII,
|
||||
const TargetSubtargetInfo &TSI,
|
||||
const MachineInstr *FirstMI,
|
||||
const MachineInstr &SecondMI)>;
|
||||
|
||||
/// \brief Create a DAG scheduling mutation to pair instructions back to back
|
||||
/// for instructions that benefit according to the target-specific
|
||||
@ -39,3 +46,5 @@ std::unique_ptr<ScheduleDAGMutation>
|
||||
createBranchMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent);
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_CODEGEN_MACROFUSION_H
|
||||
|
@ -94,7 +94,7 @@ class FixedStackPseudoSourceValue : public PseudoSourceValue {
|
||||
explicit FixedStackPseudoSourceValue(int FI)
|
||||
: PseudoSourceValue(FixedStack), FI(FI) {}
|
||||
|
||||
static inline bool classof(const PseudoSourceValue *V) {
|
||||
static bool classof(const PseudoSourceValue *V) {
|
||||
return V->kind() == FixedStack;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class GlobalValuePseudoSourceValue : public CallEntryPseudoSourceValue {
|
||||
public:
|
||||
GlobalValuePseudoSourceValue(const GlobalValue *GV);
|
||||
|
||||
static inline bool classof(const PseudoSourceValue *V) {
|
||||
static bool classof(const PseudoSourceValue *V) {
|
||||
return V->kind() == GlobalValueCallEntry;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ class ExternalSymbolPseudoSourceValue : public CallEntryPseudoSourceValue {
|
||||
public:
|
||||
ExternalSymbolPseudoSourceValue(const char *ES);
|
||||
|
||||
static inline bool classof(const PseudoSourceValue *V) {
|
||||
static bool classof(const PseudoSourceValue *V) {
|
||||
return V->kind() == ExternalSymbolCallEntry;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class BaseIndexOffset {
|
||||
int64_t &Off);
|
||||
|
||||
/// Parses tree in Ptr for base, index, offset addresses.
|
||||
static BaseIndexOffset match(SDValue Ptr);
|
||||
static BaseIndexOffset match(SDValue Ptr, const SelectionDAG &DAG);
|
||||
};
|
||||
} // namespace llvm
|
||||
|
||||
|
@ -1743,7 +1743,7 @@ class BuildVectorSDNode : public SDNode {
|
||||
|
||||
bool isConstant() const;
|
||||
|
||||
static inline bool classof(const SDNode *N) {
|
||||
static bool classof(const SDNode *N) {
|
||||
return N->getOpcode() == ISD::BUILD_VECTOR;
|
||||
}
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===-- TargetPassConfig.h - Code Generation pass options -------*- C++ -*-===//
|
||||
//===- TargetPassConfig.h - Code Generation pass options --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -16,19 +16,23 @@
|
||||
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CodeGen.h"
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class PassConfigImpl;
|
||||
class ScheduleDAGInstrs;
|
||||
class LLVMTargetMachine;
|
||||
struct MachineSchedContext;
|
||||
class PassConfigImpl;
|
||||
class ScheduleDAGInstrs;
|
||||
|
||||
// The old pass manager infrastructure is hidden in a legacy namespace now.
|
||||
namespace legacy {
|
||||
|
||||
class PassManagerBase;
|
||||
}
|
||||
|
||||
} // end namespace legacy
|
||||
|
||||
using legacy::PassManagerBase;
|
||||
|
||||
/// Discriminated union of Pass ID types.
|
||||
@ -50,10 +54,11 @@ class IdentifyingPassPtr {
|
||||
AnalysisID ID;
|
||||
Pass *P;
|
||||
};
|
||||
bool IsInstance;
|
||||
bool IsInstance = false;
|
||||
|
||||
public:
|
||||
IdentifyingPassPtr() : P(nullptr), IsInstance(false) {}
|
||||
IdentifyingPassPtr(AnalysisID IDPtr) : ID(IDPtr), IsInstance(false) {}
|
||||
IdentifyingPassPtr() : P(nullptr) {}
|
||||
IdentifyingPassPtr(AnalysisID IDPtr) : ID(IDPtr) {}
|
||||
IdentifyingPassPtr(Pass *InstancePtr) : P(InstancePtr), IsInstance(true) {}
|
||||
|
||||
bool isValid() const { return P; }
|
||||
@ -63,6 +68,7 @@ class IdentifyingPassPtr {
|
||||
assert(!IsInstance && "Not a Pass ID");
|
||||
return ID;
|
||||
}
|
||||
|
||||
Pass *getInstance() const {
|
||||
assert(IsInstance && "Not a Pass Instance");
|
||||
return P;
|
||||
@ -93,31 +99,30 @@ class TargetPassConfig : public ImmutablePass {
|
||||
static char PostRAMachineLICMID;
|
||||
|
||||
private:
|
||||
PassManagerBase *PM;
|
||||
PassManagerBase *PM = nullptr;
|
||||
AnalysisID StartBefore = nullptr;
|
||||
AnalysisID StartAfter = nullptr;
|
||||
AnalysisID StopBefore = nullptr;
|
||||
AnalysisID StopAfter = nullptr;
|
||||
bool Started;
|
||||
bool Stopped;
|
||||
bool AddingMachinePasses;
|
||||
bool Started = true;
|
||||
bool Stopped = false;
|
||||
bool AddingMachinePasses = false;
|
||||
|
||||
protected:
|
||||
LLVMTargetMachine *TM;
|
||||
PassConfigImpl *Impl; // Internal data structures
|
||||
bool Initialized; // Flagged after all passes are configured.
|
||||
PassConfigImpl *Impl = nullptr; // Internal data structures
|
||||
bool Initialized = false; // Flagged after all passes are configured.
|
||||
|
||||
// Target Pass Options
|
||||
// Targets provide a default setting, user flags override.
|
||||
//
|
||||
bool DisableVerify;
|
||||
bool DisableVerify = false;
|
||||
|
||||
/// Default setting for -enable-tail-merge on this target.
|
||||
bool EnableTailMerge;
|
||||
bool EnableTailMerge = true;
|
||||
|
||||
/// Require processing of functions such that callees are generated before
|
||||
/// callers.
|
||||
bool RequireCodeGenSCCOrder;
|
||||
bool RequireCodeGenSCCOrder = false;
|
||||
|
||||
/// Add the actual instruction selection passes. This does not include
|
||||
/// preparation passes on IR.
|
||||
@ -296,7 +301,6 @@ class TargetPassConfig : public ImmutablePass {
|
||||
|
||||
/// printAndVerify - Add a pass to dump then verify the machine function, if
|
||||
/// those steps are enabled.
|
||||
///
|
||||
void printAndVerify(const std::string &Banner);
|
||||
|
||||
/// Add a pass to print the machine function if printing is enabled.
|
||||
@ -430,4 +434,4 @@ class TargetPassConfig : public ImmutablePass {
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CODEGEN_TARGETPASSCONFIG_H
|
||||
|
@ -17,7 +17,10 @@
|
||||
#define LLVM_CODEGEN_VALUETYPES_H
|
||||
|
||||
#include "llvm/CodeGen/MachineValueType.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
@ -30,13 +33,13 @@ namespace llvm {
|
||||
/// can represent.
|
||||
struct EVT {
|
||||
private:
|
||||
MVT V;
|
||||
Type *LLVMTy;
|
||||
MVT V = MVT::INVALID_SIMPLE_VALUE_TYPE;
|
||||
Type *LLVMTy = nullptr;
|
||||
|
||||
public:
|
||||
constexpr EVT() : V(MVT::INVALID_SIMPLE_VALUE_TYPE), LLVMTy(nullptr) {}
|
||||
constexpr EVT(MVT::SimpleValueType SVT) : V(SVT), LLVMTy(nullptr) {}
|
||||
constexpr EVT(MVT S) : V(S), LLVMTy(nullptr) {}
|
||||
constexpr EVT() = default;
|
||||
constexpr EVT(MVT::SimpleValueType SVT) : V(SVT) {}
|
||||
constexpr EVT(MVT S) : V(S) {}
|
||||
|
||||
bool operator==(EVT VT) const {
|
||||
return !(*this != VT);
|
||||
@ -246,7 +249,6 @@ namespace llvm {
|
||||
return getSizeInBits() <= VT.getSizeInBits();
|
||||
}
|
||||
|
||||
|
||||
/// Return the SimpleValueType held in the specified simple EVT.
|
||||
MVT getSimpleVT() const {
|
||||
assert(isSimple() && "Expected a SimpleValueType!");
|
||||
@ -430,6 +432,6 @@ namespace llvm {
|
||||
unsigned getExtendedSizeInBits() const LLVM_READONLY;
|
||||
};
|
||||
|
||||
} // End llvm namespace
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_CODEGEN_VALUETYPES_H
|
||||
|
@ -25,7 +25,9 @@ class CVSymbolVisitor {
|
||||
CVSymbolVisitor(SymbolVisitorCallbacks &Callbacks);
|
||||
|
||||
Error visitSymbolRecord(CVSymbol &Record);
|
||||
Error visitSymbolRecord(CVSymbol &Record, uint32_t Offset);
|
||||
Error visitSymbolStream(const CVSymbolArray &Symbols);
|
||||
Error visitSymbolStream(const CVSymbolArray &Symbols, uint32_t InitialOffset);
|
||||
|
||||
private:
|
||||
SymbolVisitorCallbacks &Callbacks;
|
||||
|
@ -12,13 +12,19 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.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"
|
||||
#include "llvm/Support/BinaryStreamRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
namespace codeview {
|
||||
|
||||
class DebugStringTableSubsection;
|
||||
@ -28,24 +34,22 @@ struct FileChecksumEntry {
|
||||
FileChecksumKind Kind; // The type of checksum.
|
||||
ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
} // end namespace codeview
|
||||
|
||||
template <> struct VarStreamArrayExtractor<codeview::FileChecksumEntry> {
|
||||
public:
|
||||
typedef void ContextType;
|
||||
using ContextType = void;
|
||||
|
||||
Error operator()(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;
|
||||
using FileChecksumArray = VarStreamArray<codeview::FileChecksumEntry>;
|
||||
using Iterator = FileChecksumArray::Iterator;
|
||||
|
||||
public:
|
||||
DebugChecksumsSubsectionRef()
|
||||
@ -89,10 +93,12 @@ class DebugChecksumsSubsection final : public DebugSubsection {
|
||||
|
||||
DenseMap<uint32_t, uint32_t> OffsetMap;
|
||||
uint32_t SerializedSize = 0;
|
||||
llvm::BumpPtrAllocator Storage;
|
||||
BumpPtrAllocator Storage;
|
||||
std::vector<FileChecksumEntry> Checksums;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCHECKSUMSSUBSECTION_H
|
||||
|
@ -10,18 +10,21 @@
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/BinaryStreamReader.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
#include "llvm/Support/BinaryStreamRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
||||
class DebugCrossModuleExportsSubsectionRef final : public DebugSubsectionRef {
|
||||
typedef FixedStreamArray<CrossModuleExport> ReferenceArray;
|
||||
typedef ReferenceArray::Iterator Iterator;
|
||||
using ReferenceArray = FixedStreamArray<CrossModuleExport>;
|
||||
using Iterator = ReferenceArray::Iterator;
|
||||
|
||||
public:
|
||||
DebugCrossModuleExportsSubsectionRef()
|
||||
@ -58,7 +61,8 @@ class DebugCrossModuleExportsSubsection final : public DebugSubsection {
|
||||
private:
|
||||
std::map<uint32_t, uint32_t> Mappings;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSEXSUBSECTION_H
|
||||
|
@ -11,38 +11,43 @@
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H
|
||||
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/BinaryStreamReader.h"
|
||||
#include "llvm/Support/BinaryStreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
namespace codeview {
|
||||
|
||||
struct CrossModuleImportItem {
|
||||
const CrossModuleImport *Header = nullptr;
|
||||
llvm::FixedStreamArray<support::ulittle32_t> Imports;
|
||||
FixedStreamArray<support::ulittle32_t> Imports;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
} // end namespace codeview
|
||||
|
||||
template <> struct VarStreamArrayExtractor<codeview::CrossModuleImportItem> {
|
||||
public:
|
||||
typedef void ContextType;
|
||||
using ContextType = void;
|
||||
|
||||
Error operator()(BinaryStreamRef Stream, uint32_t &Len,
|
||||
codeview::CrossModuleImportItem &Item);
|
||||
};
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
||||
class DebugStringTableSubsection;
|
||||
|
||||
class DebugCrossModuleImportsSubsectionRef final : public DebugSubsectionRef {
|
||||
typedef VarStreamArray<CrossModuleImportItem> ReferenceArray;
|
||||
typedef ReferenceArray::Iterator Iterator;
|
||||
using ReferenceArray = VarStreamArray<CrossModuleImportItem>;
|
||||
using Iterator = ReferenceArray::Iterator;
|
||||
|
||||
public:
|
||||
DebugCrossModuleImportsSubsectionRef()
|
||||
@ -82,7 +87,9 @@ class DebugCrossModuleImportsSubsection final : public DebugSubsection {
|
||||
DebugStringTableSubsection &Strings;
|
||||
StringMap<std::vector<support::ulittle32_t>> Mappings;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGCROSSIMPSUBSECTION_H
|
||||
|
@ -7,19 +7,26 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_BUGINLINEELINESSUBSECTION_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_BUGINLINEELINESSUBSECTION_H
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
|
||||
#include "llvm/DebugInfo/CodeView/Line.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/BinaryStreamReader.h"
|
||||
#include "llvm/Support/BinaryStreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
namespace codeview {
|
||||
|
||||
class DebugInlineeLinesSubsectionRef;
|
||||
class DebugChecksumsSubsection;
|
||||
|
||||
enum class InlineeLinesSignature : uint32_t {
|
||||
@ -40,18 +47,21 @@ struct InlineeSourceLine {
|
||||
const InlineeSourceLineHeader *Header;
|
||||
FixedStreamArray<support::ulittle32_t> ExtraFiles;
|
||||
};
|
||||
}
|
||||
|
||||
} // end namespace codeview
|
||||
|
||||
template <> struct VarStreamArrayExtractor<codeview::InlineeSourceLine> {
|
||||
Error operator()(BinaryStreamRef Stream, uint32_t &Len,
|
||||
codeview::InlineeSourceLine &Item);
|
||||
|
||||
bool HasExtraFiles = false;
|
||||
};
|
||||
|
||||
namespace codeview {
|
||||
|
||||
class DebugInlineeLinesSubsectionRef final : public DebugSubsectionRef {
|
||||
typedef VarStreamArray<InlineeSourceLine> LinesArray;
|
||||
typedef LinesArray::Iterator Iterator;
|
||||
using LinesArray = VarStreamArray<InlineeSourceLine>;
|
||||
using Iterator = LinesArray::Iterator;
|
||||
|
||||
public:
|
||||
DebugInlineeLinesSubsectionRef();
|
||||
@ -99,13 +109,13 @@ class DebugInlineeLinesSubsection final : public DebugSubsection {
|
||||
|
||||
private:
|
||||
DebugChecksumsSubsection &Checksums;
|
||||
|
||||
bool HasExtraFiles = false;
|
||||
uint32_t ExtraFileCount = 0;
|
||||
|
||||
std::vector<Entry> Entries;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGINLINEELINESSUBSECTION_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- DebugLinesSubsection.h --------------------------------*- C++ -*-===//
|
||||
//===- DebugLinesSubsection.h -----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -7,14 +7,20 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGLINEFRAGMENT_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGLINEFRAGMENT_H
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.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/BinaryStreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
@ -72,8 +78,9 @@ class LineColumnExtractor {
|
||||
|
||||
class DebugLinesSubsectionRef final : public DebugSubsectionRef {
|
||||
friend class LineColumnExtractor;
|
||||
typedef VarStreamArray<LineColumnEntry, LineColumnExtractor> LineInfoArray;
|
||||
typedef LineInfoArray::Iterator Iterator;
|
||||
|
||||
using LineInfoArray = VarStreamArray<LineColumnEntry, LineColumnExtractor>;
|
||||
using Iterator = LineInfoArray::Iterator;
|
||||
|
||||
public:
|
||||
DebugLinesSubsectionRef();
|
||||
@ -130,14 +137,14 @@ class DebugLinesSubsection final : public DebugSubsection {
|
||||
|
||||
private:
|
||||
DebugChecksumsSubsection &Checksums;
|
||||
|
||||
uint32_t RelocOffset = 0;
|
||||
uint16_t RelocSegment = 0;
|
||||
uint32_t CodeSize = 0;
|
||||
LineFlags Flags = LF_None;
|
||||
std::vector<Block> Blocks;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGLINESSUBSECTION_H
|
||||
|
@ -12,17 +12,15 @@
|
||||
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
|
||||
#include "llvm/Support/BinaryStreamRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BinaryStreamReader;
|
||||
class BinaryStreamRef;
|
||||
class BinaryStreamWriter;
|
||||
|
||||
namespace codeview {
|
||||
|
||||
@ -83,7 +81,9 @@ class DebugStringTableSubsection : public DebugSubsection {
|
||||
StringMap<uint32_t> Strings;
|
||||
uint32_t StringSize = 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSTRINGTABLESUBSECTION_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- DebugSubsection.h ------------------------------------*- C++ -*-===//
|
||||
//===- DebugSubsectionRecord.h ----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -7,17 +7,22 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_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"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BinaryStreamWriter;
|
||||
|
||||
namespace codeview {
|
||||
|
||||
class DebugSubsection;
|
||||
@ -42,8 +47,8 @@ class DebugSubsectionRecord {
|
||||
BinaryStreamRef getRecordData() const;
|
||||
|
||||
private:
|
||||
CodeViewContainer Container;
|
||||
DebugSubsectionKind Kind;
|
||||
CodeViewContainer Container = CodeViewContainer::ObjectFile;
|
||||
DebugSubsectionKind Kind = DebugSubsectionKind::None;
|
||||
BinaryStreamRef Data;
|
||||
};
|
||||
|
||||
@ -71,7 +76,7 @@ class DebugSubsectionRecordBuilder {
|
||||
CodeViewContainer Container;
|
||||
};
|
||||
|
||||
} // namespace codeview
|
||||
} // end namespace codeview
|
||||
|
||||
template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
|
||||
Error operator()(BinaryStreamRef Stream, uint32_t &Length,
|
||||
@ -88,8 +93,11 @@ template <> struct VarStreamArrayExtractor<codeview::DebugSubsectionRecord> {
|
||||
};
|
||||
|
||||
namespace codeview {
|
||||
typedef VarStreamArray<DebugSubsectionRecord> DebugSubsectionArray;
|
||||
}
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTRECORD_H
|
||||
using DebugSubsectionArray = VarStreamArray<DebugSubsectionRecord>;
|
||||
|
||||
} // end namespace codeview
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSUBSECTIONRECORD_H
|
||||
|
@ -10,17 +10,23 @@
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugSubsection.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/BinaryStreamReader.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BinaryStreamReader;
|
||||
|
||||
namespace codeview {
|
||||
|
||||
class DebugSymbolRVASubsectionRef final : public DebugSubsectionRef {
|
||||
public:
|
||||
typedef FixedStreamArray<support::ulittle32_t> ArrayType;
|
||||
using ArrayType = FixedStreamArray<support::ulittle32_t>;
|
||||
|
||||
DebugSymbolRVASubsectionRef();
|
||||
|
||||
@ -53,7 +59,9 @@ class DebugSymbolRVASubsection final : public DebugSubsection {
|
||||
private:
|
||||
std::vector<support::ulittle32_t> RVAs;
|
||||
};
|
||||
} // namespace codeview
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_DEBUGSYMBOLRVASUBSECTION_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- EnumTables.h Enum to string conversion tables ------------*- C++ -*-===//
|
||||
//===- EnumTables.h - Enum to string conversion tables ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -14,11 +14,11 @@
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
||||
ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames();
|
||||
ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames();
|
||||
ArrayRef<EnumEntry<uint16_t>> getRegisterNames();
|
||||
@ -38,7 +38,8 @@ ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames();
|
||||
ArrayRef<EnumEntry<uint16_t>> getTrampolineNames();
|
||||
ArrayRef<EnumEntry<COFF::SectionCharacteristics>>
|
||||
getImageSectionCharacteristicNames();
|
||||
} // namespace codeview
|
||||
} // namespace llvm
|
||||
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
|
||||
|
@ -14,21 +14,27 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/Support/FormatAdapters.h"
|
||||
#include "llvm/Support/FormatProviders.h"
|
||||
#include "llvm/Support/FormatVariadic.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
namespace codeview {
|
||||
|
||||
namespace detail {
|
||||
class GuidAdapter final : public llvm::FormatAdapter<ArrayRef<uint8_t>> {
|
||||
|
||||
class GuidAdapter final : public FormatAdapter<ArrayRef<uint8_t>> {
|
||||
ArrayRef<uint8_t> Guid;
|
||||
|
||||
public:
|
||||
explicit GuidAdapter(ArrayRef<uint8_t> Guid);
|
||||
explicit GuidAdapter(StringRef Guid);
|
||||
void format(llvm::raw_ostream &Stream, StringRef Style);
|
||||
|
||||
void format(raw_ostream &Stream, StringRef Style) override ;
|
||||
};
|
||||
}
|
||||
|
||||
} // end namespace detail
|
||||
|
||||
inline detail::GuidAdapter fmt_guid(StringRef Item) {
|
||||
return detail::GuidAdapter(Item);
|
||||
@ -37,11 +43,12 @@ inline detail::GuidAdapter fmt_guid(StringRef Item) {
|
||||
inline detail::GuidAdapter fmt_guid(ArrayRef<uint8_t> Item) {
|
||||
return detail::GuidAdapter(Item);
|
||||
}
|
||||
}
|
||||
|
||||
} // end namespace codeview
|
||||
|
||||
template <> struct format_provider<codeview::TypeIndex> {
|
||||
public:
|
||||
static void format(const codeview::TypeIndex &V, llvm::raw_ostream &Stream,
|
||||
static void format(const codeview::TypeIndex &V, raw_ostream &Stream,
|
||||
StringRef Style) {
|
||||
if (V.isNoneType())
|
||||
Stream << "<no type>";
|
||||
@ -52,6 +59,7 @@ template <> struct format_provider<codeview::TypeIndex> {
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_FORMATTERS_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- LazyRandomTypeCollection.h ---------------------------- *- C++ --*-===//
|
||||
//===- LazyRandomTypeCollection.h -------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,12 +10,18 @@
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_LAZYRANDOMTYPECOLLECTION_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_LAZYRANDOMTYPECOLLECTION_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeCollection.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/StringSaver.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
@ -43,7 +49,8 @@ namespace codeview {
|
||||
/// into M chunks of roughly equal size, this yields a worst case lookup time
|
||||
/// of O(N/M) and an amortized time of O(1).
|
||||
class LazyRandomTypeCollection : public TypeCollection {
|
||||
typedef FixedStreamArray<TypeIndexOffset> PartialOffsetArray;
|
||||
using PartialOffsetArray = FixedStreamArray<TypeIndexOffset>;
|
||||
|
||||
struct CacheEntry {
|
||||
CVType Type;
|
||||
uint32_t Offset;
|
||||
|
@ -7,23 +7,18 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_STRINGS_AND_CHECKSUMS_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_STRINGS_AND_CHECKSUMS_H
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
||||
class DebugSubsectionRecord;
|
||||
class DebugChecksumsSubsectionRef;
|
||||
class DebugStringTableSubsectionRef;
|
||||
class DebugChecksumsSubsection;
|
||||
class DebugStringTableSubsection;
|
||||
|
||||
class StringsAndChecksumsRef {
|
||||
public:
|
||||
// If no subsections are known about initially, we find as much as we can.
|
||||
@ -83,8 +78,9 @@ class StringsAndChecksums {
|
||||
public:
|
||||
using StringsPtr = std::shared_ptr<DebugStringTableSubsection>;
|
||||
using ChecksumsPtr = std::shared_ptr<DebugChecksumsSubsection>;
|
||||
|
||||
// If no subsections are known about initially, we find as much as we can.
|
||||
StringsAndChecksums() {}
|
||||
StringsAndChecksums() = default;
|
||||
|
||||
void setStrings(const StringsPtr &SP) { Strings = SP; }
|
||||
void setChecksums(const ChecksumsPtr &CP) { Checksums = CP; }
|
||||
@ -100,7 +96,7 @@ class StringsAndChecksums {
|
||||
ChecksumsPtr Checksums;
|
||||
};
|
||||
|
||||
} // namespace codeview
|
||||
} // namespace llvm
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_STRINGSANDCHECKSUMS_H
|
||||
|
@ -51,6 +51,10 @@ class SymbolDeserializer : public SymbolVisitorCallbacks {
|
||||
CodeViewContainer Container)
|
||||
: Delegate(Delegate), Container(Container) {}
|
||||
|
||||
Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
|
||||
return visitSymbolBegin(Record);
|
||||
}
|
||||
|
||||
Error visitSymbolBegin(CVSymbol &Record) override {
|
||||
assert(!Mapping && "Already in a symbol mapping!");
|
||||
Mapping = llvm::make_unique<MappingInfo>(Record.content(), Container);
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
@ -35,6 +33,7 @@ class SymbolRecord {
|
||||
|
||||
public:
|
||||
SymbolRecordKind getKind() const { return Kind; }
|
||||
|
||||
SymbolRecordKind Kind;
|
||||
};
|
||||
|
||||
@ -153,6 +152,7 @@ class CallerSym : public SymbolRecord {
|
||||
: SymbolRecord(Kind), RecordOffset(RecordOffset) {}
|
||||
|
||||
std::vector<TypeIndex> Indices;
|
||||
|
||||
uint32_t RecordOffset;
|
||||
};
|
||||
|
||||
@ -165,8 +165,8 @@ struct BinaryAnnotationIterator {
|
||||
int32_t S1;
|
||||
};
|
||||
|
||||
BinaryAnnotationIterator(ArrayRef<uint8_t> Annotations) : Data(Annotations) {}
|
||||
BinaryAnnotationIterator() = default;
|
||||
BinaryAnnotationIterator(ArrayRef<uint8_t> Annotations) : Data(Annotations) {}
|
||||
BinaryAnnotationIterator(const BinaryAnnotationIterator &Other)
|
||||
: Data(Other.Data) {}
|
||||
|
||||
@ -342,9 +342,9 @@ class InlineSiteSym : public SymbolRecord {
|
||||
: SymbolRecord(SymbolRecordKind::InlineSiteSym),
|
||||
RecordOffset(RecordOffset) {}
|
||||
|
||||
llvm::iterator_range<BinaryAnnotationIterator> annotations() const {
|
||||
return llvm::make_range(BinaryAnnotationIterator(AnnotationData),
|
||||
BinaryAnnotationIterator());
|
||||
iterator_range<BinaryAnnotationIterator> annotations() const {
|
||||
return make_range(BinaryAnnotationIterator(AnnotationData),
|
||||
BinaryAnnotationIterator());
|
||||
}
|
||||
|
||||
uint32_t Parent;
|
||||
@ -479,6 +479,7 @@ class DefRangeRegisterSym : public SymbolRecord {
|
||||
ulittle16_t Register;
|
||||
ulittle16_t MayHaveNoName;
|
||||
};
|
||||
|
||||
explicit DefRangeRegisterSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
|
||||
DefRangeRegisterSym(uint32_t RecordOffset)
|
||||
: SymbolRecord(SymbolRecordKind::DefRangeRegisterSym),
|
||||
@ -501,6 +502,7 @@ class DefRangeSubfieldRegisterSym : public SymbolRecord {
|
||||
ulittle16_t MayHaveNoName;
|
||||
ulittle32_t OffsetInParent;
|
||||
};
|
||||
|
||||
explicit DefRangeSubfieldRegisterSym(SymbolRecordKind Kind)
|
||||
: SymbolRecord(Kind) {}
|
||||
DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
|
||||
@ -546,6 +548,7 @@ class DefRangeRegisterRelSym : public SymbolRecord {
|
||||
ulittle16_t Flags;
|
||||
little32_t BasePointerOffset;
|
||||
};
|
||||
|
||||
explicit DefRangeRegisterRelSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}
|
||||
explicit DefRangeRegisterRelSym(uint32_t RecordOffset)
|
||||
: SymbolRecord(SymbolRecordKind::DefRangeRegisterRelSym),
|
||||
@ -935,8 +938,8 @@ class ThreadLocalDataSym : public SymbolRecord {
|
||||
uint32_t RecordOffset;
|
||||
};
|
||||
|
||||
typedef CVRecord<SymbolKind> CVSymbol;
|
||||
typedef VarStreamArray<CVSymbol> CVSymbolArray;
|
||||
using CVSymbol = CVRecord<SymbolKind>;
|
||||
using CVSymbolArray = VarStreamArray<CVSymbol>;
|
||||
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- symbolSerializer.h ---------------------------------------*- C++ -*-===//
|
||||
//===- SymbolSerializer.h ---------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,21 +10,20 @@
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecordMapping.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolVisitorCallbacks.h"
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/BinaryByteStream.h"
|
||||
#include "llvm/Support/BinaryStreamWriter.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
class BinaryStreamWriter;
|
||||
namespace codeview {
|
||||
|
||||
class SymbolSerializer : public SymbolVisitorCallbacks {
|
||||
@ -45,6 +44,8 @@ class SymbolSerializer : public SymbolVisitorCallbacks {
|
||||
}
|
||||
|
||||
public:
|
||||
SymbolSerializer(BumpPtrAllocator &Storage, CodeViewContainer Container);
|
||||
|
||||
template <typename SymType>
|
||||
static CVSymbol writeOneSymbol(SymType &Sym, BumpPtrAllocator &Storage,
|
||||
CodeViewContainer Container) {
|
||||
@ -57,13 +58,11 @@ class SymbolSerializer : public SymbolVisitorCallbacks {
|
||||
return Result;
|
||||
}
|
||||
|
||||
SymbolSerializer(BumpPtrAllocator &Storage, CodeViewContainer Container);
|
||||
|
||||
virtual Error visitSymbolBegin(CVSymbol &Record) override;
|
||||
virtual Error visitSymbolEnd(CVSymbol &Record) override;
|
||||
Error visitSymbolBegin(CVSymbol &Record) override;
|
||||
Error visitSymbolEnd(CVSymbol &Record) override;
|
||||
|
||||
#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
|
||||
virtual Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
|
||||
Error visitKnownRecord(CVSymbol &CVR, Name &Record) override { \
|
||||
return visitKnownRecordImpl(CVR, Record); \
|
||||
}
|
||||
#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
|
||||
@ -75,7 +74,8 @@ class SymbolSerializer : public SymbolVisitorCallbacks {
|
||||
return Mapping.visitKnownRecord(CVR, Record);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
|
||||
|
@ -30,6 +30,14 @@ class SymbolVisitorCallbackPipeline : public SymbolVisitorCallbacks {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) override {
|
||||
for (auto Visitor : Pipeline) {
|
||||
if (auto EC = Visitor->visitSymbolBegin(Record, Offset))
|
||||
return EC;
|
||||
}
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error visitSymbolBegin(CVSymbol &Record) override {
|
||||
for (auto Visitor : Pipeline) {
|
||||
if (auto EC = Visitor->visitSymbolBegin(Record))
|
||||
|
@ -29,8 +29,10 @@ class SymbolVisitorCallbacks {
|
||||
|
||||
/// Paired begin/end actions for all symbols. Receives all record data,
|
||||
/// including the fixed-length record prefix. visitSymbolBegin() should
|
||||
/// return
|
||||
/// the type of the Symbol, or an error if it cannot be determined.
|
||||
/// return the type of the Symbol, or an error if it cannot be determined.
|
||||
virtual Error visitSymbolBegin(CVSymbol &Record, uint32_t Offset) {
|
||||
return Error::success();
|
||||
}
|
||||
virtual Error visitSymbolBegin(CVSymbol &Record) { return Error::success(); }
|
||||
virtual Error visitSymbolEnd(CVSymbol &Record) { return Error::success(); }
|
||||
|
||||
|
@ -28,6 +28,8 @@ void discoverTypeIndices(ArrayRef<uint8_t> RecordData,
|
||||
SmallVectorImpl<TiReference> &Refs);
|
||||
void discoverTypeIndices(const CVType &Type,
|
||||
SmallVectorImpl<TiReference> &Refs);
|
||||
void discoverTypeIndices(const CVType &Type,
|
||||
SmallVectorImpl<TypeIndex> &Indices);
|
||||
|
||||
/// Discover type indices in symbol records. Returns false if this is an unknown
|
||||
/// record.
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
@ -25,31 +26,30 @@
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BinaryStreamReader;
|
||||
|
||||
namespace codeview {
|
||||
|
||||
using support::little32_t;
|
||||
using support::ulittle16_t;
|
||||
using support::ulittle32_t;
|
||||
|
||||
typedef CVRecord<TypeLeafKind> CVType;
|
||||
typedef RemappedRecord<TypeLeafKind> RemappedType;
|
||||
using CVType = CVRecord<TypeLeafKind>;
|
||||
using RemappedType = RemappedRecord<TypeLeafKind>;
|
||||
|
||||
struct CVMemberRecord {
|
||||
TypeLeafKind Kind;
|
||||
ArrayRef<uint8_t> Data;
|
||||
};
|
||||
typedef VarStreamArray<CVType> CVTypeArray;
|
||||
typedef iterator_range<CVTypeArray::Iterator> CVTypeRange;
|
||||
using CVTypeArray = VarStreamArray<CVType>;
|
||||
using CVTypeRange = iterator_range<CVTypeArray::Iterator>;
|
||||
|
||||
/// Equvalent to CV_fldattr_t in cvinfo.h.
|
||||
struct MemberAttributes {
|
||||
uint16_t Attrs = 0;
|
||||
|
||||
enum {
|
||||
MethodKindShift = 2,
|
||||
};
|
||||
|
||||
MemberAttributes() = default;
|
||||
|
||||
explicit MemberAttributes(MemberAccess Access)
|
||||
@ -226,6 +226,7 @@ class MemberFuncIdRecord : public TypeRecord {
|
||||
TypeIndex getClassType() const { return ClassType; }
|
||||
TypeIndex getFunctionType() const { return FunctionType; }
|
||||
StringRef getName() const { return Name; }
|
||||
|
||||
TypeIndex ClassType;
|
||||
TypeIndex FunctionType;
|
||||
StringRef Name;
|
||||
@ -330,7 +331,6 @@ class PointerRecord : public TypeRecord {
|
||||
|
||||
TypeIndex ReferentType;
|
||||
uint32_t Attrs;
|
||||
|
||||
Optional<MemberPointerInfo> MemberInfo;
|
||||
|
||||
private:
|
||||
@ -490,6 +490,7 @@ class EnumRecord : public TagRecord {
|
||||
UnderlyingType(UnderlyingType) {}
|
||||
|
||||
TypeIndex getUnderlyingType() const { return UnderlyingType; }
|
||||
|
||||
TypeIndex UnderlyingType;
|
||||
};
|
||||
|
||||
@ -505,6 +506,7 @@ class BitFieldRecord : public TypeRecord {
|
||||
TypeIndex getType() const { return Type; }
|
||||
uint8_t getBitOffset() const { return BitOffset; }
|
||||
uint8_t getBitSize() const { return BitSize; }
|
||||
|
||||
TypeIndex Type;
|
||||
uint8_t BitSize;
|
||||
uint8_t BitOffset;
|
||||
@ -527,6 +529,7 @@ class VFTableShapeRecord : public TypeRecord {
|
||||
}
|
||||
|
||||
uint32_t getEntryCount() const { return getSlots().size(); }
|
||||
|
||||
ArrayRef<VFTableSlotKind> SlotsRef;
|
||||
std::vector<VFTableSlotKind> Slots;
|
||||
};
|
||||
@ -541,9 +544,7 @@ class TypeServer2Record : public TypeRecord {
|
||||
Name(Name) {}
|
||||
|
||||
StringRef getGuid() const { return Guid; }
|
||||
|
||||
uint32_t getAge() const { return Age; }
|
||||
|
||||
StringRef getName() const { return Name; }
|
||||
|
||||
StringRef Guid;
|
||||
@ -560,8 +561,8 @@ class StringIdRecord : public TypeRecord {
|
||||
: TypeRecord(TypeRecordKind::StringId), Id(Id), String(String) {}
|
||||
|
||||
TypeIndex getId() const { return Id; }
|
||||
|
||||
StringRef getString() const { return String; }
|
||||
|
||||
TypeIndex Id;
|
||||
StringRef String;
|
||||
};
|
||||
@ -576,9 +577,7 @@ class FuncIdRecord : public TypeRecord {
|
||||
FunctionType(FunctionType), Name(Name) {}
|
||||
|
||||
TypeIndex getParentScope() const { return ParentScope; }
|
||||
|
||||
TypeIndex getFunctionType() const { return FunctionType; }
|
||||
|
||||
StringRef getName() const { return Name; }
|
||||
|
||||
TypeIndex ParentScope;
|
||||
@ -635,6 +634,7 @@ class BuildInfoRecord : public TypeRecord {
|
||||
ArgIndices(ArgIndices.begin(), ArgIndices.end()) {}
|
||||
|
||||
ArrayRef<TypeIndex> getArgs() const { return ArgIndices; }
|
||||
|
||||
SmallVector<TypeIndex, 4> ArgIndices;
|
||||
};
|
||||
|
||||
@ -656,6 +656,7 @@ class VFTableRecord : public TypeRecord {
|
||||
TypeIndex getOverriddenVTable() const { return OverriddenVFTable; }
|
||||
uint32_t getVFPtrOffset() const { return VFPtrOffset; }
|
||||
StringRef getName() const { return makeArrayRef(MethodNames).front(); }
|
||||
|
||||
ArrayRef<StringRef> getMethodNames() const {
|
||||
return makeArrayRef(MethodNames).drop_front();
|
||||
}
|
||||
@ -707,6 +708,7 @@ class MethodOverloadListRecord : public TypeRecord {
|
||||
: TypeRecord(TypeRecordKind::MethodOverloadList), Methods(Methods) {}
|
||||
|
||||
ArrayRef<OneMethodRecord> getMethods() const { return Methods; }
|
||||
|
||||
std::vector<OneMethodRecord> Methods;
|
||||
};
|
||||
|
||||
@ -723,6 +725,7 @@ class OverloadedMethodRecord : public TypeRecord {
|
||||
uint16_t getNumOverloads() const { return NumOverloads; }
|
||||
TypeIndex getMethodList() const { return MethodList; }
|
||||
StringRef getName() const { return Name; }
|
||||
|
||||
uint16_t NumOverloads;
|
||||
TypeIndex MethodList;
|
||||
StringRef Name;
|
||||
@ -874,7 +877,6 @@ class ListContinuationRecord : public TypeRecord {
|
||||
};
|
||||
|
||||
} // end namespace codeview
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPERECORD_H
|
||||
|
@ -10,19 +10,25 @@
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
|
||||
#include "llvm/Support/BinaryByteStream.h"
|
||||
#include "llvm/Support/BinaryStreamWriter.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/BinaryByteStream.h"
|
||||
#include "llvm/Support/BinaryStreamWriter.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
namespace codeview {
|
||||
|
||||
class TypeHasher;
|
||||
@ -46,7 +52,7 @@ class TypeSerializer : public TypeVisitorCallbacks {
|
||||
}
|
||||
};
|
||||
|
||||
typedef SmallVector<MutableArrayRef<uint8_t>, 2> MutableRecordList;
|
||||
using MutableRecordList = SmallVector<MutableArrayRef<uint8_t>, 2>;
|
||||
|
||||
static constexpr uint8_t ContinuationLength = 8;
|
||||
BumpPtrAllocator &RecordStorage;
|
||||
@ -82,7 +88,7 @@ class TypeSerializer : public TypeVisitorCallbacks {
|
||||
|
||||
public:
|
||||
explicit TypeSerializer(BumpPtrAllocator &Storage, bool Hash = true);
|
||||
~TypeSerializer();
|
||||
~TypeSerializer() override;
|
||||
|
||||
void reset();
|
||||
|
||||
@ -146,7 +152,8 @@ class TypeSerializer : public TypeVisitorCallbacks {
|
||||
return Error::success();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERIALIZER_H
|
||||
|
@ -10,16 +10,17 @@
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
||||
class TypeServer2Record;
|
||||
class TypeVisitorCallbacks;
|
||||
|
||||
class TypeServerHandler {
|
||||
public:
|
||||
virtual ~TypeServerHandler() {}
|
||||
virtual ~TypeServerHandler() = default;
|
||||
|
||||
/// Handle a TypeServer record. If the implementation returns true
|
||||
/// the record will not be processed by the top-level visitor. If
|
||||
@ -30,7 +31,8 @@ class TypeServerHandler {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace codeview
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_TYPESERVERHANDLER_H
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
@ -41,20 +41,31 @@ class DWARFAcceleratorTable {
|
||||
|
||||
struct Header Hdr;
|
||||
struct HeaderData HdrData;
|
||||
DataExtractor AccelSection;
|
||||
DWARFDataExtractor AccelSection;
|
||||
DataExtractor StringSection;
|
||||
const RelocAddrMap& Relocs;
|
||||
|
||||
public:
|
||||
DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection,
|
||||
const RelocAddrMap &Relocs)
|
||||
: AccelSection(AccelSection), StringSection(StringSection), Relocs(Relocs) {}
|
||||
DWARFAcceleratorTable(const DWARFDataExtractor &AccelSection,
|
||||
DataExtractor StringSection)
|
||||
: AccelSection(AccelSection), StringSection(StringSection) {}
|
||||
|
||||
bool extract();
|
||||
uint32_t getNumBuckets();
|
||||
uint32_t getNumHashes();
|
||||
uint32_t getSizeHdr();
|
||||
uint32_t getHeaderDataLength();
|
||||
ArrayRef<std::pair<HeaderData::AtomType, HeaderData::Form>> getAtomsDesc();
|
||||
bool validateForms();
|
||||
|
||||
/// Return information related to the DWARF DIE we're looking for when
|
||||
/// performing a lookup by name.
|
||||
///
|
||||
/// \param HashDataOffset an offset into the hash data table
|
||||
/// \returns DIEOffset the offset into the .debug_info section for the DIE
|
||||
/// related to the input hash data offset. Currently this function returns
|
||||
/// only the DIEOffset but it can be modified to return more data regarding
|
||||
/// the DIE
|
||||
uint32_t readAtoms(uint32_t &HashDataOffset);
|
||||
void dump(raw_ostream &OS) const;
|
||||
};
|
||||
|
||||
|
@ -20,8 +20,8 @@ class DWARFCompileUnit : public DWARFUnit {
|
||||
DWARFCompileUnit(DWARFContext &Context, const DWARFSection &Section,
|
||||
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
|
||||
StringRef SS, const DWARFSection &SOS,
|
||||
const DWARFSection *AOS, StringRef LS, bool LE, bool IsDWO,
|
||||
const DWARFUnitSectionBase &UnitSection,
|
||||
const DWARFSection *AOS, const DWARFSection &LS, bool LE,
|
||||
bool IsDWO, const DWARFUnitSectionBase &UnitSection,
|
||||
const DWARFUnitIndex::Entry *Entry)
|
||||
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
|
||||
UnitSection, Entry) {}
|
||||
|
@ -45,12 +45,6 @@ class DataExtractor;
|
||||
class MemoryBuffer;
|
||||
class raw_ostream;
|
||||
|
||||
/// Reads a value from data extractor and applies a relocation to the result if
|
||||
/// one exists for the given offset.
|
||||
uint64_t getRelocatedValue(const DataExtractor &Data, uint32_t Size,
|
||||
uint32_t *Off, const RelocAddrMap *Relocs,
|
||||
uint64_t *SecNdx = nullptr);
|
||||
|
||||
/// DWARFContext
|
||||
/// This data structure is the top level entity that deals with dwarf debug
|
||||
/// information parsing. The actual data is supplied through pure virtual
|
||||
@ -289,6 +283,11 @@ class DWARFContext : public DIContext {
|
||||
DWARFCompileUnit *getCompileUnitForAddress(uint64_t Address);
|
||||
};
|
||||
|
||||
/// Used as a return value for a error callback passed to DWARF context.
|
||||
/// Callback should return Halt if client application wants to stop
|
||||
/// object parsing, or should return Continue otherwise.
|
||||
enum class ErrorPolicy { Halt, Continue };
|
||||
|
||||
/// DWARFContextInMemory is the simplest possible implementation of a
|
||||
/// DWARFContext. It assumes all content is available in memory and stores
|
||||
/// pointers to it.
|
||||
@ -346,9 +345,14 @@ class DWARFContextInMemory : public DWARFContext {
|
||||
Error maybeDecompress(const object::SectionRef &Sec, StringRef Name,
|
||||
StringRef &Data);
|
||||
|
||||
/// Function used to handle default error reporting policy. Prints a error
|
||||
/// message and returns Continue, so DWARF context ignores the error.
|
||||
static ErrorPolicy defaultErrorHandler(Error E);
|
||||
|
||||
public:
|
||||
DWARFContextInMemory(const object::ObjectFile &Obj,
|
||||
const LoadedObjectInfo *L = nullptr);
|
||||
DWARFContextInMemory(
|
||||
const object::ObjectFile &Obj, const LoadedObjectInfo *L = nullptr,
|
||||
function_ref<ErrorPolicy(Error)> HandleError = defaultErrorHandler);
|
||||
|
||||
DWARFContextInMemory(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
|
||||
uint8_t AddrSize,
|
||||
|
48
include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
Normal file
48
include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
Normal file
@ -0,0 +1,48 @@
|
||||
//===- DWARFDataExtractor.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_DWARFDATAEXTRACTOR_H
|
||||
#define LLVM_DEBUGINFO_DWARFDATAEXTRACTOR_H
|
||||
|
||||
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// A DataExtractor (typically for an in-memory copy of an object-file section)
|
||||
/// plus a relocation map for that section, if there is one.
|
||||
class DWARFDataExtractor : public DataExtractor {
|
||||
const RelocAddrMap *RelocMap = nullptr;
|
||||
public:
|
||||
/// Constructor for the normal case of extracting data from a DWARF section.
|
||||
/// The DWARFSection's lifetime must be at least as long as the extractor's.
|
||||
DWARFDataExtractor(const DWARFSection &Section, bool IsLittleEndian,
|
||||
uint8_t AddressSize)
|
||||
: DataExtractor(Section.Data, IsLittleEndian, AddressSize),
|
||||
RelocMap(&Section.Relocs) {}
|
||||
|
||||
/// Constructor for cases when there are no relocations.
|
||||
DWARFDataExtractor(StringRef Data, bool IsLittleEndian, uint8_t AddressSize)
|
||||
: DataExtractor(Data, IsLittleEndian, AddressSize) {}
|
||||
|
||||
/// Extracts a value and applies a relocation to the result if
|
||||
/// one exists for the given offset.
|
||||
uint64_t getRelocatedValue(uint32_t Size, uint32_t *Off,
|
||||
uint64_t *SectionIndex = nullptr) const;
|
||||
|
||||
/// Extracts an address-sized value and applies a relocation to the result if
|
||||
/// one exists for the given offset.
|
||||
uint64_t getRelocatedAddress(uint32_t *Off, uint64_t *SecIx = nullptr) const {
|
||||
return getRelocatedValue(getAddressSize(), Off, SecIx);
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_DWARFDATAEXTRACTOR_H
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
@ -40,8 +41,7 @@ class DWARFDebugInfoEntry {
|
||||
|
||||
/// High performance extraction should use this call.
|
||||
bool extractFast(const DWARFUnit &U, uint32_t *OffsetPtr,
|
||||
const DataExtractor &DebugInfoData,
|
||||
uint32_t UEndOffset,
|
||||
const DWARFDataExtractor &DebugInfoData, uint32_t UEndOffset,
|
||||
uint32_t Depth);
|
||||
|
||||
uint32_t getOffset() const { return Offset; }
|
||||
|
@ -12,9 +12,9 @@
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/DIContext.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -26,9 +26,6 @@ class raw_ostream;
|
||||
|
||||
class DWARFDebugLine {
|
||||
public:
|
||||
DWARFDebugLine(const RelocAddrMap *LineInfoRelocMap)
|
||||
: RelocMap(LineInfoRelocMap) {}
|
||||
|
||||
struct FileNameEntry {
|
||||
FileNameEntry() = default;
|
||||
|
||||
@ -98,7 +95,7 @@ class DWARFDebugLine {
|
||||
|
||||
void clear();
|
||||
void dump(raw_ostream &OS) const;
|
||||
bool parse(DataExtractor DebugLineData, uint32_t *OffsetPtr);
|
||||
bool parse(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr);
|
||||
};
|
||||
|
||||
/// Standard .debug_line state machine structure.
|
||||
@ -220,8 +217,7 @@ class DWARFDebugLine {
|
||||
void clear();
|
||||
|
||||
/// Parse prologue and all rows.
|
||||
bool parse(DataExtractor DebugLineData, const RelocAddrMap *RMap,
|
||||
uint32_t *OffsetPtr);
|
||||
bool parse(const DWARFDataExtractor &DebugLineData, uint32_t *OffsetPtr);
|
||||
|
||||
using RowVector = std::vector<Row>;
|
||||
using RowIter = RowVector::const_iterator;
|
||||
@ -238,7 +234,7 @@ class DWARFDebugLine {
|
||||
};
|
||||
|
||||
const LineTable *getLineTable(uint32_t Offset) const;
|
||||
const LineTable *getOrParseLineTable(DataExtractor DebugLineData,
|
||||
const LineTable *getOrParseLineTable(const DWARFDataExtractor &DebugLineData,
|
||||
uint32_t Offset);
|
||||
|
||||
private:
|
||||
@ -261,7 +257,6 @@ class DWARFDebugLine {
|
||||
using LineTableIter = LineTableMapTy::iterator;
|
||||
using LineTableConstIter = LineTableMapTy::const_iterator;
|
||||
|
||||
const RelocAddrMap *RelocMap;
|
||||
LineTableMapTy LineTableMap;
|
||||
};
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
|
||||
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
@ -45,18 +45,13 @@ class DWARFDebugLoc {
|
||||
/// the locations in which the variable is stored.
|
||||
LocationLists Locations;
|
||||
|
||||
/// A map used to resolve binary relocations.
|
||||
const RelocAddrMap &RelocMap;
|
||||
|
||||
public:
|
||||
DWARFDebugLoc(const RelocAddrMap &LocRelocMap) : RelocMap(LocRelocMap) {}
|
||||
|
||||
/// Print the location lists found within the debug_loc section.
|
||||
void dump(raw_ostream &OS) const;
|
||||
|
||||
/// Parse the debug_loc section accessible via the 'data' parameter using the
|
||||
/// specified address size to interpret the address ranges.
|
||||
void parse(DataExtractor data, unsigned AddressSize);
|
||||
/// address size also given in 'data' to interpret the address ranges.
|
||||
void parse(const DWARFDataExtractor &data);
|
||||
};
|
||||
|
||||
class DWARFDebugLocDWO {
|
||||
|
@ -10,8 +10,8 @@
|
||||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
|
||||
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
@ -79,7 +79,7 @@ class DWARFDebugRangeList {
|
||||
|
||||
void clear();
|
||||
void dump(raw_ostream &OS) const;
|
||||
bool extract(DataExtractor data, uint32_t *offset_ptr, const RelocAddrMap& Relocs);
|
||||
bool extract(const DWARFDataExtractor &data, uint32_t *offset_ptr);
|
||||
const std::vector<RangeListEntry> &getEntries() { return Entries; }
|
||||
|
||||
/// getAbsoluteRanges - Returns absolute address ranges defined by this range
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
@ -105,14 +105,13 @@ class DWARFFormValue {
|
||||
|
||||
/// Extracts a value in \p Data at offset \p *OffsetPtr.
|
||||
///
|
||||
/// The passed DWARFUnit is allowed to be nullptr, in which
|
||||
/// case no relocation processing will be performed and some
|
||||
/// The passed DWARFUnit is allowed to be nullptr, in which case some
|
||||
/// kind of forms that depend on Unit information are disallowed.
|
||||
/// \param Data The DataExtractor to use.
|
||||
/// \param OffsetPtr The offset within DataExtractor where the data starts.
|
||||
/// \param Data The DWARFDataExtractor to use.
|
||||
/// \param OffsetPtr The offset within \p Data where the data starts.
|
||||
/// \param U The optional DWARFUnit supplying information for some forms.
|
||||
/// \returns whether the extraction succeeded.
|
||||
bool extractValue(const DataExtractor &Data, uint32_t *OffsetPtr,
|
||||
bool extractValue(const DWARFDataExtractor &Data, uint32_t *OffsetPtr,
|
||||
const DWARFUnit *U);
|
||||
|
||||
bool isInlinedCStr() const {
|
||||
|
@ -32,7 +32,7 @@ class DWARFTypeUnit : public DWARFUnit {
|
||||
DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section,
|
||||
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
|
||||
StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
|
||||
StringRef LS, bool LE, bool IsDWO,
|
||||
const DWARFSection &LS, bool LE, bool IsDWO,
|
||||
const DWARFUnitSectionBase &UnitSection,
|
||||
const DWARFUnitIndex::Entry *Entry)
|
||||
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LS, LE, IsDWO,
|
||||
|
@ -58,7 +58,7 @@ class DWARFUnitSectionBase {
|
||||
virtual void parseImpl(DWARFContext &Context, const DWARFSection &Section,
|
||||
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
|
||||
StringRef SS, const DWARFSection &SOS,
|
||||
const DWARFSection *AOS, StringRef LS,
|
||||
const DWARFSection *AOS, const DWARFSection &LS,
|
||||
bool isLittleEndian, bool isDWO) = 0;
|
||||
};
|
||||
|
||||
@ -91,7 +91,7 @@ class DWARFUnitSection final : public SmallVector<std::unique_ptr<UnitType>, 1>,
|
||||
void parseImpl(DWARFContext &Context, const DWARFSection &Section,
|
||||
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
|
||||
StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS,
|
||||
StringRef LS, bool LE, bool IsDWO) override {
|
||||
const DWARFSection &LS, bool LE, bool IsDWO) override {
|
||||
if (Parsed)
|
||||
return;
|
||||
const auto &Index = getDWARFUnitIndex(Context, UnitType::Section);
|
||||
@ -118,7 +118,7 @@ class DWARFUnit {
|
||||
const DWARFDebugAbbrev *Abbrev;
|
||||
const DWARFSection *RangeSection;
|
||||
uint32_t RangeSectionBase;
|
||||
StringRef LineSection;
|
||||
const DWARFSection &LineSection;
|
||||
StringRef StringSection;
|
||||
const DWARFSection &StringOffsetSection;
|
||||
uint64_t StringOffsetSectionBase = 0;
|
||||
@ -166,15 +166,16 @@ class DWARFUnit {
|
||||
public:
|
||||
DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
|
||||
const DWARFDebugAbbrev *DA, const DWARFSection *RS, StringRef SS,
|
||||
const DWARFSection &SOS, const DWARFSection *AOS, StringRef LS,
|
||||
bool LE, bool IsDWO, const DWARFUnitSectionBase &UnitSection,
|
||||
const DWARFSection &SOS, const DWARFSection *AOS,
|
||||
const DWARFSection &LS, bool LE, bool IsDWO,
|
||||
const DWARFUnitSectionBase &UnitSection,
|
||||
const DWARFUnitIndex::Entry *IndexEntry = nullptr);
|
||||
|
||||
virtual ~DWARFUnit();
|
||||
|
||||
DWARFContext& getContext() const { return Context; }
|
||||
|
||||
StringRef getLineSection() const { return LineSection; }
|
||||
const DWARFSection &getLineSection() const { return LineSection; }
|
||||
StringRef getStringSection() const { return StringSection; }
|
||||
const DWARFSection &getStringOffsetSection() const {
|
||||
return StringOffsetSection;
|
||||
@ -194,13 +195,11 @@ class DWARFUnit {
|
||||
}
|
||||
|
||||
bool getAddrOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
|
||||
// FIXME: Result should be uint64_t in DWARF64.
|
||||
bool getStringOffsetSectionItem(uint32_t Index, uint64_t &Result) const;
|
||||
uint64_t getStringOffsetSectionRelocation(uint32_t Index) const;
|
||||
|
||||
DataExtractor getDebugInfoExtractor() const {
|
||||
return DataExtractor(InfoSection.Data, isLittleEndian,
|
||||
getAddressByteSize());
|
||||
DWARFDataExtractor getDebugInfoExtractor() const {
|
||||
return DWARFDataExtractor(InfoSection, isLittleEndian,
|
||||
getAddressByteSize());
|
||||
}
|
||||
|
||||
DataExtractor getStringExtractor() const {
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- IPDBDataStream.h - base interface for child enumerator -*- C++ ---*-===//
|
||||
//===- IPDBDataStream.h - base interface for child enumerator ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,9 +10,10 @@
|
||||
#ifndef LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
|
||||
#define LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
|
||||
|
||||
#include "PDBTypes.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
@ -22,18 +23,19 @@ namespace pdb {
|
||||
/// stream type.
|
||||
class IPDBDataStream {
|
||||
public:
|
||||
typedef llvm::SmallVector<uint8_t, 32> RecordType;
|
||||
using RecordType = SmallVector<uint8_t, 32>;
|
||||
|
||||
virtual ~IPDBDataStream();
|
||||
|
||||
virtual uint32_t getRecordCount() const = 0;
|
||||
virtual std::string getName() const = 0;
|
||||
virtual llvm::Optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
|
||||
virtual Optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
|
||||
virtual bool getNext(RecordType &Record) = 0;
|
||||
virtual void reset() = 0;
|
||||
virtual IPDBDataStream *clone() const = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
|
||||
|
@ -18,8 +18,8 @@ namespace pdb {
|
||||
|
||||
template <typename ChildType> class IPDBEnumChildren {
|
||||
public:
|
||||
typedef std::unique_ptr<ChildType> ChildTypePtr;
|
||||
typedef IPDBEnumChildren<ChildType> MyType;
|
||||
using ChildTypePtr = std::unique_ptr<ChildType>;
|
||||
using MyType = IPDBEnumChildren<ChildType>;
|
||||
|
||||
virtual ~IPDBEnumChildren() = default;
|
||||
|
||||
|
@ -7,22 +7,23 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
|
||||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/BinaryStreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {}
|
||||
namespace pdb {
|
||||
|
||||
class DbiModuleList;
|
||||
@ -31,9 +32,9 @@ struct FileInfoSubstreamHeader;
|
||||
class DbiModuleSourceFilesIterator
|
||||
: public iterator_facade_base<DbiModuleSourceFilesIterator,
|
||||
std::random_access_iterator_tag, StringRef> {
|
||||
typedef iterator_facade_base<DbiModuleSourceFilesIterator,
|
||||
std::random_access_iterator_tag, StringRef>
|
||||
BaseType;
|
||||
using BaseType =
|
||||
iterator_facade_base<DbiModuleSourceFilesIterator,
|
||||
std::random_access_iterator_tag, StringRef>;
|
||||
|
||||
public:
|
||||
DbiModuleSourceFilesIterator(const DbiModuleList &Modules, uint32_t Modi,
|
||||
@ -110,7 +111,8 @@ class DbiModuleList {
|
||||
BinaryStreamRef FileInfoSubstream;
|
||||
BinaryStreamRef NamesBuffer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_RAW_DBIMODULELIST_H
|
||||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_NATIVE_DBIMODULELIST_H
|
||||
|
@ -7,19 +7,21 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_HASH_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_HASH_H
|
||||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
|
||||
uint32_t hashStringV1(StringRef Str);
|
||||
uint32_t hashStringV2(StringRef Str);
|
||||
uint32_t hashBufferV8(ArrayRef<uint8_t> Data);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_NATIVE_HASH_H
|
||||
|
@ -7,36 +7,36 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
|
||||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SparseBitVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/BinaryStreamReader.h"
|
||||
#include "llvm/Support/BinaryStreamWriter.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BinaryStreamReader;
|
||||
class BinaryStreamWriter;
|
||||
|
||||
namespace pdb {
|
||||
|
||||
class HashTableIterator;
|
||||
|
||||
class HashTable {
|
||||
friend class HashTableIterator;
|
||||
|
||||
struct Header {
|
||||
support::ulittle32_t Size;
|
||||
support::ulittle32_t Capacity;
|
||||
};
|
||||
|
||||
typedef std::vector<std::pair<uint32_t, uint32_t>> BucketList;
|
||||
using BucketList = std::vector<std::pair<uint32_t, uint32_t>>;
|
||||
|
||||
public:
|
||||
HashTable();
|
||||
@ -63,6 +63,7 @@ class HashTable {
|
||||
protected:
|
||||
bool isPresent(uint32_t K) const { return Present.test(K); }
|
||||
bool isDeleted(uint32_t K) const { return Deleted.test(K); }
|
||||
|
||||
BucketList Buckets;
|
||||
mutable SparseBitVector<> Present;
|
||||
mutable SparseBitVector<> Deleted;
|
||||
@ -81,6 +82,7 @@ class HashTableIterator
|
||||
: public iterator_facade_base<HashTableIterator, std::forward_iterator_tag,
|
||||
std::pair<uint32_t, uint32_t>> {
|
||||
friend class HashTable;
|
||||
|
||||
HashTableIterator(const HashTable &Map, uint32_t Index, bool IsEnd);
|
||||
|
||||
public:
|
||||
@ -101,6 +103,7 @@ class HashTableIterator
|
||||
};
|
||||
|
||||
} // end namespace pdb
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_RAW_HASHTABLE_H
|
||||
#endif // LLVM_DEBUGINFO_PDB_NATIVE_HASHTABLE_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- ModuleDebugStream.h - PDB Module Info Stream Access ----------------===//
|
||||
//===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -7,26 +7,26 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
|
||||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
|
||||
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
|
||||
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/Support/BinaryStreamArray.h"
|
||||
#include "llvm/Support/BinaryStreamRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
class PDBFile;
|
||||
|
||||
class DbiModuleDescriptor;
|
||||
|
||||
class ModuleDebugStreamRef {
|
||||
typedef codeview::DebugSubsectionArray::Iterator DebugSubsectionIterator;
|
||||
using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
|
||||
|
||||
public:
|
||||
ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
|
||||
@ -50,7 +50,7 @@ class ModuleDebugStreamRef {
|
||||
|
||||
ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default;
|
||||
|
||||
llvm::iterator_range<DebugSubsectionIterator> subsections() const;
|
||||
iterator_range<DebugSubsectionIterator> subsections() const;
|
||||
|
||||
bool hasDebugSubsections() const;
|
||||
|
||||
@ -75,7 +75,8 @@ class ModuleDebugStreamRef {
|
||||
|
||||
codeview::DebugSubsectionArray Subsections;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
|
||||
|
@ -7,27 +7,31 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
|
||||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/DebugInfo/PDB/Native/HashTable.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BinaryStreamReader;
|
||||
class BinaryStreamWriter;
|
||||
|
||||
namespace pdb {
|
||||
class NamedStreamMapBuilder;
|
||||
|
||||
class NamedStreamMap {
|
||||
friend class NamedStreamMapBuilder;
|
||||
|
||||
struct FinalizationInfo {
|
||||
uint32_t StringDataBytes = 0;
|
||||
uint32_t SerializedLength = 0;
|
||||
};
|
||||
friend NamedStreamMapBuilder;
|
||||
|
||||
public:
|
||||
NamedStreamMap();
|
||||
@ -50,6 +54,7 @@ class NamedStreamMap {
|
||||
};
|
||||
|
||||
} // end namespace pdb
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_RAW_PDBNAMEDSTREAMMAP_H
|
||||
#endif // LLVM_DEBUGINFO_PDB_NATIVE_NAMEDSTREAMMAP_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- NativeRawSymbol.h - Native implementation of IPDBRawSymbol - C++ -*-===//
|
||||
//==- NativeRawSymbol.h - Native implementation of IPDBRawSymbol -*- C++ -*-==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -11,6 +11,8 @@
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVERAWSYMBOL_H
|
||||
|
||||
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
@ -36,7 +38,7 @@ class NativeRawSymbol : public IPDBRawSymbol {
|
||||
std::unique_ptr<IPDBEnumSymbols>
|
||||
findInlineFramesByRVA(uint32_t RVA) const override;
|
||||
|
||||
void getDataBytes(llvm::SmallVector<uint8_t, 32> &Bytes) const override;
|
||||
void getDataBytes(SmallVector<uint8_t, 32> &Bytes) const override;
|
||||
void getFrontEndVersion(VersionInfo &Version) const override;
|
||||
void getBackEndVersion(VersionInfo &Version) const override;
|
||||
PDB_MemberAccess getAccess() const override;
|
||||
@ -206,7 +208,7 @@ class NativeRawSymbol : public IPDBRawSymbol {
|
||||
uint32_t SymbolId;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVERAWSYMBOL_H
|
||||
|
@ -7,11 +7,13 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_RAWSESSION_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_RAWSESSION_H
|
||||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVESESSION_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVESESSION_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
||||
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
|
||||
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
@ -30,6 +32,9 @@ class NativeSession : public IPDBSession {
|
||||
static Error createFromExe(StringRef Path,
|
||||
std::unique_ptr<IPDBSession> &Session);
|
||||
|
||||
std::unique_ptr<PDBSymbolCompiland>
|
||||
createCompilandSymbol(DbiModuleDescriptor MI);
|
||||
|
||||
uint64_t getLoadAddress() const override;
|
||||
void setLoadAddress(uint64_t Address) override;
|
||||
std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
|
||||
@ -71,6 +76,7 @@ class NativeSession : public IPDBSession {
|
||||
private:
|
||||
std::unique_ptr<PDBFile> Pdb;
|
||||
std::unique_ptr<BumpPtrAllocator> Allocator;
|
||||
std::vector<std::unique_ptr<NativeRawSymbol>> SymbolCache;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -10,21 +10,23 @@
|
||||
#ifndef LLVM_DEBUGINFO_PDB_PDB_H
|
||||
#define LLVM_DEBUGINFO_PDB_PDB_H
|
||||
|
||||
#include "PDBTypes.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <memory>
|
||||
#include <system_error>
|
||||
|
||||
namespace llvm {
|
||||
class StringRef;
|
||||
|
||||
namespace pdb {
|
||||
|
||||
class IPDBSession;
|
||||
|
||||
Error loadDataForPDB(PDB_ReaderType Type, StringRef Path,
|
||||
std::unique_ptr<IPDBSession> &Session);
|
||||
|
||||
Error loadDataForEXE(PDB_ReaderType Type, StringRef Path,
|
||||
std::unique_ptr<IPDBSession> &Session);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_PDB_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- PDBExtras.h - helper functions and classes for PDBs -------*- C++-*-===//
|
||||
//===- PDBExtras.h - helper functions and classes for PDBs ------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,15 +10,17 @@
|
||||
#ifndef LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
|
||||
#define LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
|
||||
|
||||
#include "PDBTypes.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include <unordered_map>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class raw_ostream;
|
||||
|
||||
namespace pdb {
|
||||
typedef std::unordered_map<PDB_SymType, int> TagStats;
|
||||
|
||||
using TagStats = std::unordered_map<PDB_SymType, int>;
|
||||
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_VariantType &Value);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const PDB_CallingConv &Conv);
|
||||
@ -37,7 +39,9 @@ raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
|
||||
raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace pdb
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_PDBEXTRAS_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- PDBTypes.h - Defines enums for various fields contained in PDB ---*-===//
|
||||
//===- PDBTypes.h - Defines enums for various fields contained in PDB ----====//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -10,9 +10,10 @@
|
||||
#ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
|
||||
#define LLVM_DEBUGINFO_PDB_PDBTYPES_H
|
||||
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
|
||||
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
@ -20,21 +21,11 @@
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
|
||||
class IPDBDataStream;
|
||||
class IPDBLineNumber;
|
||||
class IPDBSourceFile;
|
||||
class PDBSymDumper;
|
||||
class PDBSymbol;
|
||||
|
||||
class IPDBDataStream;
|
||||
template <class T> class IPDBEnumChildren;
|
||||
class IPDBLineNumber;
|
||||
class IPDBRawSymbol;
|
||||
class IPDBSession;
|
||||
class IPDBSourceFile;
|
||||
|
||||
typedef IPDBEnumChildren<PDBSymbol> IPDBEnumSymbols;
|
||||
typedef IPDBEnumChildren<IPDBSourceFile> IPDBEnumSourceFiles;
|
||||
typedef IPDBEnumChildren<IPDBDataStream> IPDBEnumDataStreams;
|
||||
typedef IPDBEnumChildren<IPDBLineNumber> IPDBEnumLineNumbers;
|
||||
|
||||
class PDBSymbolExe;
|
||||
class PDBSymbolCompiland;
|
||||
class PDBSymbolCompilandDetails;
|
||||
@ -67,6 +58,11 @@ class PDBSymbolTypeManaged;
|
||||
class PDBSymbolTypeDimension;
|
||||
class PDBSymbolUnknown;
|
||||
|
||||
using IPDBEnumSymbols = IPDBEnumChildren<PDBSymbol>;
|
||||
using IPDBEnumSourceFiles = IPDBEnumChildren<IPDBSourceFile>;
|
||||
using IPDBEnumDataStreams = IPDBEnumChildren<IPDBDataStream>;
|
||||
using IPDBEnumLineNumbers = IPDBEnumChildren<IPDBLineNumber>;
|
||||
|
||||
/// Specifies which PDB reader implementation is to be used. Only a value
|
||||
/// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
|
||||
enum class PDB_ReaderType {
|
||||
@ -104,7 +100,7 @@ enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
|
||||
|
||||
/// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
|
||||
/// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
|
||||
typedef codeview::CPUType PDB_Cpu;
|
||||
using PDB_Cpu = codeview::CPUType;
|
||||
|
||||
enum class PDB_Machine {
|
||||
Invalid = 0xffff,
|
||||
@ -135,12 +131,11 @@ enum class PDB_Machine {
|
||||
/// at the following locations:
|
||||
/// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
|
||||
/// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
|
||||
///
|
||||
typedef codeview::CallingConvention PDB_CallingConv;
|
||||
using PDB_CallingConv = codeview::CallingConvention;
|
||||
|
||||
/// These values correspond to the CV_CFL_LANG enumeration, and are documented
|
||||
/// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
|
||||
typedef codeview::SourceLanguage PDB_Lang;
|
||||
using PDB_Lang = codeview::SourceLanguage;
|
||||
|
||||
/// These values correspond to the DataKind enumeration, and are documented
|
||||
/// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
|
||||
@ -273,9 +268,9 @@ enum PDB_VariantType {
|
||||
};
|
||||
|
||||
struct Variant {
|
||||
Variant() : Type(PDB_VariantType::Empty) {}
|
||||
Variant() = default;
|
||||
|
||||
Variant(const Variant &Other) : Type(PDB_VariantType::Empty) {
|
||||
Variant(const Variant &Other) {
|
||||
*this = Other;
|
||||
}
|
||||
|
||||
@ -284,7 +279,7 @@ struct Variant {
|
||||
delete[] Value.String;
|
||||
}
|
||||
|
||||
PDB_VariantType Type;
|
||||
PDB_VariantType Type = PDB_VariantType::Empty;
|
||||
union {
|
||||
bool Bool;
|
||||
int8_t Int8;
|
||||
@ -344,18 +339,20 @@ struct Variant {
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
template <> struct hash<llvm::pdb::PDB_SymType> {
|
||||
typedef llvm::pdb::PDB_SymType argument_type;
|
||||
typedef std::size_t result_type;
|
||||
using argument_type = llvm::pdb::PDB_SymType;
|
||||
using result_type = std::size_t;
|
||||
|
||||
result_type operator()(const argument_type &Arg) const {
|
||||
return std::hash<int>()(static_cast<int>(Arg));
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace std
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
|
||||
|
@ -10,30 +10,26 @@
|
||||
#ifndef LLVM_DEBUGINFO_PDB_UDTLAYOUT_H
|
||||
#define LLVM_DEBUGINFO_PDB_UDTLAYOUT_H
|
||||
|
||||
#include "PDBSymbol.h"
|
||||
#include "PDBTypes.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
|
||||
#include <list>
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class raw_ostream;
|
||||
|
||||
namespace pdb {
|
||||
|
||||
class PDBSymTypeBaseClass;
|
||||
class PDBSymbolData;
|
||||
class PDBSymbolTypeUDT;
|
||||
class PDBSymbolTypeVTable;
|
||||
|
||||
class ClassLayout;
|
||||
class BaseClassLayout;
|
||||
class LayoutItemBase;
|
||||
class ClassLayout;
|
||||
class UDTLayoutBase;
|
||||
|
||||
class LayoutItemBase {
|
||||
@ -41,7 +37,7 @@ class LayoutItemBase {
|
||||
LayoutItemBase(const UDTLayoutBase *Parent, const PDBSymbol *Symbol,
|
||||
const std::string &Name, uint32_t OffsetInParent,
|
||||
uint32_t Size, bool IsElided);
|
||||
virtual ~LayoutItemBase() {}
|
||||
virtual ~LayoutItemBase() = default;
|
||||
|
||||
uint32_t deepPaddingSize() const;
|
||||
virtual uint32_t immediatePadding() const { return 0; }
|
||||
@ -79,7 +75,8 @@ class VBPtrLayoutItem : public LayoutItemBase {
|
||||
VBPtrLayoutItem(const UDTLayoutBase &Parent,
|
||||
std::unique_ptr<PDBSymbolTypeBuiltin> Sym, uint32_t Offset,
|
||||
uint32_t Size);
|
||||
virtual bool isVBPtr() const { return true; }
|
||||
|
||||
bool isVBPtr() const override { return true; }
|
||||
|
||||
private:
|
||||
std::unique_ptr<PDBSymbolTypeBuiltin> Type;
|
||||
@ -120,17 +117,12 @@ class UDTLayoutBase : public LayoutItemBase {
|
||||
bool IsElided);
|
||||
|
||||
uint32_t tailPadding() const override;
|
||||
|
||||
ArrayRef<LayoutItemBase *> layout_items() const { return LayoutItems; }
|
||||
|
||||
ArrayRef<BaseClassLayout *> bases() const { return AllBases; }
|
||||
ArrayRef<BaseClassLayout *> regular_bases() const { return NonVirtualBases; }
|
||||
ArrayRef<BaseClassLayout *> virtual_bases() const { return VirtualBases; }
|
||||
|
||||
uint32_t directVirtualBaseCount() const { return DirectVBaseCount; }
|
||||
|
||||
ArrayRef<std::unique_ptr<PDBSymbolFunc>> funcs() const { return Funcs; }
|
||||
|
||||
ArrayRef<std::unique_ptr<PDBSymbol>> other_items() const { return Other; }
|
||||
|
||||
protected:
|
||||
@ -183,7 +175,8 @@ class ClassLayout : public UDTLayoutBase {
|
||||
std::unique_ptr<PDBSymbolTypeUDT> OwnedStorage;
|
||||
const PDBSymbolTypeUDT &UDT;
|
||||
};
|
||||
}
|
||||
} // namespace llvm
|
||||
|
||||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_UDTLAYOUT_H
|
||||
|
@ -15,9 +15,11 @@
|
||||
#define LLVM_EXECUTIONENGINE_ORC_IRTRANSFORMLAYER_H
|
||||
|
||||
#include "llvm/ExecutionEngine/JITSymbol.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
class Module;
|
||||
namespace orc {
|
||||
|
||||
/// @brief IR mutating layer.
|
||||
|
@ -120,7 +120,7 @@ class Argument final : public Value {
|
||||
bool hasAttribute(Attribute::AttrKind Kind) const;
|
||||
|
||||
/// Method for support type inquiry through isa, cast, and dyn_cast.
|
||||
static inline bool classof(const Value *V) {
|
||||
static bool classof(const Value *V) {
|
||||
return V->getValueID() == ArgumentVal;
|
||||
}
|
||||
};
|
||||
|
@ -326,7 +326,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
|
||||
ValueSymbolTable *getValueSymbolTable();
|
||||
|
||||
/// \brief Methods for support type inquiry through isa, cast, and dyn_cast.
|
||||
static inline bool classof(const Value *V) {
|
||||
static bool classof(const Value *V) {
|
||||
return V->getValueID() == Value::BasicBlockVal;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ class Constant : public User {
|
||||
void destroyConstant();
|
||||
|
||||
//// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const Value *V) {
|
||||
static bool classof(const Value *V) {
|
||||
return V->getValueID() >= ConstantFirstVal &&
|
||||
V->getValueID() <= ConstantLastVal;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user