Import clang 3.7.0 release (r246257).

This commit is contained in:
Dimitry Andric 2015-09-06 18:36:24 +00:00
parent 51ece4aae5
commit 36c5ade2f4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/clang/dist/; revision=287512
svn path=/vendor/clang/clang-release_370-r246257/; revision=287513; tag=vendor/clang/clang-release_370-r246257
226 changed files with 22108 additions and 1065 deletions

View File

@ -20,7 +20,7 @@ Information on the LLVM project: http://llvm.org/
If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
http://lists.llvm.org/mailman/listinfo/cfe-dev
If you find a bug in Clang, please file it in the LLVM bug tracker:
http://llvm.org/bugs/

File diff suppressed because it is too large Load Diff

View File

@ -47,6 +47,14 @@ if (LLVM_ENABLE_DOXYGEN)
set(clang_doxygen_qhp_cust_filter_attrs "")
endif()
option(LLVM_DOXYGEN_SVG
"Use svg instead of png files for doxygen graphs." OFF)
if (LLVM_DOXYGEN_SVG)
set(DOT_IMAGE_FORMAT "svg")
else()
set(DOT_IMAGE_FORMAT "png")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
@ -64,6 +72,7 @@ if (LLVM_ENABLE_DOXYGEN)
set(clang_doxygen_qhelpgenerator_path)
set(clang_doxygen_qhp_cust_filter_name)
set(clang_doxygen_qhp_cust_filter_attrs)
set(DOT_IMAGE_FORMAT)
add_custom_target(doxygen-clang
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg

View File

@ -20,7 +20,7 @@ where Clang is used are:
If you know of (or wrote!) a tool or project using Clang, please send an
email to Clang's `development discussion mailing list
<http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>`_ to have it added.
<http://lists.llvm.org/mailman/listinfo/cfe-dev>`_ to have it added.
(or if you are already a Clang contributor, feel free to directly commit
additions). Since the primary purpose of this page is to provide examples
that can help developers, generally they must have code available.

View File

@ -508,7 +508,7 @@ token. This concept maps directly to the "spelling location" for the token.
``SourceRange`` and ``CharSourceRange``
---------------------------------------
.. mostly taken from http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-August/010595.html
.. mostly taken from http://lists.llvm.org/pipermail/cfe-dev/2010-August/010595.html
Clang represents most source ranges by [first, last], where "first" and "last"
each point to the beginning of their respective tokens. For example consider

View File

@ -30,6 +30,7 @@ $(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
-e 's/@enable_server_based_search@/NO/g' \
-e 's/@extra_search_mappings@//g' \
-e 's/@searchengine_url@//g' \
-e 's/@DOT_IMAGE_FORMAT@/png/g' \
> $@
endif

View File

@ -1,6 +1,6 @@
=====================================
Clang 3.7 (In-Progress) Release Notes
=====================================
=======================
Clang 3.7 Release Notes
=======================
.. contents::
:local:
@ -8,11 +8,6 @@ Clang 3.7 (In-Progress) Release Notes
Written by the `LLVM Team <http://llvm.org/>`_
.. warning::
These are in-progress notes for the upcoming Clang 3.7 release. You may
prefer the `Clang 3.6 Release Notes
<http://llvm.org/releases/3.6.0/tools/clang/docs/ReleaseNotes.html>`_.
Introduction
============
@ -31,11 +26,6 @@ the latest release, please check out the main please see the `Clang Web
Site <http://clang.llvm.org>`_ or the `LLVM Web
Site <http://llvm.org>`_.
Note that if you are reading this file from a Subversion checkout or the
main Clang web page, this document applies to the *next* release, not
the current one. To see the release notes for a specific release, please
see the `releases page <http://llvm.org/releases/>`_.
What's New in Clang 3.7?
========================
@ -52,14 +42,48 @@ Major New Features
extension is also enabled when compiling CUDA code, but its use should be
viewed as an implementation detail that is subject to change.
- On Windows targets, some uses of the ``__try``, ``__except``, and
``__finally`` language constructs are supported in Clang 3.7. MSVC-compatible
C++ exceptions are not yet supported, however.
- Clang 3.7 fully supports OpenMP 3.1 and reported to work on many platforms,
including x86, x86-64 and Power. Also, pragma ``omp simd`` from OpenMP 4.0 is
supported as well. See below for details.
- Clang 3.7 includes an implementation of :doc:`control flow integrity
<ControlFlowIntegrity>`, a security hardening mechanism.
Improvements to Clang's diagnostics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-----------------------------------
Clang's diagnostics are constantly being improved to catch more issues,
explain them more clearly, and provide more accurate source information
about them. The improvements since the 3.5 release include:
about them. The improvements since the 3.6 release include:
- ...
- -Wrange-loop-analysis analyzes the loop variable type and the container type
to determine whether copies are made of the container elements. If possible,
suggest a const reference type to prevent copies, or a non-reference type
to indicate a copy is made.
- -Wredundant-move warns when a parameter variable is moved on return and the
return type is the same as the variable. Returning the variable directly
will already make a move, so the call is not needed.
- -Wpessimizing-move warns when a local variable is moved on return and the
return type is the same as the variable. Copy elision cannot take place with
a move, but can take place if the variable is returned directly.
- -Wmove is a new warning group which has the previous two warnings,
-Wredundant-move and -Wpessimizing-move, as well as previous warning
-Wself-move. In addition, this group is part of -Wmost and -Wall now.
- -Winfinite-recursion, a warning for functions that only call themselves,
is now part of -Wmost and -Wall.
- -Wobjc-circular-container prevents creation of circular containers,
it covers ``NSMutableArray``, ``NSMutableSet``, ``NSMutableDictionary``,
``NSMutableOrderedSet`` and all their subclasses.
New Compiler Flags
------------------
@ -69,49 +93,44 @@ The sized deallocation feature of C++14 is now controlled by the
isn't yet widely deployed, so the user must supply an extra flag to get the
extra functionality.
The option ....
New Pragmas in Clang
-----------------------
Clang now supports the ...
Windows Support
---------------
Clang's support for building native Windows programs ...
C Language Changes in Clang
---------------------------
...
C11 Feature Support
^^^^^^^^^^^^^^^^^^^
...
C++ Language Changes in Clang
-----------------------------
- ...
C++11 Feature Support
^^^^^^^^^^^^^^^^^^^^^
...
Objective-C Language Changes in Clang
-------------------------------------
...
- ``objc_boxable`` attribute was added. Structs and unions marked with this attribute can be
used with boxed expressions (``@(...)``) to create ``NSValue``.
OpenCL C Language Changes in Clang
----------------------------------
Profile Guided Optimization
---------------------------
...
Clang now accepts GCC-compatible flags for profile guided optimization (PGO).
You can now use ``-fprofile-generate=<dir>``, ``-fprofile-use=<dir>``,
``-fno-profile-generate`` and ``-fno-profile-use``. These flags have the
same semantics as their GCC counterparts. However, the generated profile
is still LLVM-specific. PGO profiles generated with Clang cannot be used
by GCC and vice-versa.
Clang now emits function entry counts in profile-instrumented binaries.
This has improved the computation of weights and frequencies in
profile analysis.
OpenMP Support
--------------
OpenMP 3.1 is fully supported, but disabled by default. To enable it, please use
the ``-fopenmp=libomp`` command line option. Your feedback (positive or negative) on
using OpenMP-enabled clang would be much appreciated; please share it either on
`cfe-dev <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_ or `openmp-dev
<http://lists.llvm.org/mailman/listinfo/openmp-dev>`_ mailing lists.
In addition to OpenMP 3.1, several important elements of the 4.0 version of the
standard are supported as well:
- ``omp simd``, ``omp for simd`` and ``omp parallel for simd`` pragmas
- atomic constructs
- ``proc_bind`` clause of ``omp parallel`` pragma
- ``depend`` clause of ``omp task`` pragma (except for array sections)
- ``omp cancel`` and ``omp cancellation point`` pragmas
- ``omp taskgroup`` pragma
Internal API Changes
--------------------
@ -120,43 +139,121 @@ These are major API changes that have happened since the 3.6 release of
Clang. If upgrading an external codebase that uses Clang as a library,
this section should help get you past the largest hurdles of upgrading.
- Some of the `PPCallbacks` interface now deals in `MacroDefinition`
objects instead of `MacroDirective` objects. This allows preserving
- Some of the ``PPCallbacks`` interface now deals in ``MacroDefinition``
objects instead of ``MacroDirective`` objects. This allows preserving
full information on macros imported from modules.
- `clang-c/Index.h` no longer `#include`\s `clang-c/Documentation.h`.
You now need to explicitly `#include "clang-c/Documentation.h"` if
- ``clang-c/Index.h`` no longer ``#include``\s ``clang-c/Documentation.h``.
You now need to explicitly ``#include "clang-c/Documentation.h"`` if
you use the libclang documentation API.
libclang
--------
...
Static Analyzer
---------------
...
* The generated plists now contain the name of the check that generated it.
Core Analysis Improvements
==========================
* Configuration options can now be passed to the checkers (not just the static
analyzer core).
- ...
* New check for dereferencing object that the result of a zero-length
allocation.
New Issues Found
================
* Also check functions in precompiled headers.
- ...
* Properly handle alloca() in some checkers.
Python Binding Changes
----------------------
* Various improvements to the retain count checker.
The following methods have been added:
- ...
clang-tidy
----------
Added new checks:
Significant Known Problems
==========================
* google-global-names-in-headers: flag global namespace pollution in header
files.
* misc-assert-side-effect: detects ``assert()`` conditions with side effects
which can cause different behavior in debug / release builds.
* misc-assign-operator-signature: finds declarations of assign operators with
the wrong return and/or argument types.
* misc-inaccurate-erase: warns when some elements of a container are not
removed due to using the ``erase()`` algorithm incorrectly.
* misc-inefficient-algorithm: warns on inefficient use of STL algorithms on
associative containers.
* misc-macro-parentheses: finds macros that can have unexpected behavior due
to missing parentheses.
* misc-macro-repeated-side-effects: checks for repeated argument with side
effects in macros.
* misc-noexcept-move-constructor: flags user-defined move constructors and
assignment operators not marked with ``noexcept`` or marked with
``noexcept(expr)`` where ``expr`` evaluates to ``false`` (but is not a
``false`` literal itself).
* misc-static-assert: replaces ``assert()`` with ``static_assert()`` if the
condition is evaluable at compile time.
* readability-container-size-empty: checks whether a call to the ``size()``
method can be replaced with a call to ``empty()``.
* readability-else-after-return: flags conditional statements having the
``else`` branch, when the ``true`` branch has a ``return`` as the last statement.
* readability-redundant-string-cstr: finds unnecessary calls to
``std::string::c_str()``.
* readability-shrink-to-fit: replaces copy and swap tricks on shrinkable
containers with the ``shrink_to_fit()`` method call.
* readability-simplify-boolean-expr: looks for boolean expressions involving
boolean constants and simplifies them to use the appropriate boolean
expression directly (``if (x == true) ... -> if (x)``, etc.)
SystemZ
-------
* Clang will now always default to the z10 processor when compiling
without any ``-march=`` option. Previous releases used to automatically
detect the current host CPU when compiling natively. If you wish to
still have clang detect the current host CPU, you now need to use the
``-march=native`` option.
* Clang now provides the ``<s390intrin.h>`` header file.
* Clang now supports the transactional-execution facility and
provides associated builtins and the ``<htmintrin.h>`` and
``<htmxlintrin.h>`` header files. Support is enabled by default
on zEC12 and above, and can additionally be enabled or disabled
via the ``-mhtm`` / ``-mno-htm`` command line options.
* Clang now supports the vector facility. This includes a
change in the ABI to pass arguments and return values of
vector types in vector registers, as well as a change in
the default alignment of vector types. Support is enabled
by default on z13 and above, and can additionally be enabled
or disabled via the ``-mvx`` / ``-mno-vx`` command line options.
* Clang now supports the System z vector language extension,
providing a "vector" keyword to define vector types, and a
set of builtins defined in the ``<vecintrin.h>`` header file.
This can be enabled via the ``-fzvector`` command line option.
For compatibility with GCC, Clang also supports the
``-mzvector`` option as an alias.
* Several cases of ABI incompatibility with GCC have been fixed.
Last release which will run on Windows XP and Windows Vista
-----------------------------------------------------------
This is expected to the be the last major release of Clang that will support
running on Windows XP and Windows Vista. For the next major release the
minimum Windows version requirement will be Windows 7.
Additional Information
======================
@ -170,4 +267,4 @@ tree.
If you have any questions or comments about Clang, please feel free to
contact us via the `mailing
list <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>`_.
list <http://lists.llvm.org/mailman/listinfo/cfe-dev>`_.

View File

@ -1985,7 +1985,7 @@ with a warning. For example:
::
clang-cl.exe: warning: argument unused during compilation: '/Zi'
clang-cl.exe: warning: argument unused during compilation: '/AI'
To suppress warnings about unused arguments, use the ``-Qunused-arguments`` option.
@ -2014,14 +2014,21 @@ Execute ``clang-cl /?`` to see a list of supported options:
/E Preprocess to stdout
/fallback Fall back to cl.exe if clang-cl fails to compile
/FA Output assembly code file during compilation
/Fa<file or directory> Output assembly code to this file during compilation
/Fa<file or directory> Output assembly code to this file during compilation (with /FA)
/Fe<file or directory> Set output executable file or directory (ends in / or \)
/FI <value> Include file before parsing
/Fi<file> Set preprocess output file name
/Fo<file or directory> Set output object file, or directory (ends in / or \)
/Fi<file> Set preprocess output file name (with /P)
/Fo<file or directory> Set output object file, or directory (ends in / or \) (with /c)
/fp:except-
/fp:except
/fp:fast
/fp:precise
/fp:strict
/GA Assume thread-local variables are defined in the executable
/GF- Disable string pooling
/GR- Disable emission of RTTI data
/GR Enable emission of RTTI data
/Gs<value> Set stack probe size
/Gw- Don't put each data item in its own section
/Gw Put each data item in its own section
/Gy- Don't put each function in its own section
@ -2046,7 +2053,10 @@ Execute ``clang-cl /?`` to see a list of supported options:
/Oy- Disable frame pointer omission
/Oy Enable frame pointer omission
/O<n> Optimization level
/o <file or directory> Set output file or directory (ends in / or \)
/P Preprocess to file
/Qvec- Disable the loop vectorization passes
/Qvec Enable the loop vectorization passes
/showIncludes Print info about included files to stderr
/TC Treat all source files as C
/Tc <filename> Specify a C source file
@ -2059,6 +2069,8 @@ Execute ``clang-cl /?`` to see a list of supported options:
/vmm Set the default most-general representation to multiple inheritance
/vms Set the default most-general representation to single inheritance
/vmv Set the default most-general representation to virtual inheritance
/volatile:iso Volatile loads and stores have standard semantics
/volatile:ms Volatile loads and stores have acquire and release semantics
/W0 Disable all warnings
/W1 Enable -Wall
/W2 Enable -Wall
@ -2068,29 +2080,52 @@ Execute ``clang-cl /?`` to see a list of supported options:
/WX- Do not treat warnings as errors
/WX Treat warnings as errors
/w Disable all warnings
/Zc:sizedDealloc- Disable C++14 sized global deallocation functions
/Zc:sizedDealloc Enable C++14 sized global deallocation functions
/Zc:strictStrings Treat string literals as const
/Zc:threadSafeInit- Disable thread-safe initialization of static variables
/Zc:threadSafeInit Enable thread-safe initialization of static variables
/Zc:trigraphs- Disable trigraphs (default)
/Zc:trigraphs Enable trigraphs
/Zi Enable debug information
/Zp Set the default maximum struct packing alignment to 1
/Zp<value> Specify the default maximum struct packing alignment
/Zs Syntax-check only
OPTIONS:
-### Print (but do not run) the commands to run for this compilation
-### Print (but do not run) the commands to run for this compilation
--analyze Run the static analyzer
-fansi-escape-codes Use ANSI escape codes for diagnostics
-fcolor-diagnostics Use colors in diagnostics
-fdiagnostics-parseable-fixits
Print fix-its in machine parseable form
-fms-compatibility-version=<value>
Dot-separated value representing the Microsoft compiler version
number to report in _MSC_VER (0 = don't define it (default))
-fmsc-version=<value> Microsoft compiler version number to report in _MSC_VER (0 = don't
define it (default))
Dot-separated value representing the Microsoft compiler version
number to report in _MSC_VER (0 = don't define it (default))
-fmsc-version=<value> Microsoft compiler version number to report in _MSC_VER (0 = don't
define it (default))
-fno-sanitize-coverage=<value>
Disable specified features of coverage instrumentation for Sanitizers
-fno-sanitize-recover=<value>
Disable recovery for specified sanitizers
-fno-sanitize-trap=<value>
Disable trapping for specified sanitizers
-fsanitize-blacklist=<value>
Path to blacklist file for sanitizers
-fsanitize=<check> Enable runtime instrumentation for bug detection: address (memory
errors) | thread (race detection) | undefined (miscellaneous
undefined behavior)
-mllvm <value> Additional arguments to forward to LLVM's option processing
-Qunused-arguments Don't emit warning for unused driver arguments
--target=<value> Generate code for the given target
-v Show commands to run and use verbose output
-W<warning> Enable the specified warning
-Xclang <arg> Pass <arg> to the clang compiler
Path to blacklist file for sanitizers
-fsanitize-coverage=<value>
Specify the type of coverage instrumentation for Sanitizers
-fsanitize-recover=<value>
Enable recovery for specified sanitizers
-fsanitize-trap=<value> Enable trapping for specified sanitizers
-fsanitize=<check> Turn on runtime checks for various forms of undefined or suspicious
behavior. See user manual for available checks
-mllvm <value> Additional arguments to forward to LLVM's option processing
-Qunused-arguments Don't emit warning for unused driver arguments
-R<remark> Enable the specified remark
--target=<value> Generate code for the given target
-v Show commands to run and use verbose output
-W<warning> Enable the specified warning
-Xclang <arg> Pass <arg> to the clang compiler
The /fallback Option
^^^^^^^^^^^^^^^^^^^^

View File

@ -2205,7 +2205,7 @@ DIRECTORY_GRAPH = YES
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_IMAGE_FORMAT = png
DOT_IMAGE_FORMAT = @DOT_IMAGE_FORMAT@
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.

View File

@ -384,14 +384,15 @@ void ASTVector<T>::grow(const ASTContext &C, size_t MinSize) {
T *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
// Copy the elements over.
if (std::is_class<T>::value) {
std::uninitialized_copy(Begin, End, NewElts);
// Destroy the original elements.
destroy_range(Begin, End);
}
else {
// Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
memcpy(NewElts, Begin, CurSize * sizeof(T));
if (Begin != End) {
if (std::is_class<T>::value) {
std::uninitialized_copy(Begin, End, NewElts);
// Destroy the original elements.
destroy_range(Begin, End);
} else {
// Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
memcpy(NewElts, Begin, CurSize * sizeof(T));
}
}
// ASTContext never frees any memory.

View File

@ -16,6 +16,7 @@
namespace clang {
class ASTContext;
class ObjCInterfaceDecl;
class QualType;
class Expr;
@ -35,11 +36,10 @@ class NSAPI {
ClassId_NSMutableDictionary,
ClassId_NSNumber,
ClassId_NSMutableSet,
ClassId_NSCountedSet,
ClassId_NSMutableOrderedSet,
ClassId_NSValue
};
static const unsigned NumClassIds = 11;
static const unsigned NumClassIds = 10;
enum NSStringMethodKind {
NSStr_stringWithString,
@ -220,6 +220,10 @@ class NSAPI {
/// \brief Returns \c true if \p Id is currently defined as a macro.
bool isMacroDefined(StringRef Id) const;
/// \brief Returns \c true if \p InterfaceDecl is subclass of \p NSClassKind
bool isSubclassOfNSClass(ObjCInterfaceDecl *InterfaceDecl,
NSClassIdKindKind NSClassKind) const;
private:
bool isObjCTypedef(QualType T, StringRef name, IdentifierInfo *&II) const;
bool isObjCEnumerator(const Expr *E,

View File

@ -312,18 +312,26 @@ class OMPLoopDirective : public OMPExecutableDirective {
}
/// \brief Get the updates storage.
MutableArrayRef<Expr *> getUpdates() {
MutableArrayRef<Expr *> getInits() {
Expr **Storage = reinterpret_cast<Expr **>(
&*std::next(child_begin(),
getArraysOffset(getDirectiveKind()) + CollapsedNum));
return MutableArrayRef<Expr *>(Storage, CollapsedNum);
}
/// \brief Get the updates storage.
MutableArrayRef<Expr *> getUpdates() {
Expr **Storage = reinterpret_cast<Expr **>(
&*std::next(child_begin(),
getArraysOffset(getDirectiveKind()) + 2 * CollapsedNum));
return MutableArrayRef<Expr *>(Storage, CollapsedNum);
}
/// \brief Get the final counter updates storage.
MutableArrayRef<Expr *> getFinals() {
Expr **Storage = reinterpret_cast<Expr **>(
&*std::next(child_begin(),
getArraysOffset(getDirectiveKind()) + 2 * CollapsedNum));
getArraysOffset(getDirectiveKind()) + 3 * CollapsedNum));
return MutableArrayRef<Expr *>(Storage, CollapsedNum);
}
@ -358,7 +366,7 @@ class OMPLoopDirective : public OMPExecutableDirective {
static unsigned numLoopChildren(unsigned CollapsedNum,
OpenMPDirectiveKind Kind) {
return getArraysOffset(Kind) +
3 * CollapsedNum; // Counters, Updates and Finals
4 * CollapsedNum; // Counters, Inits, Updates and Finals
}
void setIterationVariable(Expr *IV) {
@ -414,6 +422,7 @@ class OMPLoopDirective : public OMPExecutableDirective {
*std::next(child_begin(), NextUpperBoundOffset) = NUB;
}
void setCounters(ArrayRef<Expr *> A);
void setInits(ArrayRef<Expr *> A);
void setUpdates(ArrayRef<Expr *> A);
void setFinals(ArrayRef<Expr *> A);
@ -453,6 +462,8 @@ class OMPLoopDirective : public OMPExecutableDirective {
Expr *NUB;
/// \brief Counters Loop counters.
SmallVector<Expr *, 4> Counters;
/// \brief Expressions for loop counters inits for CodeGen.
SmallVector<Expr *, 4> Inits;
/// \brief Expressions for loop counters update for CodeGen.
SmallVector<Expr *, 4> Updates;
/// \brief Final loop counter values for GodeGen.
@ -484,10 +495,12 @@ class OMPLoopDirective : public OMPExecutableDirective {
NLB = nullptr;
NUB = nullptr;
Counters.resize(Size);
Inits.resize(Size);
Updates.resize(Size);
Finals.resize(Size);
for (unsigned i = 0; i < Size; ++i) {
Counters[i] = nullptr;
Inits[i] = nullptr;
Updates[i] = nullptr;
Finals[i] = nullptr;
}
@ -584,6 +597,12 @@ class OMPLoopDirective : public OMPExecutableDirective {
return const_cast<OMPLoopDirective *>(this)->getCounters();
}
ArrayRef<Expr *> inits() { return getInits(); }
ArrayRef<Expr *> inits() const {
return const_cast<OMPLoopDirective *>(this)->getInits();
}
ArrayRef<Expr *> updates() { return getUpdates(); }
ArrayRef<Expr *> updates() const {

View File

@ -223,14 +223,15 @@ void BumpVector<T>::grow(BumpVectorContext &C, size_t MinSize) {
T *NewElts = C.getAllocator().template Allocate<T>(NewCapacity);
// Copy the elements over.
if (std::is_class<T>::value) {
std::uninitialized_copy(Begin, End, NewElts);
// Destroy the original elements.
destroy_range(Begin, End);
}
else {
// Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
memcpy(NewElts, Begin, CurSize * sizeof(T));
if (Begin != End) {
if (std::is_class<T>::value) {
std::uninitialized_copy(Begin, End, NewElts);
// Destroy the original elements.
destroy_range(Begin, End);
} else {
// Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
memcpy(NewElts, Begin, CurSize * sizeof(T));
}
}
// For now, leak 'Begin'. We can add it back to a freelist in

View File

@ -1133,7 +1133,7 @@ def ObjCRuntimeName : Attr {
def ObjCBoxable : Attr {
let Spellings = [GNU<"objc_boxable">];
let Subjects = SubjectList<[Record], ErrorDiag, "ExpectedStructOrUnion">;
let Documentation = [Undocumented];
let Documentation = [ObjCBoxableDocs];
}
def OptimizeNone : InheritableAttr {

View File

@ -492,6 +492,34 @@ can only be placed before an @protocol or @interface declaration:
}];
}
def ObjCBoxableDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
Structs and unions marked with the ``objc_boxable`` attribute can be used
with the Objective-C boxed expression syntax, ``@(...)``.
**Usage**: ``__attribute__((objc_boxable))``. This attribute
can only be placed on a declaration of a trivially-copyable struct or union:
.. code-block:: objc
struct __attribute__((objc_boxable)) some_struct {
int i;
};
union __attribute__((objc_boxable)) some_union {
int i;
float f;
};
typedef struct __attribute__((objc_boxable)) _some_struct some_struct;
// ...
some_struct ss;
NSValue *boxed = @(ss);
}];
}
def AvailabilityDocs : Documentation {
let Category = DocCatFunction;
let Content = [{

View File

@ -195,6 +195,8 @@ def err_unable_to_make_temp : Error<
// Modules
def err_module_file_conflict : Error<"module '%0' found in both '%1' and '%2'">;
def err_module_format_unhandled : Error<
"no handler registered for module format '%0'">;
// TransformActions
// TODO: Use a custom category name to distinguish rewriter errors.

View File

@ -358,6 +358,10 @@ def err_invalid_pixel_decl_spec_combination : Error<
"'%0' declaration specifier not allowed here">;
def err_invalid_vector_bool_decl_spec : Error<
"cannot use '%0' with '__vector bool'">;
def err_invalid_vector_long_decl_spec : Error<
"cannot use 'long' with '__vector'">;
def err_invalid_vector_float_decl_spec : Error<
"cannot use 'float' with '__vector'">;
def err_invalid_vector_double_decl_spec : Error <
"use of 'double' with '__vector' requires VSX support to be enabled "
"(available on POWER7 or later)">;

View File

@ -5358,7 +5358,7 @@ def err_objc_object_catch : Error<
def err_incomplete_type_objc_at_encode : Error<
"'@encode' of incomplete type %0">;
def warn_objc_circular_container : Warning<
"adding '%0' to '%0' might cause circular dependency in container">,
"adding '%0' to '%1' might cause circular dependency in container">,
InGroup<DiagGroup<"objc-circular-container">>;
def note_objc_circular_container_declared_here : Note<"'%0' declared here">;

View File

@ -104,6 +104,7 @@ LANGOPT(WritableStrings , 1, 0, "writable string support")
LANGOPT(ConstStrings , 1, 0, "const-qualified string support")
LANGOPT(LaxVectorConversions , 1, 1, "lax vector conversions")
LANGOPT(AltiVec , 1, 0, "AltiVec-style vector initializers")
LANGOPT(ZVector , 1, 0, "System z vector extensions")
LANGOPT(Exceptions , 1, 0, "exception handling")
LANGOPT(ObjCExceptions , 1, 0, "Objective-C exceptions")
LANGOPT(CXXExceptions , 1, 0, "C++ exceptions")

View File

@ -239,6 +239,8 @@ PUNCTUATOR(greatergreatergreater, ">>>")
// KEYOPENCL - This is a keyword in OpenCL
// KEYNOOPENCL - This is a keyword that is not supported in OpenCL
// KEYALTIVEC - This is a keyword in AltiVec
// KEYZVECTOR - This is a keyword for the System z vector extensions,
// which are heavily based on AltiVec
// KEYBORLAND - This is a keyword if Borland extensions are enabled
// BOOLSUPPORT - This is a keyword if 'bool' is a built-in type
// HALFSUPPORT - This is a keyword if 'half' is a built-in type
@ -501,7 +503,7 @@ ALIAS("write_only", __write_only , KEYOPENCL)
ALIAS("read_write", __read_write , KEYOPENCL)
// OpenCL builtins
KEYWORD(__builtin_astype , KEYOPENCL)
KEYWORD(vec_step , KEYOPENCL|KEYALTIVEC)
KEYWORD(vec_step , KEYOPENCL|KEYALTIVEC|KEYZVECTOR)
// OpenMP Type Traits
KEYWORD(__builtin_omp_required_simd_align, KEYALL)
@ -510,9 +512,9 @@ KEYWORD(__builtin_omp_required_simd_align, KEYALL)
KEYWORD(__pascal , KEYALL)
// Altivec Extension.
KEYWORD(__vector , KEYALTIVEC)
KEYWORD(__vector , KEYALTIVEC|KEYZVECTOR)
KEYWORD(__pixel , KEYALTIVEC)
KEYWORD(__bool , KEYALTIVEC)
KEYWORD(__bool , KEYALTIVEC|KEYZVECTOR)
// ARM NEON extensions.
ALIAS("__fp16", half , KEYALL)

View File

@ -14,30 +14,32 @@
namespace clang {
/// \brief A PCHContainerOperations implementation that uses LLVM to
/// A PCHContainerWriter implementation that uses LLVM to
/// wraps Clang modules inside a COFF, ELF, or Mach-O container.
class ObjectFilePCHContainerOperations
: public PCHContainerOperations {
/// \brief Return an ASTConsumer that can be chained with a
class ObjectFilePCHContainerWriter : public PCHContainerWriter {
StringRef getFormat() const override { return "obj"; }
/// Return an ASTConsumer that can be chained with a
/// PCHGenerator that produces a wrapper file format
/// that also contains full debug info for the module.
std::unique_ptr<ASTConsumer>
CreatePCHContainerGenerator(
std::unique_ptr<ASTConsumer> CreatePCHContainerGenerator(
DiagnosticsEngine &Diags, const HeaderSearchOptions &HSO,
const PreprocessorOptions &PPO, const TargetOptions &TO,
const LangOptions &LO, const std::string &MainFileName,
const std::string &OutputFileName, llvm::raw_pwrite_stream *OS,
std::shared_ptr<PCHBuffer> Buffer) const override;
};
/// \brief Initialize an llvm::BitstreamReader with the serialized
/// A PCHContainerReader implementation that uses LLVM to
/// wraps Clang modules inside a COFF, ELF, or Mach-O container.
class ObjectFilePCHContainerReader : public PCHContainerReader {
StringRef getFormat() const override { return "obj"; }
/// Initialize an llvm::BitstreamReader with the serialized
/// AST inside the PCH container Buffer.
void ExtractPCH(llvm::MemoryBufferRef Buffer,
llvm::BitstreamReader &StreamFile) const override;
};
}
#endif

View File

@ -369,6 +369,9 @@ def fmodules_local_submodule_visibility :
Flag<["-"], "fmodules-local-submodule-visibility">,
HelpText<"Enforce name visibility rules across submodules of the same "
"top-level module.">;
def fmodule_format_EQ : Joined<["-"], "fmodule-format=">,
HelpText<"Select the container format for clang modules and PCH. "
"Supported options are 'raw' and 'obj'.">;
def fno_modules_hide_internal_linkage :
Flag<["-"], "fno-modules-hide-internal-linkage">,
HelpText<"Make all declarations visible to redeclaration lookup, "

View File

@ -1351,6 +1351,13 @@ def mno_altivec : Flag<["-"], "mno-altivec">, Alias<fno_altivec>;
def mvx : Flag<["-"], "mvx">, Group<m_Group>;
def mno_vx : Flag<["-"], "mno-vx">, Group<m_Group>;
def fzvector : Flag<["-"], "fzvector">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Enable System z vector language extension">;
def fno_zvector : Flag<["-"], "fno-zvector">, Group<f_Group>,
Flags<[CC1Option]>;
def mzvector : Flag<["-"], "mzvector">, Alias<fzvector>;
def mno_zvector : Flag<["-"], "mno-zvector">, Alias<fno_zvector>;
def mno_warn_nonportable_cfstrings : Flag<["-"], "mno-warn-nonportable-cfstrings">, Group<m_Group>;
def mno_omit_leaf_frame_pointer : Flag<["-"], "mno-omit-leaf-frame-pointer">, Group<m_Group>;
def momit_leaf_frame_pointer : Flag<["-"], "momit-leaf-frame-pointer">, Group<m_Group>,

View File

@ -57,6 +57,7 @@ class FileManager;
class HeaderSearch;
class Preprocessor;
class PCHContainerOperations;
class PCHContainerReader;
class SourceManager;
class TargetInfo;
class ASTFrontendAction;
@ -725,8 +726,7 @@ class ASTUnit : public ModuleLoader {
///
/// \returns - The initialized ASTUnit or null if the AST failed to load.
static std::unique_ptr<ASTUnit> LoadFromASTFile(
const std::string &Filename,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
const std::string &Filename, const PCHContainerReader &PCHContainerRdr,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
const FileSystemOptions &FileSystemOpts, bool OnlyLocalDecls = false,
ArrayRef<RemappedFile> RemappedFiles = None,

View File

@ -183,7 +183,7 @@ class CompilerInstance : public ModuleLoader {
public:
explicit CompilerInstance(
std::shared_ptr<PCHContainerOperations> PCHContainerOps =
std::make_shared<RawPCHContainerOperations>(),
std::make_shared<PCHContainerOperations>(),
bool BuildingModule = false);
~CompilerInstance() override;
@ -508,6 +508,34 @@ class CompilerInstance : public ModuleLoader {
return ThePCHContainerOperations;
}
/// Return the appropriate PCHContainerWriter depending on the
/// current CodeGenOptions.
const PCHContainerWriter &getPCHContainerWriter() const {
assert(Invocation && "cannot determine module format without invocation");
StringRef Format = getHeaderSearchOpts().ModuleFormat;
auto *Writer = ThePCHContainerOperations->getWriterOrNull(Format);
if (!Writer) {
if (Diagnostics)
Diagnostics->Report(diag::err_module_format_unhandled) << Format;
llvm::report_fatal_error("unknown module format");
}
return *Writer;
}
/// Return the appropriate PCHContainerReader depending on the
/// current CodeGenOptions.
const PCHContainerReader &getPCHContainerReader() const {
assert(Invocation && "cannot determine module format without invocation");
StringRef Format = getHeaderSearchOpts().ModuleFormat;
auto *Reader = ThePCHContainerOperations->getReaderOrNull(Format);
if (!Reader) {
if (Diagnostics)
Diagnostics->Report(diag::err_module_format_unhandled) << Format;
llvm::report_fatal_error("unknown module format");
}
return *Reader;
}
/// }
/// @name Code Completion
/// {
@ -621,7 +649,7 @@ class CompilerInstance : public ModuleLoader {
static IntrusiveRefCntPtr<ASTReader> createPCHExternalASTSource(
StringRef Path, StringRef Sysroot, bool DisablePCHValidation,
bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
void *DeserializationListener, bool OwnDeserializationListener,
bool Preamble, bool UseGlobalModuleIndex);

View File

@ -11,6 +11,7 @@
#define LLVM_CLANG_PCH_CONTAINER_OPERATIONS_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/MemoryBuffer.h"
#include <memory>
@ -19,6 +20,8 @@ class raw_pwrite_stream;
class BitstreamReader;
}
using llvm::StringRef;
namespace clang {
class ASTConsumer;
@ -33,14 +36,16 @@ struct PCHBuffer {
bool IsComplete;
llvm::SmallVector<char, 0> Data;
};
/// This abstract interface provides operations for creating
/// containers for serialized ASTs (precompiled headers and clang
/// modules).
class PCHContainerWriter {
public:
virtual ~PCHContainerWriter() = 0;
virtual StringRef getFormat() const = 0;
/// \brief This abstract interface provides operations for creating
/// and unwrapping containers for serialized ASTs (precompiled headers
/// and clang modules).
class PCHContainerOperations {
public:
virtual ~PCHContainerOperations();
/// \brief Return an ASTConsumer that can be chained with a
/// Return an ASTConsumer that can be chained with a
/// PCHGenerator that produces a wrapper file format containing a
/// serialized AST bitstream.
virtual std::unique_ptr<ASTConsumer> CreatePCHContainerGenerator(
@ -49,16 +54,28 @@ class PCHContainerOperations {
const LangOptions &LO, const std::string &MainFileName,
const std::string &OutputFileName, llvm::raw_pwrite_stream *OS,
std::shared_ptr<PCHBuffer> Buffer) const = 0;
};
/// \brief Initialize an llvm::BitstreamReader with the serialized AST inside
/// This abstract interface provides operations for unwrapping
/// containers for serialized ASTs (precompiled headers and clang
/// modules).
class PCHContainerReader {
public:
virtual ~PCHContainerReader() = 0;
/// Equivalent to the format passed to -fmodule-format=
virtual StringRef getFormat() const = 0;
/// Initialize an llvm::BitstreamReader with the serialized AST inside
/// the PCH container Buffer.
virtual void ExtractPCH(llvm::MemoryBufferRef Buffer,
llvm::BitstreamReader &StreamFile) const = 0;
};
/// \brief Implements a raw pass-through PCH container.
class RawPCHContainerOperations : public PCHContainerOperations {
/// \brief Return an ASTConsumer that can be chained with a
/// Implements write operations for a raw pass-through PCH container.
class RawPCHContainerWriter : public PCHContainerWriter {
StringRef getFormat() const override { return "raw"; }
/// Return an ASTConsumer that can be chained with a
/// PCHGenerator that writes the module to a flat file.
std::unique_ptr<ASTConsumer> CreatePCHContainerGenerator(
DiagnosticsEngine &Diags, const HeaderSearchOptions &HSO,
@ -66,11 +83,42 @@ class RawPCHContainerOperations : public PCHContainerOperations {
const LangOptions &LO, const std::string &MainFileName,
const std::string &OutputFileName, llvm::raw_pwrite_stream *OS,
std::shared_ptr<PCHBuffer> Buffer) const override;
};
/// \brief Initialize an llvm::BitstreamReader with Buffer.
/// Implements read operations for a raw pass-through PCH container.
class RawPCHContainerReader : public PCHContainerReader {
StringRef getFormat() const override { return "raw"; }
/// Initialize an llvm::BitstreamReader with Buffer.
void ExtractPCH(llvm::MemoryBufferRef Buffer,
llvm::BitstreamReader &StreamFile) const override;
};
/// A registry of PCHContainerWriter and -Reader objects for different formats.
class PCHContainerOperations {
llvm::StringMap<std::unique_ptr<PCHContainerWriter>> Writers;
llvm::StringMap<std::unique_ptr<PCHContainerReader>> Readers;
public:
/// Automatically registers a RawPCHContainerWriter and
/// RawPCHContainerReader.
PCHContainerOperations();
void registerWriter(std::unique_ptr<PCHContainerWriter> Writer) {
Writers[Writer->getFormat()] = std::move(Writer);
}
void registerReader(std::unique_ptr<PCHContainerReader> Reader) {
Readers[Reader->getFormat()] = std::move(Reader);
}
const PCHContainerWriter *getWriterOrNull(StringRef Format) {
return Writers[Format].get();
}
const PCHContainerReader *getReaderOrNull(StringRef Format) {
return Readers[Format].get();
}
const PCHContainerReader &getRawReader() {
return *getReaderOrNull("raw");
}
};
}
#endif

View File

@ -45,7 +45,7 @@ class HeaderSearch;
class HeaderSearchOptions;
class IdentifierTable;
class LangOptions;
class PCHContainerOperations;
class PCHContainerReader;
class Preprocessor;
class PreprocessorOptions;
class PreprocessorOutputOptions;
@ -63,7 +63,7 @@ void ApplyHeaderSearchOptions(HeaderSearch &HS,
/// InitializePreprocessor - Initialize the preprocessor getting it and the
/// environment ready to process a single file.
void InitializePreprocessor(Preprocessor &PP, const PreprocessorOptions &PPOpts,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
const FrontendOptions &FEOpts);
/// DoPrintPreprocessedInput - Implement -E mode.

View File

@ -92,6 +92,9 @@ class HeaderSearchOptions : public RefCountedBase<HeaderSearchOptions> {
/// \brief The directory used for a user build.
std::string ModuleUserBuildPath;
/// The module/pch container format.
std::string ModuleFormat;
/// \brief Whether we should disable the use of the hash string within the
/// module cache.
///
@ -167,16 +170,14 @@ class HeaderSearchOptions : public RefCountedBase<HeaderSearchOptions> {
public:
HeaderSearchOptions(StringRef _Sysroot = "/")
: Sysroot(_Sysroot), DisableModuleHash(0), ImplicitModuleMaps(0),
ModuleMapFileHomeIsCwd(0),
ModuleCachePruneInterval(7*24*60*60),
ModuleCachePruneAfter(31*24*60*60),
BuildSessionTimestamp(0),
UseBuiltinIncludes(true),
UseStandardSystemIncludes(true), UseStandardCXXIncludes(true),
UseLibcxx(false), Verbose(false),
ModulesValidateOncePerBuildSession(false),
ModulesValidateSystemHeaders(false) {}
: Sysroot(_Sysroot), ModuleFormat("raw"), DisableModuleHash(0),
ImplicitModuleMaps(0), ModuleMapFileHomeIsCwd(0),
ModuleCachePruneInterval(7 * 24 * 60 * 60),
ModuleCachePruneAfter(31 * 24 * 60 * 60), BuildSessionTimestamp(0),
UseBuiltinIncludes(true), UseStandardSystemIncludes(true),
UseStandardCXXIncludes(true), UseLibcxx(false), Verbose(false),
ModulesValidateOncePerBuildSession(false),
ModulesValidateSystemHeaders(false) {}
/// AddPath - Add the \p Path path to the specified \p Group list.
void AddPath(StringRef Path, frontend::IncludeDirGroup Group,

View File

@ -108,12 +108,13 @@ class Parser : public CodeCompletionHandler {
/// Ident_super - IdentifierInfo for "super", to support fast
/// comparison.
IdentifierInfo *Ident_super;
/// Ident_vector, Ident_pixel, Ident_bool - cached IdentifierInfo's
/// for "vector", "pixel", and "bool" fast comparison. Only present
/// if AltiVec enabled.
/// Ident_vector, Ident_bool - cached IdentifierInfos for "vector" and
/// "bool" fast comparison. Only present if AltiVec or ZVector are enabled.
IdentifierInfo *Ident_vector;
IdentifierInfo *Ident_pixel;
IdentifierInfo *Ident_bool;
/// Ident_pixel - cached IdentifierInfos for "pixel" fast comparison.
/// Only present if AltiVec enabled.
IdentifierInfo *Ident_pixel;
/// Objective-C contextual keywords.
mutable IdentifierInfo *Ident_instancetype;
@ -605,10 +606,12 @@ class Parser : public CodeCompletionHandler {
bool TryAltiVecToken(DeclSpec &DS, SourceLocation Loc,
const char *&PrevSpec, unsigned &DiagID,
bool &isInvalid) {
if (!getLangOpts().AltiVec ||
(Tok.getIdentifierInfo() != Ident_vector &&
Tok.getIdentifierInfo() != Ident_pixel &&
Tok.getIdentifierInfo() != Ident_bool))
if (!getLangOpts().AltiVec && !getLangOpts().ZVector)
return false;
if (Tok.getIdentifierInfo() != Ident_vector &&
Tok.getIdentifierInfo() != Ident_bool &&
(!getLangOpts().AltiVec || Tok.getIdentifierInfo() != Ident_pixel))
return false;
return TryAltiVecTokenOutOfLine(DS, Loc, PrevSpec, DiagID, isInvalid);
@ -618,7 +621,7 @@ class Parser : public CodeCompletionHandler {
/// identifier token, replacing it with the non-context-sensitive __vector.
/// This returns true if the token was replaced.
bool TryAltiVecVectorToken() {
if (!getLangOpts().AltiVec ||
if ((!getLangOpts().AltiVec && !getLangOpts().ZVector) ||
Tok.getIdentifierInfo() != Ident_vector) return false;
return TryAltiVecVectorTokenOutOfLine();
}

View File

@ -729,27 +729,12 @@ class Sema {
/// \brief The declaration of the Objective-C NSArray class.
ObjCInterfaceDecl *NSArrayDecl;
/// \brief Pointer to NSMutableArray type (NSMutableArray *).
QualType NSMutableArrayPointer;
/// \brief The declaration of the arrayWithObjects:count: method.
ObjCMethodDecl *ArrayWithObjectsMethod;
/// \brief The declaration of the Objective-C NSDictionary class.
ObjCInterfaceDecl *NSDictionaryDecl;
/// \brief Pointer to NSMutableDictionary type (NSMutableDictionary *).
QualType NSMutableDictionaryPointer;
/// \brief Pointer to NSMutableSet type (NSMutableSet *).
QualType NSMutableSetPointer;
/// \brief Pointer to NSCountedSet type (NSCountedSet *).
QualType NSCountedSetPointer;
/// \brief Pointer to NSMutableOrderedSet type (NSMutableOrderedSet *).
QualType NSMutableOrderedSetPointer;
/// \brief The declaration of the dictionaryWithObjects:forKeys:count: method.
ObjCMethodDecl *DictionaryWithObjectsMethod;
@ -8363,7 +8348,8 @@ class Sema {
/// type checking for vector binary operators.
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS,
SourceLocation Loc, bool IsCompAssign);
SourceLocation Loc, bool IsCompAssign,
bool AllowBothBool, bool AllowBoolConversion);
QualType GetSignedVectorType(QualType V);
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS,
SourceLocation Loc, bool isRelational);

View File

@ -362,7 +362,7 @@ class ASTReader
SourceManager &SourceMgr;
FileManager &FileMgr;
const PCHContainerOperations &PCHContainerOps;
const PCHContainerReader &PCHContainerRdr;
DiagnosticsEngine &Diags;
/// \brief The semantic analysis object that will be processing the
@ -1289,7 +1289,7 @@ class ASTReader
/// \param ReadTimer If non-null, a timer used to track the time spent
/// deserializing.
ASTReader(Preprocessor &PP, ASTContext &Context,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
StringRef isysroot = "", bool DisableValidation = false,
bool AllowASTWithCompilerErrors = false,
bool AllowConfigurationMismatch = false,
@ -1458,7 +1458,7 @@ class ASTReader
/// the AST file, without actually loading the AST file.
static std::string
getOriginalSourceFile(const std::string &ASTFileName, FileManager &FileMgr,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
DiagnosticsEngine &Diags);
/// \brief Read the control block for the named AST file.
@ -1466,13 +1466,13 @@ class ASTReader
/// \returns true if an error occurred, false otherwise.
static bool
readASTFileControlBlock(StringRef Filename, FileManager &FileMgr,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
ASTReaderListener &Listener);
/// \brief Determine whether the given AST file is acceptable to load into a
/// translation unit with the given language and target options.
static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
const LangOptions &LangOpts,
const TargetOptions &TargetOpts,
const PreprocessorOptions &PPOpts,

View File

@ -198,10 +198,9 @@ class GlobalModuleIndex {
/// \param Path The path to the directory containing module files, into
/// which the global index will be written.
static ErrorCode writeIndex(FileManager &FileMgr,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
StringRef Path);
};
}
#endif

View File

@ -24,7 +24,7 @@ namespace clang {
class GlobalModuleIndex;
class ModuleMap;
class PCHContainerOperations;
class PCHContainerReader;
namespace serialization {
@ -52,7 +52,7 @@ class ModuleManager {
FileManager &FileMgr;
/// \brief Knows how to unwrap module containers.
const PCHContainerOperations &PCHContainerOps;
const PCHContainerReader &PCHContainerRdr;
/// \brief A lookup of in-memory (virtual file) buffers
llvm::DenseMap<const FileEntry *, std::unique_ptr<llvm::MemoryBuffer>>
@ -118,9 +118,9 @@ class ModuleManager {
typedef std::pair<uint32_t, StringRef> ModuleOffset;
explicit ModuleManager(FileManager &FileMgr,
const PCHContainerOperations &PCHContainerOps);
const PCHContainerReader &PCHContainerRdr);
~ModuleManager();
/// \brief Forward iterator to traverse all loaded modules. This is reverse
/// source-order.
ModuleIterator begin() { return Chain.begin(); }

View File

@ -40,7 +40,7 @@ class RefactoringTool : public ClangTool {
RefactoringTool(const CompilationDatabase &Compilations,
ArrayRef<std::string> SourcePaths,
std::shared_ptr<PCHContainerOperations> PCHContainerOps =
std::make_shared<RawPCHContainerOperations>());
std::make_shared<PCHContainerOperations>());
/// \brief Returns the set of replacements to which replacements should
/// be added during the run of the tool.

View File

@ -150,7 +150,7 @@ inline std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(
bool runToolOnCode(clang::FrontendAction *ToolAction, const Twine &Code,
const Twine &FileName = "input.cc",
std::shared_ptr<PCHContainerOperations> PCHContainerOps =
std::make_shared<RawPCHContainerOperations>());
std::make_shared<PCHContainerOperations>());
/// The first part of the pair is the filename, the second part the
/// file-content.
@ -171,7 +171,7 @@ bool runToolOnCodeWithArgs(
clang::FrontendAction *ToolAction, const Twine &Code,
const std::vector<std::string> &Args, const Twine &FileName = "input.cc",
std::shared_ptr<PCHContainerOperations> PCHContainerOps =
std::make_shared<RawPCHContainerOperations>(),
std::make_shared<PCHContainerOperations>(),
const FileContentMappings &VirtualMappedFiles = FileContentMappings());
/// \brief Builds an AST for 'Code'.
@ -185,7 +185,7 @@ bool runToolOnCodeWithArgs(
std::unique_ptr<ASTUnit>
buildASTFromCode(const Twine &Code, const Twine &FileName = "input.cc",
std::shared_ptr<PCHContainerOperations> PCHContainerOps =
std::make_shared<RawPCHContainerOperations>());
std::make_shared<PCHContainerOperations>());
/// \brief Builds an AST for 'Code' with additional flags.
///
@ -200,7 +200,7 @@ std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs(
const Twine &Code, const std::vector<std::string> &Args,
const Twine &FileName = "input.cc",
std::shared_ptr<PCHContainerOperations> PCHContainerOps =
std::make_shared<RawPCHContainerOperations>());
std::make_shared<PCHContainerOperations>());
/// \brief Utility to run a FrontendAction in a single clang invocation.
class ToolInvocation {
@ -219,7 +219,7 @@ class ToolInvocation {
ToolInvocation(std::vector<std::string> CommandLine, FrontendAction *FAction,
FileManager *Files,
std::shared_ptr<PCHContainerOperations> PCHContainerOps =
std::make_shared<RawPCHContainerOperations>());
std::make_shared<PCHContainerOperations>());
/// \brief Create a tool invocation.
///
@ -288,7 +288,7 @@ class ClangTool {
ClangTool(const CompilationDatabase &Compilations,
ArrayRef<std::string> SourcePaths,
std::shared_ptr<PCHContainerOperations> PCHContainerOps =
std::make_shared<RawPCHContainerOperations>());
std::make_shared<PCHContainerOperations>());
~ClangTool();

View File

@ -167,7 +167,7 @@ static bool HasARCRuntime(CompilerInvocation &origCI) {
static CompilerInvocation *
createInvocationForMigration(CompilerInvocation &origCI,
const PCHContainerOperations &PCHContainerOps) {
const PCHContainerReader &PCHContainerRdr) {
std::unique_ptr<CompilerInvocation> CInvok;
CInvok.reset(new CompilerInvocation(origCI));
PreprocessorOptions &PPOpts = CInvok->getPreprocessorOpts();
@ -180,7 +180,7 @@ createInvocationForMigration(CompilerInvocation &origCI,
new DiagnosticsEngine(DiagID, &origCI.getDiagnosticOpts(),
new IgnoringDiagConsumer()));
std::string OriginalFile = ASTReader::getOriginalSourceFile(
PPOpts.ImplicitPCHInclude, FileMgr, PCHContainerOps, *Diags);
PPOpts.ImplicitPCHInclude, FileMgr, PCHContainerRdr, *Diags);
if (!OriginalFile.empty())
PPOpts.Includes.insert(PPOpts.Includes.begin(), OriginalFile);
PPOpts.ImplicitPCHInclude.clear();
@ -247,7 +247,8 @@ bool arcmt::checkForManualIssues(
assert(!transforms.empty());
std::unique_ptr<CompilerInvocation> CInvok;
CInvok.reset(createInvocationForMigration(origCI, *PCHContainerOps));
CInvok.reset(
createInvocationForMigration(origCI, PCHContainerOps->getRawReader()));
CInvok->getFrontendOpts().Inputs.clear();
CInvok->getFrontendOpts().Inputs.push_back(Input);
@ -517,7 +518,8 @@ MigrationProcess::MigrationProcess(
bool MigrationProcess::applyTransform(TransformFn trans,
RewriteListener *listener) {
std::unique_ptr<CompilerInvocation> CInvok;
CInvok.reset(createInvocationForMigration(OrigCI, *PCHContainerOps));
CInvok.reset(
createInvocationForMigration(OrigCI, PCHContainerOps->getRawReader()));
CInvok->getDiagnosticOpts().IgnoreWarnings = true;
Remapper.applyMappings(CInvok->getPreprocessorOpts());

View File

@ -9,6 +9,7 @@
#include "clang/AST/NSAPI.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "llvm/ADT/StringSwitch.h"
@ -29,7 +30,6 @@ IdentifierInfo *NSAPI::getNSClassId(NSClassIdKindKind K) const {
"NSMutableDictionary",
"NSNumber",
"NSMutableSet",
"NSCountedSet",
"NSMutableOrderedSet",
"NSValue"
};
@ -511,6 +511,26 @@ bool NSAPI::isMacroDefined(StringRef Id) const {
return Ctx.Idents.get(Id).hasMacroDefinition();
}
bool NSAPI::isSubclassOfNSClass(ObjCInterfaceDecl *InterfaceDecl,
NSClassIdKindKind NSClassKind) const {
if (!InterfaceDecl) {
return false;
}
IdentifierInfo *NSClassID = getNSClassId(NSClassKind);
bool IsSubclass = false;
do {
IsSubclass = NSClassID == InterfaceDecl->getIdentifier();
if (IsSubclass) {
break;
}
} while ((InterfaceDecl = InterfaceDecl->getSuperClass()));
return IsSubclass;
}
bool NSAPI::isObjCTypedef(QualType T,
StringRef name, IdentifierInfo *&II) const {
if (!Ctx.getLangOpts().ObjC1)

View File

@ -435,17 +435,19 @@ TypeLoc NestedNameSpecifierLoc::getTypeLoc() const {
namespace {
void Append(char *Start, char *End, char *&Buffer, unsigned &BufferSize,
unsigned &BufferCapacity) {
if (Start == End)
return;
if (BufferSize + (End - Start) > BufferCapacity) {
// Reallocate the buffer.
unsigned NewCapacity
= std::max((unsigned)(BufferCapacity? BufferCapacity * 2
: sizeof(void*) * 2),
(unsigned)(BufferSize + (End - Start)));
unsigned NewCapacity = std::max(
(unsigned)(BufferCapacity ? BufferCapacity * 2 : sizeof(void *) * 2),
(unsigned)(BufferSize + (End - Start)));
char *NewBuffer = static_cast<char *>(malloc(NewCapacity));
memcpy(NewBuffer, Buffer, BufferSize);
if (BufferCapacity)
if (BufferCapacity) {
memcpy(NewBuffer, Buffer, BufferSize);
free(Buffer);
}
Buffer = NewBuffer;
BufferCapacity = NewCapacity;
}

View File

@ -2014,6 +2014,12 @@ static const CXXMethodDecl *computeKeyFunction(ASTContext &Context,
continue;
}
// If the key function is dllimport but the class isn't, then the class has
// no key function. The DLL that exports the key function won't export the
// vtable in this case.
if (MD->hasAttr<DLLImportAttr>() && !RD->hasAttr<DLLImportAttr>())
return nullptr;
// We found it.
return MD;
}

View File

@ -724,6 +724,8 @@ MSAsmStmt::MSAsmStmt(const ASTContext &C, SourceLocation asmloc,
}
static StringRef copyIntoContext(const ASTContext &C, StringRef str) {
if (str.empty())
return StringRef();
size_t size = str.size();
char *buffer = new (C) char[size];
memcpy(buffer, str.data(), size);
@ -1499,6 +1501,12 @@ void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
std::copy(A.begin(), A.end(), getCounters().begin());
}
void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
assert(A.size() == getCollapsedNumber() &&
"Number of counter inits is not the same as the collapsed number");
std::copy(A.begin(), A.end(), getInits().begin());
}
void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
assert(A.size() == getCollapsedNumber() &&
"Number of counter updates is not the same as the collapsed number");
@ -1664,6 +1672,7 @@ OMPSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
Dir->setInit(Exprs.Init);
Dir->setInc(Exprs.Inc);
Dir->setCounters(Exprs.Counters);
Dir->setInits(Exprs.Inits);
Dir->setUpdates(Exprs.Updates);
Dir->setFinals(Exprs.Finals);
return Dir;
@ -1710,6 +1719,7 @@ OMPForDirective::Create(const ASTContext &C, SourceLocation StartLoc,
Dir->setNextLowerBound(Exprs.NLB);
Dir->setNextUpperBound(Exprs.NUB);
Dir->setCounters(Exprs.Counters);
Dir->setInits(Exprs.Inits);
Dir->setUpdates(Exprs.Updates);
Dir->setFinals(Exprs.Finals);
return Dir;
@ -1756,6 +1766,7 @@ OMPForSimdDirective::Create(const ASTContext &C, SourceLocation StartLoc,
Dir->setNextLowerBound(Exprs.NLB);
Dir->setNextUpperBound(Exprs.NUB);
Dir->setCounters(Exprs.Counters);
Dir->setInits(Exprs.Inits);
Dir->setUpdates(Exprs.Updates);
Dir->setFinals(Exprs.Finals);
return Dir;
@ -1911,6 +1922,7 @@ OMPParallelForDirective *OMPParallelForDirective::Create(
Dir->setNextLowerBound(Exprs.NLB);
Dir->setNextUpperBound(Exprs.NUB);
Dir->setCounters(Exprs.Counters);
Dir->setInits(Exprs.Inits);
Dir->setUpdates(Exprs.Updates);
Dir->setFinals(Exprs.Finals);
return Dir;
@ -1955,6 +1967,7 @@ OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
Dir->setNextLowerBound(Exprs.NLB);
Dir->setNextUpperBound(Exprs.NUB);
Dir->setCounters(Exprs.Counters);
Dir->setInits(Exprs.Inits);
Dir->setUpdates(Exprs.Updates);
Dir->setFinals(Exprs.Finals);
return Dir;

View File

@ -587,4 +587,6 @@ void FileManager::PrintStats() const {
//llvm::errs() << PagesMapped << BytesOfPagesMapped << FSLookups;
}
PCHContainerOperations::~PCHContainerOperations() {}
// Virtual destructors for abstract base classes that need live in Basic.
PCHContainerWriter::~PCHContainerWriter() {}
PCHContainerReader::~PCHContainerReader() {}

View File

@ -110,7 +110,8 @@ namespace {
HALFSUPPORT = 0x08000,
KEYCONCEPTS = 0x10000,
KEYOBJC2 = 0x20000,
KEYALL = (0x3ffff & ~KEYNOMS18 &
KEYZVECTOR = 0x40000,
KEYALL = (0x7ffff & ~KEYNOMS18 &
~KEYNOOPENCL) // KEYNOMS18 and KEYNOOPENCL are used to exclude.
};

View File

@ -67,6 +67,7 @@ static bool hasFeature(StringRef Feature, const LangOptions &LangOpts,
.Case("objc_arc", LangOpts.ObjCAutoRefCount)
.Case("opencl", LangOpts.OpenCL)
.Case("tls", Target.isTLSSupported())
.Case("zvector", LangOpts.ZVector)
.Default(Target.hasFeature(Feature));
if (!HasFeature)
HasFeature = std::find(LangOpts.ModuleFeatures.begin(),

View File

@ -4978,7 +4978,6 @@ class AArch64TargetInfo : public TargetInfo {
LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
MaxVectorAlign = 128;
RegParmMax = 8;
MaxAtomicInlineWidth = 128;
MaxAtomicPromoteWidth = 128;
@ -5726,6 +5725,8 @@ class SystemZTargetInfo : public TargetInfo {
Builder.defineMacro("__LONG_DOUBLE_128__");
if (HasTransactionalExecution)
Builder.defineMacro("__HTM__");
if (Opts.ZVector)
Builder.defineMacro("__VEC__", "10301");
}
void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const override {
@ -6967,6 +6968,10 @@ class AndroidX86_64TargetInfo : public LinuxTargetInfo<X86_64TargetInfo> {
: LinuxTargetInfo<X86_64TargetInfo>(Triple) {
LongDoubleFormat = &llvm::APFloat::IEEEquad;
}
bool useFloat128ManglingForLongDouble() const override {
return true;
}
};
} // end anonymous namespace
@ -7037,11 +7042,10 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple) {
return new NaClTargetInfo<ARMleTargetInfo>(Triple);
case llvm::Triple::Win32:
switch (Triple.getEnvironment()) {
default:
return new ARMleTargetInfo(Triple);
case llvm::Triple::Itanium:
return new ItaniumWindowsARMleTargetInfo(Triple);
case llvm::Triple::MSVC:
default: // Assume MSVC for unknown environments
return new MicrosoftARMleTargetInfo(Triple);
}
default:
@ -7296,14 +7300,13 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple) {
return new SolarisTargetInfo<X86_32TargetInfo>(Triple);
case llvm::Triple::Win32: {
switch (Triple.getEnvironment()) {
default:
return new X86_32TargetInfo(Triple);
case llvm::Triple::Cygnus:
return new CygwinX86_32TargetInfo(Triple);
case llvm::Triple::GNU:
return new MinGWX86_32TargetInfo(Triple);
case llvm::Triple::Itanium:
case llvm::Triple::MSVC:
default: // Assume MSVC for unknown environments
return new MicrosoftX86_32TargetInfo(Triple);
}
}
@ -7348,11 +7351,10 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple) {
return new SolarisTargetInfo<X86_64TargetInfo>(Triple);
case llvm::Triple::Win32: {
switch (Triple.getEnvironment()) {
default:
return new X86_64TargetInfo(Triple);
case llvm::Triple::GNU:
return new MinGWX86_64TargetInfo(Triple);
case llvm::Triple::MSVC:
default: // Assume MSVC for unknown environments
return new MicrosoftX86_64TargetInfo(Triple);
}
}

View File

@ -36,7 +36,7 @@ std::string getClangRepositoryPath() {
// If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us
// pick up a tag in an SVN export, for example.
StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/trunk/lib/Basic/Version.cpp $");
StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_370/final/lib/Basic/Version.cpp $");
if (URL.empty()) {
URL = SVNRepository.slice(SVNRepository.find(':'),
SVNRepository.find("/lib/Basic"));

View File

@ -866,14 +866,14 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
llvm::ConstantInt::get(Int32Ty, Offset)));
}
case Builtin::BI__builtin_return_address: {
Value *Depth = EmitScalarExpr(E->getArg(0));
Depth = Builder.CreateIntCast(Depth, Int32Ty, false);
Value *Depth =
CGM.EmitConstantExpr(E->getArg(0), getContext().UnsignedIntTy, this);
Value *F = CGM.getIntrinsic(Intrinsic::returnaddress);
return RValue::get(Builder.CreateCall(F, Depth));
}
case Builtin::BI__builtin_frame_address: {
Value *Depth = EmitScalarExpr(E->getArg(0));
Depth = Builder.CreateIntCast(Depth, Int32Ty, false);
Value *Depth =
CGM.EmitConstantExpr(E->getArg(0), getContext().UnsignedIntTy, this);
Value *F = CGM.getIntrinsic(Intrinsic::frameaddress);
return RValue::get(Builder.CreateCall(F, Depth));
}
@ -6238,6 +6238,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
// but less than two lanes, convert to shifting in zeroes.
if (ShiftVal > NumLaneElts) {
ShiftVal -= NumLaneElts;
Ops[1] = Ops[0];
Ops[0] = llvm::Constant::getNullValue(Ops[0]->getType());
}

View File

@ -484,8 +484,10 @@ class CGDebugInfo {
/// are concatenated.
StringRef internString(StringRef A, StringRef B = StringRef()) {
char *Data = DebugInfoNames.Allocate<char>(A.size() + B.size());
std::memcpy(Data, A.data(), A.size());
std::memcpy(Data + A.size(), B.data(), B.size());
if (!A.empty())
std::memcpy(Data, A.data(), A.size());
if (!B.empty())
std::memcpy(Data + A.size(), B.data(), B.size());
return StringRef(Data, A.size() + B.size());
}
};

View File

@ -1166,6 +1166,16 @@ static llvm::Constant *getMaskElt(llvm::ShuffleVectorInst *SVI, unsigned Idx,
return llvm::ConstantInt::get(I32Ty, Off+MV);
}
static llvm::Constant *getAsInt32(llvm::ConstantInt *C, llvm::Type *I32Ty) {
if (C->getBitWidth() != 32) {
assert(llvm::ConstantInt::isValueValidForType(I32Ty,
C->getZExtValue()) &&
"Index operand too large for shufflevector mask!");
return llvm::ConstantInt::get(I32Ty, C->getZExtValue());
}
return C;
}
Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
bool Ignore = TestAndClearIgnoreResultAssign();
(void)Ignore;
@ -1216,7 +1226,8 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
Value *LHS = nullptr, *RHS = nullptr;
if (CurIdx == 0) {
// insert into undef -> shuffle (src, undef)
Args.push_back(C);
// shufflemask must use an i32
Args.push_back(getAsInt32(C, CGF.Int32Ty));
Args.resize(ResElts, llvm::UndefValue::get(CGF.Int32Ty));
LHS = EI->getVectorOperand();

View File

@ -227,10 +227,22 @@ bool CodeGenFunction::EmitOMPCopyinClause(const OMPExecutableDirective &D) {
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
QualType Type = VD->getType();
if (CopiedVars.insert(VD->getCanonicalDecl()).second) {
// Get the address of the master variable.
auto *MasterAddr = VD->isStaticLocal()
? CGM.getStaticLocalDeclAddress(VD)
: CGM.GetAddrOfGlobal(VD);
// Get the address of the master variable. If we are emitting code with
// TLS support, the address is passed from the master as field in the
// captured declaration.
llvm::Value *MasterAddr;
if (getLangOpts().OpenMPUseTLS &&
getContext().getTargetInfo().isTLSSupported()) {
assert(CapturedStmtInfo->lookup(VD) &&
"Copyin threadprivates should have been captured!");
DeclRefExpr DRE(const_cast<VarDecl *>(VD), true, (*IRef)->getType(),
VK_LValue, (*IRef)->getExprLoc());
MasterAddr = EmitLValue(&DRE).getAddress();
} else {
MasterAddr = VD->isStaticLocal() ? CGM.getStaticLocalDeclAddress(VD)
: CGM.GetAddrOfGlobal(VD);
}
// Get the address of the threadprivate variable.
auto *PrivateAddr = EmitLValue(*IRef).getAddress();
if (CopiedVars.size() == 1) {
@ -686,27 +698,9 @@ static void emitPreCond(CodeGenFunction &CGF, const OMPLoopDirective &S,
{
CodeGenFunction::OMPPrivateScope PreCondScope(CGF);
emitPrivateLoopCounters(CGF, PreCondScope, S.counters());
const VarDecl *IVDecl =
cast<VarDecl>(cast<DeclRefExpr>(S.getIterationVariable())->getDecl());
bool IsRegistered = PreCondScope.addPrivate(IVDecl, [&]() -> llvm::Value *{
// Emit var without initialization.
auto VarEmission = CGF.EmitAutoVarAlloca(*IVDecl);
CGF.EmitAutoVarCleanups(VarEmission);
return VarEmission.getAllocatedAddress();
});
assert(IsRegistered && "counter already registered as private");
// Silence the warning about unused variable.
(void)IsRegistered;
(void)PreCondScope.Privatize();
// Initialize internal counter to 0 to calculate initial values of real
// counters.
LValue IV = CGF.EmitLValue(S.getIterationVariable());
CGF.EmitStoreOfScalar(
llvm::ConstantInt::getNullValue(
IV.getAddress()->getType()->getPointerElementType()),
CGF.EmitLValue(S.getIterationVariable()), /*isInit=*/true);
// Get initial values of real counters.
for (auto I : S.updates()) {
for (auto I : S.inits()) {
CGF.EmitIgnoredExpr(I);
}
}

View File

@ -56,6 +56,21 @@ static void setThunkVisibility(CodeGenModule &CGM, const CXXMethodDecl *MD,
CGM.setGlobalVisibility(Fn, MD);
}
static void setThunkProperties(CodeGenModule &CGM, const ThunkInfo &Thunk,
llvm::Function *ThunkFn, bool ForVTable,
GlobalDecl GD) {
CGM.setFunctionLinkage(GD, ThunkFn);
CGM.getCXXABI().setThunkLinkage(ThunkFn, ForVTable, GD,
!Thunk.Return.isEmpty());
// Set the right visibility.
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
setThunkVisibility(CGM, MD, Thunk, ThunkFn);
if (CGM.supportsCOMDAT() && ThunkFn->isWeakForLinker())
ThunkFn->setComdat(CGM.getModule().getOrInsertComdat(ThunkFn->getName()));
}
#ifndef NDEBUG
static bool similar(const ABIArgInfo &infoL, CanQualType typeL,
const ABIArgInfo &infoR, CanQualType typeR) {
@ -429,8 +444,7 @@ void CodeGenVTables::emitThunk(GlobalDecl GD, const ThunkInfo &Thunk,
return;
}
// Change the linkage.
CGM.setFunctionLinkage(GD, ThunkFn);
setThunkProperties(CGM, Thunk, ThunkFn, ForVTable, GD);
return;
}
@ -451,16 +465,7 @@ void CodeGenVTables::emitThunk(GlobalDecl GD, const ThunkInfo &Thunk,
CodeGenFunction(CGM).generateThunk(ThunkFn, FnInfo, GD, Thunk);
}
CGM.setFunctionLinkage(GD, ThunkFn);
CGM.getCXXABI().setThunkLinkage(ThunkFn, ForVTable, GD,
!Thunk.Return.isEmpty());
// Set the right visibility.
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
setThunkVisibility(CGM, MD, Thunk, ThunkFn);
if (CGM.supportsCOMDAT() && ThunkFn->isWeakForLinker())
ThunkFn->setComdat(CGM.getModule().getOrInsertComdat(ThunkFn->getName()));
setThunkProperties(CGM, Thunk, ThunkFn, ForVTable, GD);
}
void CodeGenVTables::maybeEmitThunkForVTable(GlobalDecl GD,

View File

@ -2420,10 +2420,13 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM,
// FIXME: this may need to be reconsidered if the key function
// changes.
// N.B. We must always emit the RTTI data ourselves if there exists a key
// function.
bool IsDLLImport = RD->hasAttr<DLLImportAttr>();
if (CGM.getVTables().isVTableExternal(RD))
return true;
return IsDLLImport ? false : true;
if (RD->hasAttr<DLLImportAttr>())
if (IsDLLImport)
return true;
}
@ -2653,8 +2656,15 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM,
const CXXRecordDecl *RD = cast<CXXRecordDecl>(Record->getDecl());
if (RD->hasAttr<WeakAttr>())
return llvm::GlobalValue::WeakODRLinkage;
if (RD->isDynamicClass())
return CGM.getVTableLinkage(RD);
if (RD->isDynamicClass()) {
llvm::GlobalValue::LinkageTypes LT = CGM.getVTableLinkage(RD);
// MinGW won't export the RTTI information when there is a key function.
// Make sure we emit our own copy instead of attempting to dllimport it.
if (RD->hasAttr<DLLImportAttr>() &&
llvm::GlobalValue::isAvailableExternallyLinkage(LT))
LT = llvm::GlobalValue::LinkOnceODRLinkage;
return LT;
}
}
return llvm::GlobalValue::LinkOnceODRLinkage;

View File

@ -156,7 +156,7 @@ class PCHContainerGenerator : public ASTConsumer {
} // namespace
std::unique_ptr<ASTConsumer>
ObjectFilePCHContainerOperations::CreatePCHContainerGenerator(
ObjectFilePCHContainerWriter::CreatePCHContainerGenerator(
DiagnosticsEngine &Diags, const HeaderSearchOptions &HSO,
const PreprocessorOptions &PPO, const TargetOptions &TO,
const LangOptions &LO, const std::string &MainFileName,
@ -166,7 +166,7 @@ ObjectFilePCHContainerOperations::CreatePCHContainerGenerator(
Diags, HSO, PPO, TO, LO, MainFileName, OutputFileName, OS, Buffer);
}
void ObjectFilePCHContainerOperations::ExtractPCH(
void ObjectFilePCHContainerReader::ExtractPCH(
llvm::MemoryBufferRef Buffer, llvm::BitstreamReader &StreamFile) const {
if (auto OF = llvm::object::ObjectFile::createObjectFile(Buffer)) {
auto *Obj = OF.get().get();

View File

@ -1858,13 +1858,20 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase,
Hi = Integer;
} else if (k >= BuiltinType::Bool && k <= BuiltinType::LongLong) {
Current = Integer;
} else if ((k == BuiltinType::Float || k == BuiltinType::Double) ||
(k == BuiltinType::LongDouble &&
getTarget().getTriple().isOSNaCl())) {
} else if (k == BuiltinType::Float || k == BuiltinType::Double) {
Current = SSE;
} else if (k == BuiltinType::LongDouble) {
Lo = X87;
Hi = X87Up;
const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat();
if (LDF == &llvm::APFloat::IEEEquad) {
Lo = SSE;
Hi = SSEUp;
} else if (LDF == &llvm::APFloat::x87DoubleExtended) {
Lo = X87;
Hi = X87Up;
} else if (LDF == &llvm::APFloat::IEEEdouble) {
Current = SSE;
} else
llvm_unreachable("unexpected long double representation!");
}
// FIXME: _Decimal32 and _Decimal64 are SSE.
// FIXME: _float128 and _Decimal128 are (SSE, SSEUp).
@ -1967,14 +1974,21 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase,
Current = Integer;
else if (Size <= 128)
Lo = Hi = Integer;
} else if (ET == getContext().FloatTy)
} else if (ET == getContext().FloatTy) {
Current = SSE;
else if (ET == getContext().DoubleTy ||
(ET == getContext().LongDoubleTy &&
getTarget().getTriple().isOSNaCl()))
} else if (ET == getContext().DoubleTy) {
Lo = Hi = SSE;
else if (ET == getContext().LongDoubleTy)
Current = ComplexX87;
} else if (ET == getContext().LongDoubleTy) {
const llvm::fltSemantics *LDF = &getTarget().getLongDoubleFormat();
if (LDF == &llvm::APFloat::IEEEquad)
Current = Memory;
else if (LDF == &llvm::APFloat::x87DoubleExtended)
Current = ComplexX87;
else if (LDF == &llvm::APFloat::IEEEdouble)
Lo = Hi = SSE;
else
llvm_unreachable("unexpected long double representation!");
}
// If this complex type crosses an eightbyte boundary then it
// should be split.
@ -2243,7 +2257,8 @@ llvm::Type *X86_64ABIInfo::GetByteVectorType(QualType Ty) const {
Ty = QualType(InnerTy, 0);
llvm::Type *IRType = CGT.ConvertType(Ty);
if(isa<llvm::VectorType>(IRType))
if (isa<llvm::VectorType>(IRType) ||
IRType->getTypeID() == llvm::Type::FP128TyID)
return IRType;
// We couldn't find the preferred IR vector type for 'Ty'.

View File

@ -20,12 +20,54 @@ using namespace clang::driver::toolchains;
using namespace clang;
using namespace llvm::opt;
namespace {
// Simplified from Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple.
bool findGccVersion(StringRef LibDir, std::string &GccLibDir,
std::string &Ver) {
Generic_GCC::GCCVersion Version = Generic_GCC::GCCVersion::Parse("0.0.0");
std::error_code EC;
for (llvm::sys::fs::directory_iterator LI(LibDir, EC), LE; !EC && LI != LE;
LI = LI.increment(EC)) {
StringRef VersionText = llvm::sys::path::filename(LI->path());
Generic_GCC::GCCVersion CandidateVersion =
Generic_GCC::GCCVersion::Parse(VersionText);
if (CandidateVersion.Major == -1)
continue;
if (CandidateVersion <= Version)
continue;
Ver = VersionText;
GccLibDir = LI->path();
}
return Ver.size();
}
}
void MinGW::findGccLibDir() {
llvm::SmallVector<llvm::SmallString<32>, 2> Archs;
Archs.emplace_back(getTriple().getArchName());
Archs[0] += "-w64-mingw32";
Archs.emplace_back("mingw32");
Arch = Archs[0].str();
// lib: Arch Linux, Ubuntu, Windows
// lib64: openSUSE Linux
for (StringRef CandidateLib : {"lib", "lib64"}) {
for (StringRef CandidateArch : Archs) {
llvm::SmallString<1024> LibDir(Base);
llvm::sys::path::append(LibDir, CandidateLib, "gcc", CandidateArch);
if (findGccVersion(LibDir, GccLibDir, Ver)) {
Arch = CandidateArch;
return;
}
}
}
}
MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
: ToolChain(D, Triple, Args) {
getProgramPaths().push_back(getDriver().getInstalledDir());
llvm::SmallString<1024> LibDir;
// In Windows there aren't any standard install locations, we search
// for gcc on the PATH. In Linux the base is always /usr.
#ifdef LLVM_ON_WIN32
if (getDriver().SysRoot.size())
Base = getDriver().SysRoot;
@ -35,45 +77,23 @@ MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
llvm::sys::path::parent_path(GPPName.get()));
else
Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
Base += llvm::sys::path::get_separator();
LibDir = Base;
llvm::sys::path::append(LibDir, "lib", "gcc");
#else
if (getDriver().SysRoot.size())
Base = getDriver().SysRoot;
else
Base = "/usr/";
LibDir = Base;
llvm::sys::path::append(LibDir, "lib64", "gcc");
Base = "/usr";
#endif
LibDir += llvm::sys::path::get_separator();
// First look for mingw-w64.
Arch = getTriple().getArchName();
Arch += "-w64-mingw32";
std::error_code EC;
llvm::sys::fs::directory_iterator MingW64Entry(LibDir + Arch, EC);
if (!EC) {
GccLibDir = MingW64Entry->path();
Ver = llvm::sys::path::filename(GccLibDir);
} else {
// If mingw-w64 not found, try looking for mingw.org.
Arch = "mingw32";
llvm::sys::fs::directory_iterator MingwOrgEntry(LibDir + Arch, EC);
if (!EC)
GccLibDir = MingwOrgEntry->path();
}
Arch += llvm::sys::path::get_separator();
Base += llvm::sys::path::get_separator();
findGccLibDir();
// GccLibDir must precede Base/lib so that the
// correct crtbegin.o ,cetend.o would be found.
getFilePaths().push_back(GccLibDir);
getFilePaths().push_back(
(Base + Arch + llvm::sys::path::get_separator() + "lib").str());
getFilePaths().push_back(Base + "lib");
getFilePaths().push_back(Base + Arch + "lib");
#ifdef LLVM_ON_UNIX
// For openSUSE.
getFilePaths().push_back(Base + Arch + "sys-root/mingw/lib");
#endif
// openSUSE
getFilePaths().push_back(Base + Arch + "/sys-root/mingw/lib");
}
bool MinGW::IsIntegratedAssemblerDefault() const { return true; }
@ -115,6 +135,58 @@ bool MinGW::UseSEHExceptions() const {
return getArch() == llvm::Triple::x86_64;
}
// Include directories for various hosts:
// Windows, mingw.org
// c:\mingw\lib\gcc\mingw32\4.8.1\include\c++
// c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\mingw32
// c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\backward
// c:\mingw\lib\gcc\mingw32\4.8.1\include
// c:\mingw\include
// c:\mingw\lib\gcc\mingw32\4.8.1\include-fixed
// c:\mingw\mingw32\include
// Windows, mingw-w64 mingw-builds
// c:\mingw32\lib\gcc\i686-w64-mingw32\4.9.1\include
// c:\mingw32\lib\gcc\i686-w64-mingw32\4.9.1\include-fixed
// c:\mingw32\i686-w64-mingw32\include
// c:\mingw32\i686-w64-mingw32\include\c++
// c:\mingw32\i686-w64-mingw32\include\c++\i686-w64-mingw32
// c:\mingw32\i686-w64-mingw32\include\c++\backward
// Windows, mingw-w64 msys2
// c:\msys64\mingw32\lib\gcc\i686-w64-mingw32\4.9.2\include
// c:\msys64\mingw32\include
// c:\msys64\mingw32\lib\gcc\i686-w64-mingw32\4.9.2\include-fixed
// c:\msys64\mingw32\i686-w64-mingw32\include
// c:\msys64\mingw32\include\c++\4.9.2
// c:\msys64\mingw32\include\c++\4.9.2\i686-w64-mingw32
// c:\msys64\mingw32\include\c++\4.9.2\backward
// openSUSE
// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++
// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++/x86_64-w64-mingw32
// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++/backward
// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include
// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include-fixed
// /usr/x86_64-w64-mingw32/sys-root/mingw/include
// Arch Linux
// /usr/i686-w64-mingw32/include/c++/5.1.0
// /usr/i686-w64-mingw32/include/c++/5.1.0/i686-w64-mingw32
// /usr/i686-w64-mingw32/include/c++/5.1.0/backward
// /usr/lib/gcc/i686-w64-mingw32/5.1.0/include
// /usr/lib/gcc/i686-w64-mingw32/5.1.0/include-fixed
// /usr/i686-w64-mingw32/include
// Ubuntu
// /usr/include/c++/4.8
// /usr/include/c++/4.8/x86_64-w64-mingw32
// /usr/include/c++/4.8/backward
// /usr/lib/gcc/x86_64-w64-mingw32/4.8/include
// /usr/lib/gcc/x86_64-w64-mingw32/4.8/include-fixed
// /usr/x86_64-w64-mingw32/include
void MinGW::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
if (DriverArgs.hasArg(options::OPT_nostdinc))
@ -129,17 +201,18 @@ void MinGW::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
if (DriverArgs.hasArg(options::OPT_nostdlibinc))
return;
llvm::SmallString<1024> IncludeDir(GccLibDir);
llvm::sys::path::append(IncludeDir, "include");
addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str());
IncludeDir += "-fixed";
#ifdef LLVM_ON_UNIX
// For openSUSE.
if (GetRuntimeLibType(DriverArgs) == ToolChain::RLT_Libgcc) {
llvm::SmallString<1024> IncludeDir(GccLibDir);
llvm::sys::path::append(IncludeDir, "include");
addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str());
IncludeDir += "-fixed";
// openSUSE
addSystemInclude(DriverArgs, CC1Args,
Base + Arch + "/sys-root/mingw/include");
addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str());
}
addSystemInclude(DriverArgs, CC1Args,
"/usr/x86_64-w64-mingw32/sys-root/mingw/include");
#endif
addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str());
addSystemInclude(DriverArgs, CC1Args, Base + Arch + "include");
Base + Arch + llvm::sys::path::get_separator() + "include");
addSystemInclude(DriverArgs, CC1Args, Base + "include");
}
@ -149,27 +222,29 @@ void MinGW::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
DriverArgs.hasArg(options::OPT_nostdincxx))
return;
// C++ includes may be found in several locations depending on distribution.
// Windows
// -------
// mingw-w64 mingw-builds: $sysroot/i686-w64-mingw32/include/c++.
// mingw-w64 msys2: $sysroot/include/c++/4.9.2
// mingw.org: GccLibDir/include/c++
//
// Linux
// -----
// openSUSE: GccLibDir/include/c++
llvm::SmallVector<llvm::SmallString<1024>, 3> CppIncludeBases;
CppIncludeBases.emplace_back(Base);
llvm::sys::path::append(CppIncludeBases[0], Arch, "include", "c++");
CppIncludeBases.emplace_back(Base);
llvm::sys::path::append(CppIncludeBases[1], "include", "c++", Ver);
CppIncludeBases.emplace_back(GccLibDir);
llvm::sys::path::append(CppIncludeBases[2], "include", "c++");
for (auto &CppIncludeBase : CppIncludeBases) {
CppIncludeBase += llvm::sys::path::get_separator();
addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch);
addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
switch (GetCXXStdlibType(DriverArgs)) {
case ToolChain::CST_Libcxx:
addSystemInclude(DriverArgs, CC1Args,
Base + "include" + llvm::sys::path::get_separator() +
"c++" + llvm::sys::path::get_separator() + "v1");
break;
case ToolChain::CST_Libstdcxx:
llvm::SmallVector<llvm::SmallString<1024>, 4> CppIncludeBases;
CppIncludeBases.emplace_back(Base);
llvm::sys::path::append(CppIncludeBases[0], Arch, "include", "c++");
CppIncludeBases.emplace_back(Base);
llvm::sys::path::append(CppIncludeBases[1], Arch, "include", "c++", Ver);
CppIncludeBases.emplace_back(Base);
llvm::sys::path::append(CppIncludeBases[2], "include", "c++", Ver);
CppIncludeBases.emplace_back(GccLibDir);
llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
for (auto &CppIncludeBase : CppIncludeBases) {
addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
CppIncludeBase += llvm::sys::path::get_separator();
addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch);
addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
}
break;
}
}

View File

@ -305,12 +305,17 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args,
// Thumb2 is the default for V7 on Darwin.
//
// FIXME: Thumb should just be another -target-feaure, not in the triple.
StringRef MCPU, MArch;
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
MCPU = A->getValue();
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
MArch = A->getValue();
std::string CPU = Triple.isOSBinFormatMachO()
? tools::arm::getARMCPUForMArch(Args, Triple)
: tools::arm::getARMTargetCPU(Args, Triple);
? tools::arm::getARMCPUForMArch(MArch, Triple)
: tools::arm::getARMTargetCPU(MCPU, MArch, Triple);
StringRef Suffix =
tools::arm::getLLVMArchSuffixForARM(CPU,
tools::arm::getARMArch(Args, Triple));
tools::arm::getARMArch(MArch, Triple));
bool ThumbDefault = Suffix.startswith("v6m") || Suffix.startswith("v7m") ||
Suffix.startswith("v7em") ||
(Suffix.startswith("v7") && getTriple().isOSBinFormatMachO());

View File

@ -29,7 +29,7 @@ namespace toolchains {
/// all subcommands; this relies on gcc translating the majority of
/// command line options.
class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain {
protected:
public:
/// \brief Struct to store and manipulate GCC versions.
///
/// We rely on assumptions about the form and structure of GCC version
@ -147,6 +147,7 @@ class LLVM_LIBRARY_VISIBILITY Generic_GCC : public ToolChain {
bool NeedsBiarchSuffix = false);
};
protected:
GCCInstallationDetector GCCInstallation;
public:
@ -556,6 +557,7 @@ class LLVM_LIBRARY_VISIBILITY MinGW : public ToolChain {
std::string Arch;
mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocessor;
mutable std::unique_ptr<tools::gcc::Compiler> Compiler;
void findGccLibDir();
};
class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {

View File

@ -502,11 +502,46 @@ static bool isNoCommonDefault(const llvm::Triple &Triple) {
}
}
// ARM tools start.
// Get SubArch (vN).
static int getARMSubArchVersionNumber(const llvm::Triple &Triple) {
llvm::StringRef Arch = Triple.getArchName();
return llvm::ARMTargetParser::parseArchVersion(Arch);
}
// True if M-profile.
static bool isARMMProfile(const llvm::Triple &Triple) {
llvm::StringRef Arch = Triple.getArchName();
unsigned Profile = llvm::ARMTargetParser::parseArchProfile(Arch);
return Profile == llvm::ARM::PK_M;
}
// Get Arch/CPU from args.
static void getARMArchCPUFromArgs(const ArgList &Args, llvm::StringRef &Arch,
llvm::StringRef &CPU, bool FromAs = false) {
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
CPU = A->getValue();
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
Arch = A->getValue();
if (!FromAs)
return;
for (const Arg *A :
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
StringRef Value = A->getValue();
if (Value.startswith("-mcpu="))
CPU = Value.substr(6);
if (Value.startswith("-march="))
Arch = Value.substr(7);
}
}
// Handle -mhwdiv=.
// FIXME: Use ARMTargetParser.
static void getARMHWDivFeatures(const Driver &D, const Arg *A,
const ArgList &Args,
const ArgList &Args, StringRef HWDiv,
std::vector<const char *> &Features) {
StringRef HWDiv = A->getValue();
if (HWDiv == "arm") {
Features.push_back("+hwdiv-arm");
Features.push_back("-hwdiv");
@ -525,23 +560,32 @@ static void getARMHWDivFeatures(const Driver &D, const Arg *A,
// Handle -mfpu=.
static void getARMFPUFeatures(const Driver &D, const Arg *A,
const ArgList &Args,
const ArgList &Args, StringRef FPU,
std::vector<const char *> &Features) {
StringRef FPU = A->getValue();
unsigned FPUID = llvm::ARMTargetParser::parseFPU(FPU);
if (!llvm::ARMTargetParser::getFPUFeatures(FPUID, Features))
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
}
static int getARMSubArchVersionNumber(const llvm::Triple &Triple) {
llvm::StringRef Arch = Triple.getArchName();
return llvm::ARMTargetParser::parseArchVersion(Arch);
// Check if -march is valid by checking if it can be canonicalised and parsed.
// getARMArch is used here instead of just checking the -march value in order
// to handle -march=native correctly.
static void checkARMArchName(const Driver &D, const Arg *A, const ArgList &Args,
llvm::StringRef ArchName,
const llvm::Triple &Triple) {
std::string MArch = arm::getARMArch(ArchName, Triple);
if (llvm::ARMTargetParser::parseArch(MArch) == llvm::ARM::AK_INVALID)
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
}
static bool isARMMProfile(const llvm::Triple &Triple) {
llvm::StringRef Arch = Triple.getArchName();
unsigned Profile = llvm::ARMTargetParser::parseArchProfile(Arch);
return Profile == llvm::ARM::PK_M;
// Check -mcpu=. Needs ArchName to handle -mcpu=generic.
static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
llvm::StringRef CPUName, llvm::StringRef ArchName,
const llvm::Triple &Triple) {
std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
std::string Arch = arm::getARMArch(ArchName, Triple);
if (strcmp(arm::getLLVMArchSuffixForARM(CPU, Arch), "") == 0)
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
}
// Select the float ABI as determined by -msoft-float, -mhard-float, and
@ -641,6 +685,9 @@ static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
bool KernelOrKext =
Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
StringRef FloatABI = tools::arm::getARMFloatABI(D, Args, Triple);
const Arg *WaCPU = nullptr, *WaFPU = nullptr;
const Arg *WaHDiv = nullptr, *WaArch = nullptr;
if (!ForAS) {
// FIXME: Note, this is a hack, the LLVM backend doesn't actually use these
// yet (it uses the -mfloat-abi and -msoft-float options), and it is
@ -661,31 +708,75 @@ static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
// Use software floating point argument passing?
if (FloatABI != "hard")
Features.push_back("+soft-float-abi");
} else {
// Here, we make sure that -Wa,-mfpu/cpu/arch/hwdiv will be passed down
// to the assembler correctly.
for (const Arg *A :
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
StringRef Value = A->getValue();
if (Value.startswith("-mfpu=")) {
WaFPU = A;
} else if (Value.startswith("-mcpu=")) {
WaCPU = A;
} else if (Value.startswith("-mhwdiv=")) {
WaHDiv = A;
} else if (Value.startswith("-march=")) {
WaArch = A;
}
}
}
// Honor -mfpu=.
if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ))
getARMFPUFeatures(D, A, Args, Features);
if (const Arg *A = Args.getLastArg(options::OPT_mhwdiv_EQ))
getARMHWDivFeatures(D, A, Args, Features);
// Check if -march is valid by checking if it can be canonicalised and parsed.
// getARMArch is used here instead of just checking the -march value in order
// to handle -march=native correctly.
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
std::string Arch = arm::getARMArch(Args, Triple);
if (llvm::ARMTargetParser::parseArch(Arch) == llvm::ARM::AK_INVALID)
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
// Honor -mfpu=. ClangAs gives preference to -Wa,-mfpu=.
const Arg *FPUArg = Args.getLastArg(options::OPT_mfpu_EQ);
if (WaFPU) {
if (FPUArg)
D.Diag(clang::diag::warn_drv_unused_argument)
<< FPUArg->getAsString(Args);
getARMFPUFeatures(D, WaFPU, Args, StringRef(WaFPU->getValue()).substr(6),
Features);
} else if (FPUArg) {
getARMFPUFeatures(D, FPUArg, Args, FPUArg->getValue(), Features);
}
// We do a similar thing with -mcpu, but here things are complicated because
// the only function we have to check if a cpu is valid is
// getLLVMArchSuffixForARM which also needs an architecture.
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
std::string CPU = arm::getARMTargetCPU(Args, Triple);
std::string Arch = arm::getARMArch(Args, Triple);
if (strcmp(arm::getLLVMArchSuffixForARM(CPU, Arch), "") == 0)
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
// Honor -mhwdiv=. ClangAs gives preference to -Wa,-mhwdiv=.
const Arg *HDivArg = Args.getLastArg(options::OPT_mhwdiv_EQ);
if (WaHDiv) {
if (HDivArg)
D.Diag(clang::diag::warn_drv_unused_argument)
<< HDivArg->getAsString(Args);
getARMHWDivFeatures(D, WaHDiv, Args,
StringRef(WaHDiv->getValue()).substr(8), Features);
} else if (HDivArg)
getARMHWDivFeatures(D, HDivArg, Args, HDivArg->getValue(), Features);
// Check -march. ClangAs gives preference to -Wa,-march=.
const Arg *ArchArg = Args.getLastArg(options::OPT_march_EQ);
StringRef ArchName;
if (WaArch) {
if (ArchArg)
D.Diag(clang::diag::warn_drv_unused_argument)
<< ArchArg->getAsString(Args);
ArchName = StringRef(WaArch->getValue()).substr(7);
checkARMArchName(D, WaArch, Args, ArchName, Triple);
// FIXME: Set Arch.
D.Diag(clang::diag::warn_drv_unused_argument) << WaArch->getAsString(Args);
} else if (ArchArg) {
ArchName = ArchArg->getValue();
checkARMArchName(D, ArchArg, Args, ArchName, Triple);
}
// Check -mcpu. ClangAs gives preference to -Wa,-mcpu=.
const Arg *CPUArg = Args.getLastArg(options::OPT_mcpu_EQ);
StringRef CPUName;
if (WaCPU) {
if (CPUArg)
D.Diag(clang::diag::warn_drv_unused_argument)
<< CPUArg->getAsString(Args);
CPUName = StringRef(WaCPU->getValue()).substr(6);
checkARMCPUName(D, WaCPU, Args, CPUName, ArchName, Triple);
} else if (CPUArg) {
CPUName = CPUArg->getValue();
checkARMCPUName(D, CPUArg, Args, CPUName, ArchName, Triple);
}
// Setting -msoft-float effectively disables NEON because of the GCC
@ -836,6 +927,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args, ArgStringList &CmdArgs,
CmdArgs.push_back("-arm-reserve-r9");
}
}
// ARM tools end.
/// getAArch64TargetCPU - Get the (LLVM) name of the AArch64 cpu we are
/// targeting.
@ -1463,7 +1555,8 @@ static const char *getX86TargetCPU(const ArgList &Args,
}
}
static std::string getCPUName(const ArgList &Args, const llvm::Triple &T) {
static std::string getCPUName(const ArgList &Args, const llvm::Triple &T,
bool FromAs = false) {
switch (T.getArch()) {
default:
return "";
@ -1475,9 +1568,11 @@ static std::string getCPUName(const ArgList &Args, const llvm::Triple &T) {
case llvm::Triple::arm:
case llvm::Triple::armeb:
case llvm::Triple::thumb:
case llvm::Triple::thumbeb:
return arm::getARMTargetCPU(Args, T);
case llvm::Triple::thumbeb: {
StringRef MArch, MCPU;
getARMArchCPUFromArgs(Args, MArch, MCPU, FromAs);
return arm::getARMTargetCPU(MCPU, MArch, T);
}
case llvm::Triple::mips:
case llvm::Triple::mipsel:
case llvm::Triple::mips64:
@ -2198,12 +2293,12 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
A->claim();
for (const StringRef Value : A->getValues()) {
if (TakeNextArg) {
CmdArgs.push_back(Value.data());
TakeNextArg = false;
continue;
}
for (const StringRef Value : A->getValues()) {
if (TakeNextArg) {
CmdArgs.push_back(Value.data());
TakeNextArg = false;
continue;
}
if (Value == "-force_cpusubtype_ALL") {
// Do nothing, this is the default and we don't support anything else.
@ -2227,6 +2322,9 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
TakeNextArg = true;
} else if (Value.startswith("-gdwarf-")) {
CmdArgs.push_back(Value.data());
} else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") ||
Value.startswith("-mhwdiv") || Value.startswith("-march")) {
// Do nothing, we'll validate it later.
} else {
D.Diag(diag::err_drv_unsupported_option_argument)
<< A->getOption().getName() << Value;
@ -2243,8 +2341,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
// Until ARM libraries are build separately, we have them all in one library
static StringRef getArchNameForCompilerRTLib(const ToolChain &TC) {
if (TC.getTriple().isOSWindows() &&
!TC.getTriple().isWindowsItaniumEnvironment() &&
if (TC.getTriple().isWindowsMSVCEnvironment() &&
TC.getArch() == llvm::Triple::x86)
return "i386";
if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
@ -2270,10 +2367,12 @@ SmallString<128> tools::getCompilerRT(const ToolChain &TC, StringRef Component,
: "";
bool IsOSWindows = TC.getTriple().isOSWindows();
bool IsITANMSVCWindows = TC.getTriple().isWindowsMSVCEnvironment() ||
TC.getTriple().isWindowsItaniumEnvironment();
StringRef Arch = getArchNameForCompilerRTLib(TC);
const char *Prefix = IsOSWindows ? "" : "lib";
const char *Prefix = IsITANMSVCWindows ? "" : "lib";
const char *Suffix =
Shared ? (IsOSWindows ? ".dll" : ".so") : (IsOSWindows ? ".lib" : ".a");
Shared ? (IsOSWindows ? ".dll" : ".so") : (IsITANMSVCWindows ? ".lib" : ".a");
SmallString<128> Path = getCompilerRTLibDir(TC);
llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
@ -2750,8 +2849,7 @@ static void addPGOAndCoverageFlags(Compilation &C, const Driver &D,
if (ProfileGenerateArg && ProfileUseArg)
D.Diag(diag::err_drv_argument_not_allowed_with)
<< ProfileGenerateArg->getSpelling()
<< ProfileUseArg->getSpelling();
<< ProfileGenerateArg->getSpelling() << ProfileUseArg->getSpelling();
if (ProfileGenerateArg &&
ProfileGenerateArg->getOption().matches(
@ -2907,8 +3005,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
assert((isa<CompileJobAction>(JA) || isa<BackendJobAction>(JA)) &&
"Invalid action for clang tool.");
if (JA.getType() == types::TY_LTO_IR ||
JA.getType() == types::TY_LTO_BC) {
if (JA.getType() == types::TY_LTO_IR || JA.getType() == types::TY_LTO_BC) {
CmdArgs.push_back("-flto");
}
if (JA.getType() == types::TY_Nothing) {
@ -3434,7 +3531,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
// Add the target cpu
std::string CPU = getCPUName(Args, Triple);
std::string CPU = getCPUName(Args, Triple, /*FromAs*/ false);
if (!CPU.empty()) {
CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(Args.MakeArgString(CPU));
@ -3952,9 +4049,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddLastArg(CmdArgs, options::OPT_fstandalone_debug);
Args.AddLastArg(CmdArgs, options::OPT_fno_standalone_debug);
Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
// AltiVec language extensions aren't relevant for assembling.
if (!isa<PreprocessJobAction>(JA) || Output.getType() != types::TY_PP_Asm)
// AltiVec-like language extensions aren't relevant for assembling.
if (!isa<PreprocessJobAction>(JA) || Output.getType() != types::TY_PP_Asm) {
Args.AddLastArg(CmdArgs, options::OPT_faltivec);
Args.AddLastArg(CmdArgs, options::OPT_fzvector);
}
Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_show_template_tree);
Args.AddLastArg(CmdArgs, options::OPT_fno_elide_type);
@ -3999,6 +4098,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
<< "ppc/ppc64/ppc64le";
}
// -fzvector is incompatible with -faltivec.
if (Arg *A = Args.getLastArg(options::OPT_fzvector))
if (Args.hasArg(options::OPT_faltivec))
D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args)
<< "-faltivec";
if (getToolChain().SupportsProfiling())
Args.AddLastArg(CmdArgs, options::OPT_pg);
@ -4234,8 +4339,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
llvm::sys::path::append(Path, "modules");
} else if (Path.empty()) {
// No module path was provided: use the default.
llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/false,
Path);
llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/false, Path);
llvm::sys::path::append(Path, "org.llvm.clang.");
appendUserToPath(Path);
llvm::sys::path::append(Path, "ModuleCache");
@ -5270,7 +5374,7 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
// Add the target cpu
const llvm::Triple Triple(TripleStr);
std::string CPU = getCPUName(Args, Triple);
std::string CPU = getCPUName(Args, Triple, /*FromAs*/ true);
if (!CPU.empty()) {
CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(Args.MakeArgString(CPU));
@ -5775,16 +5879,12 @@ void hexagon::Linker::ConstructJob(Compilation &C, const JobAction &JA,
}
// Hexagon tools end.
const std::string arm::getARMArch(const ArgList &Args,
const llvm::Triple &Triple) {
const std::string arm::getARMArch(StringRef Arch, const llvm::Triple &Triple) {
std::string MArch;
if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
// Otherwise, if we have -march= choose the base CPU for that arch.
MArch = A->getValue();
} else {
// Otherwise, use the Arch from the triple.
if (!Arch.empty())
MArch = Arch;
else
MArch = Triple.getArchName();
}
MArch = StringRef(MArch).lower();
// Handle -march=native.
@ -5805,9 +5905,8 @@ const std::string arm::getARMArch(const ArgList &Args,
return MArch;
}
/// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
const char *arm::getARMCPUForMArch(const ArgList &Args,
const llvm::Triple &Triple) {
std::string MArch = getARMArch(Args, Triple);
const char *arm::getARMCPUForMArch(StringRef Arch, const llvm::Triple &Triple) {
std::string MArch = getARMArch(Arch, Triple);
// getARMCPUForArch defaults to the triple if MArch is empty, but empty MArch
// here means an -march=native that we can't handle, so instead return no CPU.
if (MArch.empty())
@ -5823,12 +5922,12 @@ const char *arm::getARMCPUForMArch(const ArgList &Args,
}
/// getARMTargetCPU - Get the (LLVM) name of the ARM cpu we are targeting.
std::string arm::getARMTargetCPU(const ArgList &Args,
std::string arm::getARMTargetCPU(StringRef CPU, StringRef Arch,
const llvm::Triple &Triple) {
// FIXME: Warn on inconsistent use of -mcpu and -march.
// If we have -mcpu=, use that.
if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
std::string MCPU = StringRef(A->getValue()).lower();
if (!CPU.empty()) {
std::string MCPU = StringRef(CPU).lower();
// Handle -mcpu=native.
if (MCPU == "native")
return llvm::sys::getHostCPUName();
@ -5836,7 +5935,7 @@ std::string arm::getARMTargetCPU(const ArgList &Args,
return MCPU;
}
return getARMCPUForMArch(Args, Triple);
return getARMCPUForMArch(Arch, Triple);
}
/// getLLVMArchSuffixForARM - Get the LLVM arch name to use for a particular
@ -7335,8 +7434,11 @@ void netbsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
case llvm::Triple::armeb:
case llvm::Triple::thumb:
case llvm::Triple::thumbeb: {
std::string MArch = arm::getARMTargetCPU(Args, getToolChain().getTriple());
CmdArgs.push_back(Args.MakeArgString("-mcpu=" + MArch));
StringRef MArch, MCPU;
getARMArchCPUFromArgs(Args, MArch, MCPU, /*FromAs*/ true);
std::string Arch =
arm::getARMTargetCPU(MCPU, MArch, getToolChain().getTriple());
CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch));
break;
}
@ -7816,6 +7918,7 @@ void gnutools::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,
ArgStringList &CmdArgs, const ArgList &Args) {
bool isAndroid = Triple.getEnvironment() == llvm::Triple::Android;
bool isCygMing = Triple.isOSCygMing();
bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) ||
Args.hasArg(options::OPT_static);
if (!D.CCCIsCXX())
@ -7825,10 +7928,10 @@ static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,
if (D.CCCIsCXX())
CmdArgs.push_back("-lgcc");
} else {
if (!D.CCCIsCXX())
if (!D.CCCIsCXX() && !isCygMing)
CmdArgs.push_back("--as-needed");
CmdArgs.push_back("-lgcc_s");
if (!D.CCCIsCXX())
if (!D.CCCIsCXX() && !isCygMing)
CmdArgs.push_back("--no-as-needed");
}
@ -7863,13 +7966,15 @@ static std::string getLinuxDynamicLinker(const ArgList &Args,
else if (Arch == llvm::Triple::aarch64_be)
return "/lib/ld-linux-aarch64_be.so.1";
else if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) {
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
tools::arm::getARMFloatABI(ToolChain.getDriver(), Args, ToolChain.getTriple()) == "hard")
return "/lib/ld-linux-armhf.so.3";
else
return "/lib/ld-linux.so.3";
} else if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb) {
// TODO: check which dynamic linker name.
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
tools::arm::getARMFloatABI(ToolChain.getDriver(), Args, ToolChain.getTriple()) == "hard")
return "/lib/ld-linux-armhf.so.3";
else
return "/lib/ld-linux.so.3";
@ -8910,15 +9015,10 @@ void MinGW::Linker::AddLibGCC(const ArgList &Args,
if (Args.hasArg(options::OPT_mthreads))
CmdArgs.push_back("-lmingwthrd");
CmdArgs.push_back("-lmingw32");
if (Args.hasArg(options::OPT_shared) ||
Args.hasArg(options::OPT_shared_libgcc) ||
!Args.hasArg(options::OPT_static_libgcc)) {
CmdArgs.push_back("-lgcc_s");
CmdArgs.push_back("-lgcc");
} else {
CmdArgs.push_back("-lgcc");
CmdArgs.push_back("-lgcc_eh");
}
// Add libgcc or compiler-rt.
AddRunTimeLibs(getToolChain(), getToolChain().getDriver(), CmdArgs, Args);
CmdArgs.push_back("-lmoldname");
CmdArgs.push_back("-lmingwex");
CmdArgs.push_back("-lmsvcrt");

View File

@ -231,11 +231,11 @@ class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
} // end namespace hexagon.
namespace arm {
std::string getARMTargetCPU(const llvm::opt::ArgList &Args,
std::string getARMTargetCPU(StringRef CPU, StringRef Arch,
const llvm::Triple &Triple);
const std::string getARMArch(const llvm::opt::ArgList &Args,
const std::string getARMArch(StringRef Arch,
const llvm::Triple &Triple);
const char* getARMCPUForMArch(const llvm::opt::ArgList &Args,
const char* getARMCPUForMArch(StringRef Arch,
const llvm::Triple &Triple);
const char* getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch);

View File

@ -46,7 +46,7 @@ void ASTMergeAction::ExecuteAction() {
*CI.getDiagnostics().getClient()),
/*ShouldOwnClient=*/true));
std::unique_ptr<ASTUnit> Unit =
ASTUnit::LoadFromASTFile(ASTFiles[I], CI.getPCHContainerOperations(),
ASTUnit::LoadFromASTFile(ASTFiles[I], CI.getPCHContainerReader(),
Diags, CI.getFileSystemOpts(), false);
if (!Unit)

View File

@ -650,7 +650,7 @@ void ASTUnit::ConfigureDiags(IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
const std::string &Filename,
std::shared_ptr<PCHContainerOperations> PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
const FileSystemOptions &FileSystemOpts, bool OnlyLocalDecls,
ArrayRef<RemappedFile> RemappedFiles, bool CaptureDiagnostics,
@ -676,7 +676,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
AST->getFileManager(),
UserFilesAreVolatile);
AST->HSOpts = new HeaderSearchOptions();
AST->HSOpts->ModuleFormat = PCHContainerRdr.getFormat();
AST->HeaderInfo.reset(new HeaderSearch(AST->HSOpts,
AST->getSourceManager(),
AST->getDiagnostics(),
@ -708,7 +708,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
bool disableValid = false;
if (::getenv("LIBCLANG_DISABLE_PCH_VALIDATION"))
disableValid = true;
AST->Reader = new ASTReader(PP, Context, *PCHContainerOps,
AST->Reader = new ASTReader(PP, Context, PCHContainerRdr,
/*isysroot=*/"",
/*DisableValidation=*/disableValid,
AllowPCHWithCompilerErrors);

View File

@ -81,7 +81,7 @@ createASTReader(CompilerInstance &CI, StringRef pchFile,
Preprocessor &PP = CI.getPreprocessor();
std::unique_ptr<ASTReader> Reader;
Reader.reset(new ASTReader(PP, CI.getASTContext(),
*CI.getPCHContainerOperations(),
CI.getPCHContainerReader(),
/*isysroot=*/"", /*DisableValidation=*/true));
for (unsigned ti = 0; ti < bufNames.size(); ++ti) {
StringRef sr(bufNames[ti]);

View File

@ -322,7 +322,7 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
PP->getFileManager(), PPOpts);
// Predefine macros and configure the preprocessor.
InitializePreprocessor(*PP, PPOpts, *getPCHContainerOperations(),
InitializePreprocessor(*PP, PPOpts, getPCHContainerReader(),
getFrontendOpts());
// Initialize the header search object.
@ -399,7 +399,7 @@ void CompilerInstance::createPCHExternalASTSource(
ModuleManager = createPCHExternalASTSource(
Path, getHeaderSearchOpts().Sysroot, DisablePCHValidation,
AllowPCHWithCompilerErrors, getPreprocessor(), getASTContext(),
*getPCHContainerOperations(), DeserializationListener,
getPCHContainerReader(), DeserializationListener,
OwnDeserializationListener, Preamble,
getFrontendOpts().UseGlobalModuleIndex);
}
@ -407,13 +407,13 @@ void CompilerInstance::createPCHExternalASTSource(
IntrusiveRefCntPtr<ASTReader> CompilerInstance::createPCHExternalASTSource(
StringRef Path, StringRef Sysroot, bool DisablePCHValidation,
bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
void *DeserializationListener, bool OwnDeserializationListener,
bool Preamble, bool UseGlobalModuleIndex) {
HeaderSearchOptions &HSOpts = PP.getHeaderSearchInfo().getHeaderSearchOpts();
IntrusiveRefCntPtr<ASTReader> Reader(new ASTReader(
PP, Context, PCHContainerOps, Sysroot.empty() ? "" : Sysroot.data(),
PP, Context, PCHContainerRdr, Sysroot.empty() ? "" : Sysroot.data(),
DisablePCHValidation, AllowPCHWithCompilerErrors,
/*AllowConfigurationMismatch*/ false, HSOpts.ModulesValidateSystemHeaders,
UseGlobalModuleIndex));
@ -1244,7 +1244,7 @@ void CompilerInstance::createModuleManager() {
ReadTimer = llvm::make_unique<llvm::Timer>("Reading modules",
*FrontendTimerGroup);
ModuleManager = new ASTReader(
getPreprocessor(), *Context, *getPCHContainerOperations(),
getPreprocessor(), *Context, getPCHContainerReader(),
Sysroot.empty() ? "" : Sysroot.c_str(), PPOpts.DisablePCHValidation,
/*AllowASTWithCompilerErrors=*/false,
/*AllowConfigurationMismatch=*/false,
@ -1296,7 +1296,7 @@ bool CompilerInstance::loadModuleFile(StringRef FileName) {
ModuleFileStack.push_back(FileName);
ModuleNameStack.push_back(StringRef());
if (ASTReader::readASTFileControlBlock(FileName, CI.getFileManager(),
*CI.getPCHContainerOperations(),
CI.getPCHContainerReader(),
*this)) {
CI.getDiagnostics().Report(
SourceLocation(), CI.getFileManager().getBufferForFile(FileName)
@ -1667,7 +1667,7 @@ GlobalModuleIndex *CompilerInstance::loadGlobalModuleIndex(
llvm::sys::fs::create_directories(
getPreprocessor().getHeaderSearchInfo().getModuleCachePath());
GlobalModuleIndex::writeIndex(
getFileManager(), *getPCHContainerOperations(),
getFileManager(), getPCHContainerReader(),
getPreprocessor().getHeaderSearchInfo().getModuleCachePath());
ModuleManager->resetForReload();
ModuleManager->loadGlobalIndex();
@ -1695,7 +1695,7 @@ GlobalModuleIndex *CompilerInstance::loadGlobalModuleIndex(
}
if (RecreateIndex) {
GlobalModuleIndex::writeIndex(
getFileManager(), *getPCHContainerOperations(),
getFileManager(), getPCHContainerReader(),
getPreprocessor().getHeaderSearchInfo().getModuleCachePath());
ModuleManager->resetForReload();
ModuleManager->loadGlobalIndex();

View File

@ -1112,6 +1112,8 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
getLastArgUInt64Value(Args, OPT_fbuild_session_timestamp, 0);
Opts.ModulesValidateSystemHeaders =
Args.hasArg(OPT_fmodules_validate_system_headers);
if (const Arg *A = Args.getLastArg(OPT_fmodule_format_EQ))
Opts.ModuleFormat = A->getValue();
for (const Arg *A : Args.filtered(OPT_fmodules_ignore_macro)) {
StringRef MacroDef = A->getValue();
@ -1258,6 +1260,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
// OpenCL has some additional defaults.
if (Opts.OpenCL) {
Opts.AltiVec = 0;
Opts.ZVector = 0;
Opts.CXXOperatorNames = 1;
Opts.LaxVectorConversions = 0;
Opts.DefaultFPContract = 1;
@ -1446,6 +1449,9 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
if (Args.hasArg(OPT_faltivec))
Opts.AltiVec = 1;
if (Args.hasArg(OPT_fzvector))
Opts.ZVector = 1;
if (Args.hasArg(OPT_pthread))
Opts.POSIXThreads = 1;

View File

@ -191,7 +191,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics());
std::unique_ptr<ASTUnit> AST =
ASTUnit::LoadFromASTFile(InputFile, CI.getPCHContainerOperations(),
ASTUnit::LoadFromASTFile(InputFile, CI.getPCHContainerReader(),
Diags, CI.getFileSystemOpts());
if (!AST)
@ -273,7 +273,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
Dir != DirEnd && !EC; Dir.increment(EC)) {
// Check whether this is an acceptable AST file.
if (ASTReader::isAcceptableASTFile(
Dir->path(), FileMgr, *CI.getPCHContainerOperations(),
Dir->path(), FileMgr, CI.getPCHContainerReader(),
CI.getLangOpts(), CI.getTargetOpts(), CI.getPreprocessorOpts(),
SpecificModuleCachePath)) {
PPOpts.ImplicitPCHInclude = Dir->path();
@ -443,7 +443,7 @@ bool FrontendAction::Execute() {
if (CI.shouldBuildGlobalModuleIndex() && CI.hasFileManager() &&
CI.hasPreprocessor()) {
GlobalModuleIndex::writeIndex(
CI.getFileManager(), *CI.getPCHContainerOperations(),
CI.getFileManager(), CI.getPCHContainerReader(),
CI.getPreprocessor().getHeaderSearchInfo().getModuleCachePath());
}

View File

@ -93,7 +93,7 @@ GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
Consumers.push_back(llvm::make_unique<PCHGenerator>(
CI.getPreprocessor(), OutputFile, nullptr, Sysroot, Buffer));
Consumers.push_back(
CI.getPCHContainerOperations()->CreatePCHContainerGenerator(
CI.getPCHContainerWriter().CreatePCHContainerGenerator(
CI.getDiagnostics(), CI.getHeaderSearchOpts(),
CI.getPreprocessorOpts(), CI.getTargetOpts(), CI.getLangOpts(),
InFile, OutputFile, OS, Buffer));
@ -139,7 +139,7 @@ GenerateModuleAction::CreateASTConsumer(CompilerInstance &CI,
Consumers.push_back(llvm::make_unique<PCHGenerator>(
CI.getPreprocessor(), OutputFile, Module, Sysroot, Buffer));
Consumers.push_back(
CI.getPCHContainerOperations()->CreatePCHContainerGenerator(
CI.getPCHContainerWriter().CreatePCHContainerGenerator(
CI.getDiagnostics(), CI.getHeaderSearchOpts(),
CI.getPreprocessorOpts(), CI.getTargetOpts(), CI.getLangOpts(),
InFile, OutputFile, OS, Buffer));
@ -415,7 +415,7 @@ void VerifyPCHAction::ExecuteAction() {
bool Preamble = CI.getPreprocessorOpts().PrecompiledPreambleBytes.first != 0;
const std::string &Sysroot = CI.getHeaderSearchOpts().Sysroot;
std::unique_ptr<ASTReader> Reader(new ASTReader(
CI.getPreprocessor(), CI.getASTContext(), *CI.getPCHContainerOperations(),
CI.getPreprocessor(), CI.getASTContext(), CI.getPCHContainerReader(),
Sysroot.empty() ? "" : Sysroot.c_str(),
/*DisableValidation*/ false,
/*AllowPCHWithCompilerErrors*/ false,
@ -578,7 +578,7 @@ void DumpModuleInfoAction::ExecuteAction() {
DumpModuleInfoListener Listener(Out);
ASTReader::readASTFileControlBlock(
getCurrentFile(), getCompilerInstance().getFileManager(),
*getCompilerInstance().getPCHContainerOperations(), Listener);
getCompilerInstance().getPCHContainerReader(), Listener);
}
//===----------------------------------------------------------------------===//

View File

@ -97,11 +97,11 @@ static void AddImplicitIncludePTH(MacroBuilder &Builder, Preprocessor &PP,
/// \brief Add an implicit \#include using the original file used to generate
/// a PCH file.
static void AddImplicitIncludePCH(MacroBuilder &Builder, Preprocessor &PP,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
StringRef ImplicitIncludePCH) {
std::string OriginalFile =
ASTReader::getOriginalSourceFile(ImplicitIncludePCH, PP.getFileManager(),
PCHContainerOps, PP.getDiagnostics());
PCHContainerRdr, PP.getDiagnostics());
if (OriginalFile.empty())
return;
@ -902,7 +902,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
///
void clang::InitializePreprocessor(
Preprocessor &PP, const PreprocessorOptions &InitOpts,
const PCHContainerOperations &PCHContainerOps,
const PCHContainerReader &PCHContainerRdr,
const FrontendOptions &FEOpts) {
const LangOptions &LangOpts = PP.getLangOpts();
std::string PredefineBuffer;
@ -962,7 +962,7 @@ void clang::InitializePreprocessor(
// Process -include-pch/-include-pth directives.
if (!InitOpts.ImplicitPCHInclude.empty())
AddImplicitIncludePCH(Builder, PP, PCHContainerOps,
AddImplicitIncludePCH(Builder, PP, PCHContainerRdr,
InitOpts.ImplicitPCHInclude);
if (!InitOpts.ImplicitPTHInclude.empty())
AddImplicitIncludePTH(Builder, PP, InitOpts.ImplicitPTHInclude);

View File

@ -21,21 +21,22 @@ using namespace clang;
namespace {
/// \brief A PCHContainerGenerator that writes out the PCH to a flat file.
class PCHContainerGenerator : public ASTConsumer {
class RawPCHContainerGenerator : public ASTConsumer {
std::shared_ptr<PCHBuffer> Buffer;
raw_pwrite_stream *OS;
public:
PCHContainerGenerator(DiagnosticsEngine &Diags,
const HeaderSearchOptions &HSO,
const PreprocessorOptions &PPO, const TargetOptions &TO,
const LangOptions &LO, const std::string &MainFileName,
const std::string &OutputFileName,
llvm::raw_pwrite_stream *OS,
std::shared_ptr<PCHBuffer> Buffer)
RawPCHContainerGenerator(DiagnosticsEngine &Diags,
const HeaderSearchOptions &HSO,
const PreprocessorOptions &PPO,
const TargetOptions &TO, const LangOptions &LO,
const std::string &MainFileName,
const std::string &OutputFileName,
llvm::raw_pwrite_stream *OS,
std::shared_ptr<PCHBuffer> Buffer)
: Buffer(Buffer), OS(OS) {}
virtual ~PCHContainerGenerator() {}
virtual ~RawPCHContainerGenerator() {}
void HandleTranslationUnit(ASTContext &Ctx) override {
if (Buffer->IsComplete) {
@ -50,19 +51,23 @@ class PCHContainerGenerator : public ASTConsumer {
};
}
std::unique_ptr<ASTConsumer>
RawPCHContainerOperations::CreatePCHContainerGenerator(
std::unique_ptr<ASTConsumer> RawPCHContainerWriter::CreatePCHContainerGenerator(
DiagnosticsEngine &Diags, const HeaderSearchOptions &HSO,
const PreprocessorOptions &PPO, const TargetOptions &TO,
const LangOptions &LO, const std::string &MainFileName,
const std::string &OutputFileName, llvm::raw_pwrite_stream *OS,
std::shared_ptr<PCHBuffer> Buffer) const {
return llvm::make_unique<PCHContainerGenerator>(
return llvm::make_unique<RawPCHContainerGenerator>(
Diags, HSO, PPO, TO, LO, MainFileName, OutputFileName, OS, Buffer);
}
void RawPCHContainerOperations::ExtractPCH(
void RawPCHContainerReader::ExtractPCH(
llvm::MemoryBufferRef Buffer, llvm::BitstreamReader &StreamFile) const {
StreamFile.init((const unsigned char *)Buffer.getBufferStart(),
(const unsigned char *)Buffer.getBufferEnd());
}
PCHContainerOperations::PCHContainerOperations() {
registerWriter(llvm::make_unique<RawPCHContainerWriter>());
registerReader(llvm::make_unique<RawPCHContainerReader>());
}

View File

@ -59,6 +59,7 @@ set(files
unwind.h
vadefs.h
varargs.h
vecintrin.h
__wmmintrin_aes.h
wmmintrin.h
__wmmintrin_pclmul.h

View File

@ -25,8 +25,12 @@
#include <emmintrin.h>
#if !defined (__AES__)
# error "AES instructions not enabled"
#else
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("aes")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_aesenc_si128(__m128i __V, __m128i __R)
@ -63,4 +67,6 @@ _mm_aesimc_si128(__m128i __V)
#undef __DEFAULT_FN_ATTRS
#endif
#endif /* _WMMINTRIN_AES_H */

View File

@ -23,8 +23,12 @@
#ifndef _WMMINTRIN_PCLMUL_H
#define _WMMINTRIN_PCLMUL_H
#if !defined (__PCLMUL__)
# error "PCLMUL instruction is not enabled"
#else
#define _mm_clmulepi64_si128(__X, __Y, __I) \
((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
(__v2di)(__m128i)(__Y), (char)(__I)))
#endif
#endif /* _WMMINTRIN_PCLMUL_H */

View File

@ -32,7 +32,8 @@
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/* Intrinsics that are available only if __ADX__ defined */
static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
#ifdef __ADX__
static __inline unsigned char __DEFAULT_FN_ATTRS
_addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
unsigned int *__p)
{
@ -40,13 +41,14 @@ _addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
}
#ifdef __x86_64__
static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx")))
static __inline unsigned char __DEFAULT_FN_ATTRS
_addcarryx_u64(unsigned char __cf, unsigned long long __x,
unsigned long long __y, unsigned long long *__p)
{
return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
}
#endif
#endif
/* Intrinsics that are also available if __ADX__ undefined */
static __inline unsigned char __DEFAULT_FN_ATTRS

View File

@ -6563,119 +6563,218 @@ static vector signed char __ATTRS_o_ai vec_sld(vector signed char __a,
vector signed char __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector unsigned char __ATTRS_o_ai vec_sld(vector unsigned char __a,
vector unsigned char __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector bool char __ATTRS_o_ai vec_sld(vector bool char __a,
vector bool char __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector signed short __ATTRS_o_ai vec_sld(vector signed short __a,
vector signed short __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector unsigned short __ATTRS_o_ai vec_sld(vector unsigned short __a,
vector unsigned short __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector bool short __ATTRS_o_ai vec_sld(vector bool short __a,
vector bool short __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, vector pixel __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector signed int __ATTRS_o_ai vec_sld(vector signed int __a,
vector signed int __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector unsigned int __ATTRS_o_ai vec_sld(vector unsigned int __a,
vector unsigned int __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
vector bool int __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector float __ATTRS_o_ai vec_sld(vector float __a, vector float __b,
unsigned const int __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
/* vec_vsldoi */
@ -6683,77 +6782,157 @@ static vector float __ATTRS_o_ai vec_sld(vector float __a, vector float __b,
static vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a,
vector signed char __b,
unsigned char __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
__c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
__c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector unsigned char __ATTRS_o_ai vec_vsldoi(vector unsigned char __a,
vector unsigned char __b,
unsigned char __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
__c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
__c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector short __ATTRS_o_ai vec_vsldoi(vector short __a, vector short __b,
unsigned char __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
__c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
__c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector unsigned short __ATTRS_o_ai vec_vsldoi(vector unsigned short __a,
vector unsigned short __b,
unsigned char __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
__c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
__c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, vector pixel __b,
unsigned char __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
__c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
__c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector int __ATTRS_o_ai vec_vsldoi(vector int __a, vector int __b,
unsigned char __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
__c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
__c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector unsigned int __ATTRS_o_ai vec_vsldoi(vector unsigned int __a,
vector unsigned int __b,
unsigned char __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
__c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
__c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
static vector float __ATTRS_o_ai vec_vsldoi(vector float __a, vector float __b,
unsigned char __c) {
unsigned char __d = __c & 0x0F;
#ifdef __LITTLE_ENDIAN__
return vec_perm(
__b, __a,
(vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 20 - __d,
21 - __d, 22 - __d, 23 - __d, 24 - __d, 25 - __d,
26 - __d, 27 - __d, 28 - __d, 29 - __d, 30 - __d,
31 - __d));
#else
return vec_perm(
__a, __b,
(vector unsigned char)(__c, __c + 1, __c + 2, __c + 3, __c + 4, __c + 5,
__c + 6, __c + 7, __c + 8, __c + 9, __c + 10,
__c + 11, __c + 12, __c + 13, __c + 14, __c + 15));
(vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
__d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
__d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
#endif
}
/* vec_sll */

View File

@ -24,10 +24,14 @@
#ifndef __AMMINTRIN_H
#define __AMMINTRIN_H
#ifndef __SSE4A__
#error "SSE4A instruction set not enabled"
#else
#include <pmmintrin.h>
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse4a")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/// \brief Extracts the specified bits from the lower 64 bits of the 128-bit
/// integer vector operand at the index idx and of the length len.
@ -206,4 +210,6 @@ _mm_stream_ss(float *__p, __m128 __a)
#undef __DEFAULT_FN_ATTRS
#endif /* __SSE4A__ */
#endif /* __AMMINTRIN_H */

View File

@ -29,7 +29,7 @@
#define __AVX2INTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx2")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/* SSE4 Multiple Packed Sums of Absolute Difference. */
#define _mm256_mpsadbw_epu8(X, Y, M) __builtin_ia32_mpsadbw256((X), (Y), (M))

View File

@ -34,7 +34,7 @@ typedef char __v64qi __attribute__ ((__vector_size__ (64)));
typedef short __v32hi __attribute__ ((__vector_size__ (64)));
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512bw")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline __v64qi __DEFAULT_FN_ATTRS
_mm512_setzero_qi (void) {

View File

@ -29,7 +29,7 @@
#define __AVX512DQINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512dq")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_mullo_epi64 (__m512i __A, __m512i __B) {

View File

@ -47,7 +47,7 @@ typedef unsigned short __mmask16;
#define _MM_FROUND_CUR_DIRECTION 0x04
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512f")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/* Create vectors with repeated elements */

View File

@ -29,7 +29,7 @@
#define __AVX512VLBWINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512bw")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/* Integer compare */

View File

@ -29,7 +29,7 @@
#define __AVX512VLDQINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vl,avx512dq")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ __m256i __DEFAULT_FN_ATTRS
_mm256_mullo_epi64 (__m256i __A, __m256i __B) {

View File

@ -29,7 +29,7 @@
#define __AVX512VLINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vl")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/* Integer compare */

View File

@ -40,7 +40,7 @@ typedef double __m256d __attribute__((__vector_size__(32)));
typedef long long __m256i __attribute__((__vector_size__(32)));
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/* Arithmetic */
static __inline __m256d __DEFAULT_FN_ATTRS

View File

@ -25,11 +25,15 @@
#error "Never use <bmi2intrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __BMI2__
# error "BMI2 instruction set not enabled"
#endif /* __BMI2__ */
#ifndef __BMI2INTRIN_H
#define __BMI2INTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("bmi2")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_bzhi_u32(unsigned int __X, unsigned int __Y)

View File

@ -25,6 +25,10 @@
#error "Never use <bmiintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __BMI__
# error "BMI instruction set not enabled"
#endif /* __BMI__ */
#ifndef __BMIINTRIN_H
#define __BMIINTRIN_H
@ -37,7 +41,7 @@
#define _tzcnt_u32(a) (__tzcnt_u32((a)))
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("bmi")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ unsigned short __DEFAULT_FN_ATTRS
__tzcnt_u16(unsigned short __X)

View File

@ -24,6 +24,10 @@
#ifndef __EMMINTRIN_H
#define __EMMINTRIN_H
#ifndef __SSE2__
#error "SSE2 instruction set not enabled"
#else
#include <xmmintrin.h>
typedef double __m128d __attribute__((__vector_size__(16)));
@ -36,7 +40,7 @@ typedef short __v8hi __attribute__((__vector_size__(16)));
typedef char __v16qi __attribute__((__vector_size__(16)));
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse2")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ __m128d __DEFAULT_FN_ATTRS
_mm_add_sd(__m128d __a, __m128d __b)
@ -1471,4 +1475,6 @@ _mm_pause(void)
#define _MM_SHUFFLE2(x, y) (((x) << 1) | (y))
#endif /* __SSE2__ */
#endif /* __EMMINTRIN_H */

View File

@ -25,6 +25,10 @@
#error "Never use <f16cintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __F16C__
# error "F16C instruction is not enabled"
#endif /* __F16C__ */
#ifndef __F16CINTRIN_H
#define __F16CINTRIN_H
@ -32,7 +36,7 @@ typedef float __v8sf __attribute__ ((__vector_size__ (32)));
typedef float __m256 __attribute__ ((__vector_size__ (32)));
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("f16c")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
#define _mm_cvtps_ph(a, imm) __extension__ ({ \
__m128 __a = (a); \

View File

@ -28,10 +28,14 @@
#ifndef __FMA4INTRIN_H
#define __FMA4INTRIN_H
#ifndef __FMA4__
# error "FMA4 instruction set is not enabled"
#else
#include <pmmintrin.h>
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fma4")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_macc_ps(__m128 __A, __m128 __B, __m128 __C)
@ -227,4 +231,6 @@ _mm256_msubadd_pd(__m256d __A, __m256d __B, __m256d __C)
#undef __DEFAULT_FN_ATTRS
#endif /* __FMA4__ */
#endif /* __FMA4INTRIN_H */

View File

@ -28,8 +28,12 @@
#ifndef __FMAINTRIN_H
#define __FMAINTRIN_H
#ifndef __FMA__
# error "FMA instruction set is not enabled"
#else
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fma")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ __m128 __DEFAULT_FN_ATTRS
_mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C)
@ -225,4 +229,6 @@ _mm256_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C)
#undef __DEFAULT_FN_ATTRS
#endif /* __FMA__ */
#endif /* __FMAINTRIN_H */

View File

@ -24,123 +24,175 @@
#ifndef __IMMINTRIN_H
#define __IMMINTRIN_H
#ifdef __MMX__
#include <mmintrin.h>
#endif
#ifdef __SSE__
#include <xmmintrin.h>
#endif
#ifdef __SSE2__
#include <emmintrin.h>
#endif
#ifdef __SSE3__
#include <pmmintrin.h>
#endif
#ifdef __SSSE3__
#include <tmmintrin.h>
#endif
#if defined (__SSE4_2__) || defined (__SSE4_1__)
#include <smmintrin.h>
#endif
#if defined (__AES__) || defined (__PCLMUL__)
#include <wmmintrin.h>
#endif
#ifdef __AVX__
#include <avxintrin.h>
#endif
#ifdef __AVX2__
#include <avx2intrin.h>
#endif
#ifdef __BMI__
#include <bmiintrin.h>
#endif
#ifdef __BMI2__
#include <bmi2intrin.h>
#endif
#ifdef __LZCNT__
#include <lzcntintrin.h>
#endif
#ifdef __FMA__
#include <fmaintrin.h>
#endif
#ifdef __AVX512F__
#include <avx512fintrin.h>
#endif
#ifdef __AVX512VL__
#include <avx512vlintrin.h>
#endif
#ifdef __AVX512BW__
#include <avx512bwintrin.h>
#endif
#ifdef __AVX512CD__
#include <avx512cdintrin.h>
#endif
#ifdef __AVX512DQ__
#include <avx512dqintrin.h>
#endif
#if defined (__AVX512VL__) && defined (__AVX512BW__)
#include <avx512vlbwintrin.h>
#endif
#if defined (__AVX512VL__) && defined (__AVX512DQ__)
#include <avx512vldqintrin.h>
#endif
#ifdef __AVX512ER__
#include <avx512erintrin.h>
#endif
static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
#ifdef __RDRND__
static __inline__ int __attribute__((__always_inline__, __nodebug__))
_rdrand16_step(unsigned short *__p)
{
return __builtin_ia32_rdrand16_step(__p);
}
static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
static __inline__ int __attribute__((__always_inline__, __nodebug__))
_rdrand32_step(unsigned int *__p)
{
return __builtin_ia32_rdrand32_step(__p);
}
#ifdef __x86_64__
static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
static __inline__ int __attribute__((__always_inline__, __nodebug__))
_rdrand64_step(unsigned long long *__p)
{
return __builtin_ia32_rdrand64_step(__p);
}
#endif
#endif /* __RDRND__ */
#ifdef __FSGSBASE__
#ifdef __x86_64__
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
_readfsbase_u32(void)
{
return __builtin_ia32_rdfsbase32();
}
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
_readfsbase_u64(void)
{
return __builtin_ia32_rdfsbase64();
}
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
_readgsbase_u32(void)
{
return __builtin_ia32_rdgsbase32();
}
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
_readgsbase_u64(void)
{
return __builtin_ia32_rdgsbase64();
}
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_writefsbase_u32(unsigned int __V)
{
return __builtin_ia32_wrfsbase32(__V);
}
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_writefsbase_u64(unsigned long long __V)
{
return __builtin_ia32_wrfsbase64(__V);
}
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_writegsbase_u32(unsigned int __V)
{
return __builtin_ia32_wrgsbase32(__V);
}
static __inline__ void __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_writegsbase_u64(unsigned long long __V)
{
return __builtin_ia32_wrgsbase64(__V);
}
#endif
#endif /* __FSGSBASE__ */
#ifdef __RTM__
#include <rtmintrin.h>
#endif
#ifdef __RTM__
#include <xtestintrin.h>
#endif
#ifdef __SHA__
#include <shaintrin.h>
#endif
#include <fxsrintrin.h>

View File

@ -25,11 +25,15 @@
#error "Never use <lzcntintrin.h> directly; include <x86intrin.h> instead."
#endif
#ifndef __LZCNT__
# error "LZCNT instruction is not enabled"
#endif /* __LZCNT__ */
#ifndef __LZCNTINTRIN_H
#define __LZCNTINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("lzcnt")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ unsigned short __DEFAULT_FN_ATTRS
__lzcnt16(unsigned short __X)

View File

@ -30,7 +30,7 @@
typedef float __v2sf __attribute__((__vector_size__(8)));
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("3dnow")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ void __DEFAULT_FN_ATTRS
_m_femms() {

View File

@ -24,6 +24,10 @@
#ifndef __MMINTRIN_H
#define __MMINTRIN_H
#ifndef __MMX__
#error "MMX instruction set not enabled"
#else
typedef long long __m64 __attribute__((__vector_size__(8)));
typedef int __v2si __attribute__((__vector_size__(8)));
@ -31,7 +35,7 @@ typedef short __v4hi __attribute__((__vector_size__(8)));
typedef char __v8qi __attribute__((__vector_size__(8)));
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("mmx")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ void __DEFAULT_FN_ATTRS
_mm_empty(void)
@ -497,5 +501,7 @@ _mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5,
#define _m_pcmpgtw _mm_cmpgt_pi16
#define _m_pcmpgtd _mm_cmpgt_pi32
#endif /* __MMX__ */
#endif /* __MMINTRIN_H */

View File

@ -32,117 +32,142 @@ module _Builtin_intrinsics [system] [extern_c] {
}
explicit module cpuid {
requires x86
header "cpuid.h"
}
explicit module mmx {
requires mmx
header "mmintrin.h"
}
explicit module f16c {
requires f16c
header "f16cintrin.h"
}
explicit module sse {
requires sse
export mmx
export sse2 // note: for hackish <emmintrin.h> dependency
header "xmmintrin.h"
}
explicit module sse2 {
requires sse2
export sse
header "emmintrin.h"
}
explicit module sse3 {
requires sse3
export sse2
header "pmmintrin.h"
}
explicit module ssse3 {
requires ssse3
export sse3
header "tmmintrin.h"
}
explicit module sse4_1 {
requires sse41
export ssse3
header "smmintrin.h"
}
explicit module sse4_2 {
requires sse42
export sse4_1
header "nmmintrin.h"
}
explicit module sse4a {
requires sse4a
export sse3
header "ammintrin.h"
}
explicit module avx {
requires avx
export sse4_2
header "avxintrin.h"
}
explicit module avx2 {
requires avx2
export avx
header "avx2intrin.h"
}
explicit module avx512f {
requires avx512f
export avx2
header "avx512fintrin.h"
}
explicit module avx512er {
requires avx512er
header "avx512erintrin.h"
}
explicit module bmi {
requires bmi
header "bmiintrin.h"
}
explicit module bmi2 {
requires bmi2
header "bmi2intrin.h"
}
explicit module fma {
requires fma
header "fmaintrin.h"
}
explicit module fma4 {
requires fma4
export sse3
header "fma4intrin.h"
}
explicit module lzcnt {
requires lzcnt
header "lzcntintrin.h"
}
explicit module popcnt {
requires popcnt
header "popcntintrin.h"
}
explicit module mm3dnow {
requires mm3dnow
header "mm3dnow.h"
}
explicit module xop {
requires xop
export fma4
header "xopintrin.h"
}
explicit module aes_pclmul {
requires aes, pclmul
header "wmmintrin.h"
export aes
export pclmul
}
explicit module aes {
requires aes
header "__wmmintrin_aes.h"
}
explicit module pclmul {
requires pclmul
header "__wmmintrin_pclmul.h"
}
}
@ -158,6 +183,11 @@ module _Builtin_intrinsics [system] [extern_c] {
header "htmintrin.h"
header "htmxlintrin.h"
}
explicit module zvector {
requires zvector, vx
header "vecintrin.h"
}
}
}

View File

@ -24,7 +24,12 @@
#ifndef _NMMINTRIN_H
#define _NMMINTRIN_H
#ifndef __SSE4_2__
#error "SSE4.2 instruction set not enabled"
#else
/* To match expectations of gcc we put the sse4.2 definitions into smmintrin.h,
just include it now then. */
#include <smmintrin.h>
#endif /* __SSE4_2__ */
#endif /* _NMMINTRIN_H */

View File

@ -24,10 +24,14 @@
#ifndef __PMMINTRIN_H
#define __PMMINTRIN_H
#ifndef __SSE3__
#error "SSE3 instruction set not enabled"
#else
#include <emmintrin.h>
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse3")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ __m128i __DEFAULT_FN_ATTRS
_mm_lddqu_si128(__m128i const *__p)
@ -113,4 +117,6 @@ _mm_mwait(unsigned __extensions, unsigned __hints)
#undef __DEFAULT_FN_ATTRS
#endif /* __SSE3__ */
#endif /* __PMMINTRIN_H */

View File

@ -21,11 +21,15 @@
*===-----------------------------------------------------------------------===
*/
#ifndef __POPCNT__
#error "POPCNT instruction set not enabled"
#endif
#ifndef _POPCNTINTRIN_H
#define _POPCNTINTRIN_H
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("popcnt")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ int __DEFAULT_FN_ATTRS
_mm_popcnt_u32(unsigned int __A)

View File

@ -28,8 +28,10 @@
#ifndef __RDSEEDINTRIN_H
#define __RDSEEDINTRIN_H
#ifdef __RDSEED__
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rdseed")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ int __DEFAULT_FN_ATTRS
_rdseed16_step(unsigned short *__p)
@ -53,4 +55,5 @@ _rdseed64_step(unsigned long long *__p)
#undef __DEFAULT_FN_ATTRS
#endif /* __RDSEED__ */
#endif /* __RDSEEDINTRIN_H */

View File

@ -38,7 +38,7 @@
#define _XABORT_CODE(x) (((x) >> 24) & 0xFF)
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("rtm")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
static __inline__ unsigned int __DEFAULT_FN_ATTRS
_xbegin(void)

View File

@ -32,4 +32,8 @@
#include <htmintrin.h>
#endif
#ifdef __VEC__
#include <vecintrin.h>
#endif
#endif /* __S390INTRIN_H*/

View File

@ -28,8 +28,12 @@
#ifndef __SHAINTRIN_H
#define __SHAINTRIN_H
#if !defined (__SHA__)
# error "SHA instructions not enabled"
#endif
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sha")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
#define _mm_sha1rnds4_epu32(V1, V2, M) __extension__ ({ \
__builtin_ia32_sha1rnds4((V1), (V2), (M)); })

View File

@ -24,10 +24,14 @@
#ifndef _SMMINTRIN_H
#define _SMMINTRIN_H
#ifndef __SSE4_1__
#error "SSE4.1 instruction set not enabled"
#else
#include <tmmintrin.h>
/* Define the default attributes for the functions in this file. */
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse4.1")))
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
/* SSE4 Rounding macros. */
#define _MM_FROUND_TO_NEAREST_INT 0x00
@ -375,13 +379,9 @@ _mm_minpos_epu16(__m128i __V)
return (__m128i) __builtin_ia32_phminposuw128((__v8hi)__V);
}
/* Handle the sse4.2 definitions here. */
/* These definitions are normally in nmmintrin.h, but gcc puts them in here
so we'll do the same. */
#undef __DEFAULT_FN_ATTRS
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("sse4.2")))
#ifdef __SSE4_2__
/* These specify the type of data that we're comparing. */
#define _SIDD_UBYTE_OPS 0x00
@ -481,4 +481,7 @@ _mm_crc32_u64(unsigned long long __C, unsigned long long __D)
#include <popcntintrin.h>
#endif
#endif /* __SSE4_2__ */
#endif /* __SSE4_1__ */
#endif /* _SMMINTRIN_H */

Some files were not shown because too many files have changed in this diff Show More