Merge llvm trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
This commit is contained in:
commit
54db30ce18
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/clang900-import/; revision=351344
@ -34,6 +34,10 @@ lib/Bitcode/Reader/CMakeLists.txt
|
||||
lib/Bitcode/Reader/LLVMBuild.txt
|
||||
lib/Bitcode/Writer/CMakeLists.txt
|
||||
lib/Bitcode/Writer/LLVMBuild.txt
|
||||
lib/Bitstream/CMakeLists.txt
|
||||
lib/Bitstream/LLVMBuild.txt
|
||||
lib/Bitstream/Reader/CMakeLists.txt
|
||||
lib/Bitstream/Reader/LLVMBuild.txt
|
||||
lib/CMakeLists.txt
|
||||
lib/CodeGen/AsmPrinter/CMakeLists.txt
|
||||
lib/CodeGen/AsmPrinter/LLVMBuild.txt
|
||||
@ -51,6 +55,8 @@ lib/DebugInfo/CodeView/CMakeLists.txt
|
||||
lib/DebugInfo/CodeView/LLVMBuild.txt
|
||||
lib/DebugInfo/DWARF/CMakeLists.txt
|
||||
lib/DebugInfo/DWARF/LLVMBuild.txt
|
||||
lib/DebugInfo/GSYM/CMakeLists.txt
|
||||
lib/DebugInfo/GSYM/LLVMBuild.txt
|
||||
lib/DebugInfo/LLVMBuild.txt
|
||||
lib/DebugInfo/MSF/CMakeLists.txt
|
||||
lib/DebugInfo/MSF/LLVMBuild.txt
|
||||
@ -65,6 +71,8 @@ lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
|
||||
lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt
|
||||
lib/ExecutionEngine/Interpreter/CMakeLists.txt
|
||||
lib/ExecutionEngine/Interpreter/LLVMBuild.txt
|
||||
lib/ExecutionEngine/JITLink/CMakeLists.txt
|
||||
lib/ExecutionEngine/JITLink/LLVMBuild.txt
|
||||
lib/ExecutionEngine/LLVMBuild.txt
|
||||
lib/ExecutionEngine/MCJIT/CMakeLists.txt
|
||||
lib/ExecutionEngine/MCJIT/LLVMBuild.txt
|
||||
@ -112,6 +120,8 @@ lib/ProfileData/CMakeLists.txt
|
||||
lib/ProfileData/Coverage/CMakeLists.txt
|
||||
lib/ProfileData/Coverage/LLVMBuild.txt
|
||||
lib/ProfileData/LLVMBuild.txt
|
||||
lib/Remarks/CMakeLists.txt
|
||||
lib/Remarks/LLVMBuild.txt
|
||||
lib/Support/CMakeLists.txt
|
||||
lib/Support/LLVMBuild.txt
|
||||
lib/Support/README.txt.system
|
||||
@ -386,8 +396,7 @@ lib/WindowsManifest/LLVMBuild.txt
|
||||
lib/XRay/CMakeLists.txt
|
||||
lib/XRay/LLVMBuild.txt
|
||||
llvm.spec.in
|
||||
projects/CMakeLists.txt
|
||||
projects/LLVMBuild.txt
|
||||
projects/
|
||||
resources/
|
||||
runtimes/
|
||||
test/
|
||||
@ -439,9 +448,11 @@ tools/llvm-extract/LLVMBuild.txt
|
||||
tools/llvm-go/
|
||||
tools/llvm-isel-fuzzer/
|
||||
tools/llvm-itanium-demangle-fuzzer/
|
||||
tools/llvm-jitlink/
|
||||
tools/llvm-jitlistener/
|
||||
tools/llvm-link/CMakeLists.txt
|
||||
tools/llvm-link/LLVMBuild.txt
|
||||
tools/llvm-lipo/
|
||||
tools/llvm-lto/CMakeLists.txt
|
||||
tools/llvm-lto/LLVMBuild.txt
|
||||
tools/llvm-lto2/CMakeLists.txt
|
||||
@ -494,6 +505,7 @@ tools/opt-remarks/
|
||||
tools/opt-viewer/
|
||||
tools/opt/CMakeLists.txt
|
||||
tools/opt/LLVMBuild.txt
|
||||
tools/remarks-shlib/
|
||||
tools/sancov/
|
||||
tools/sanstats/
|
||||
tools/verify-uselistorder/
|
||||
@ -518,8 +530,8 @@ utils/TableGen/tdtags
|
||||
utils/Target/
|
||||
utils/UpdateCMakeLists.pl
|
||||
utils/UpdateTestChecks/
|
||||
utils/abtest/
|
||||
utils/abtest.py
|
||||
utils/abtest/
|
||||
utils/benchmark/
|
||||
utils/bisect
|
||||
utils/bisect-skip-count
|
||||
@ -527,6 +539,7 @@ utils/bugpoint/
|
||||
utils/bugpoint_gisel_reducer.py
|
||||
utils/buildit/
|
||||
utils/check-each-file
|
||||
utils/chunk-print-before-all.py
|
||||
utils/clang-parse-diagnostics-file
|
||||
utils/codegen-diff
|
||||
utils/collect_and_build_with_pgo.py
|
||||
@ -545,8 +558,8 @@ utils/findsym.pl
|
||||
utils/fpcmp/
|
||||
utils/gdb-scripts/
|
||||
utils/getsrcs.sh
|
||||
utils/git/
|
||||
utils/git-svn/
|
||||
utils/git/
|
||||
utils/gn/
|
||||
utils/indirect_calls.py
|
||||
utils/jedit/
|
||||
|
@ -1,5 +1,240 @@
|
||||
==============================================================================
|
||||
LLVM Release License
|
||||
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
|
||||
==============================================================================
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
---- LLVM Exceptions to the Apache 2.0 License ----
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into an Object form of such source code, you
|
||||
may redistribute such embedded portions in such Object form without complying
|
||||
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
|
||||
|
||||
In addition, if you combine or link compiled forms of this Software with
|
||||
software that is licensed under the GPLv2 ("Combined Software") and if a
|
||||
court of competent jurisdiction determines that the patent provision (Section
|
||||
3), the indemnity provision (Section 9) or other Section of the License
|
||||
conflicts with the conditions of the GPLv2, you may retroactively and
|
||||
prospectively choose to deem waived or otherwise exclude such Section(s) of
|
||||
the License, but only in their entirety and only with respect to the Combined
|
||||
Software.
|
||||
|
||||
==============================================================================
|
||||
Software from third parties included in the LLVM Project:
|
||||
==============================================================================
|
||||
The LLVM Project contains third party software which is under different license
|
||||
terms. All such code will be identified clearly using at least one of two
|
||||
mechanisms:
|
||||
1) It will be in a separate directory tree with its own `LICENSE.txt` or
|
||||
`LICENSE` file at the top containing the specific license and restrictions
|
||||
which apply to that software, or
|
||||
2) It will contain specific license and restriction terms at the top of every
|
||||
file.
|
||||
|
||||
==============================================================================
|
||||
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
|
||||
==============================================================================
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
@ -42,27 +277,3 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
Copyrights and Licenses for Third Party Software Distributed with LLVM:
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
|
||||
Program Directory
|
||||
------- ---------
|
||||
Google Test llvm/utils/unittest/googletest
|
||||
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
|
||||
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
|
||||
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
|
||||
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Analysis.h - Analysis Library C Interface --------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/BitReader.h - BitReader Library C Interface ------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/BitWriter.h - BitWriter Library C Interface ------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Comdat.h - Module Comdat C Interface -------------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
@ -65,6 +65,7 @@ typedef enum {
|
||||
LLVMInvoke = 5,
|
||||
/* removed 6 due to API changes */
|
||||
LLVMUnreachable = 7,
|
||||
LLVMCallBr = 67,
|
||||
|
||||
/* Standard Unary Operators */
|
||||
LLVMFNeg = 66,
|
||||
@ -2401,6 +2402,13 @@ LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn);
|
||||
*/
|
||||
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
|
||||
|
||||
/**
|
||||
* Obtain the intrinsic ID number which matches the given function name.
|
||||
*
|
||||
* @see llvm::Function::lookupIntrinsicID()
|
||||
*/
|
||||
unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen);
|
||||
|
||||
/**
|
||||
* Obtain the ID number from a function instance.
|
||||
*
|
||||
@ -2607,6 +2615,103 @@ LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg);
|
||||
*/
|
||||
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned Align);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCCoreValueGlobalIFunc IFuncs
|
||||
*
|
||||
* Functions in this group relate to indirect functions.
|
||||
*
|
||||
* Functions in this group expect LLVMValueRef instances that correspond
|
||||
* to llvm::GlobalIFunc instances.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add a global indirect function to a module under a specified name.
|
||||
*
|
||||
* @see llvm::GlobalIFunc::create()
|
||||
*/
|
||||
LLVMValueRef LLVMAddGlobalIFunc(LLVMModuleRef M,
|
||||
const char *Name, size_t NameLen,
|
||||
LLVMTypeRef Ty, unsigned AddrSpace,
|
||||
LLVMValueRef Resolver);
|
||||
|
||||
/**
|
||||
* Obtain a GlobalIFunc value from a Module by its name.
|
||||
*
|
||||
* The returned value corresponds to a llvm::GlobalIFunc value.
|
||||
*
|
||||
* @see llvm::Module::getNamedIFunc()
|
||||
*/
|
||||
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M,
|
||||
const char *Name, size_t NameLen);
|
||||
|
||||
/**
|
||||
* Obtain an iterator to the first GlobalIFunc in a Module.
|
||||
*
|
||||
* @see llvm::Module::ifunc_begin()
|
||||
*/
|
||||
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M);
|
||||
|
||||
/**
|
||||
* Obtain an iterator to the last GlobalIFunc in a Module.
|
||||
*
|
||||
* @see llvm::Module::ifunc_end()
|
||||
*/
|
||||
LLVMValueRef LLVMGetLastGlobalIFunc(LLVMModuleRef M);
|
||||
|
||||
/**
|
||||
* Advance a GlobalIFunc iterator to the next GlobalIFunc.
|
||||
*
|
||||
* Returns NULL if the iterator was already at the end and there are no more
|
||||
* global aliases.
|
||||
*/
|
||||
LLVMValueRef LLVMGetNextGlobalIFunc(LLVMValueRef IFunc);
|
||||
|
||||
/**
|
||||
* Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
|
||||
*
|
||||
* Returns NULL if the iterator was already at the beginning and there are
|
||||
* no previous global aliases.
|
||||
*/
|
||||
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc);
|
||||
|
||||
/**
|
||||
* Retrieves the resolver function associated with this indirect function, or
|
||||
* NULL if it doesn't not exist.
|
||||
*
|
||||
* @see llvm::GlobalIFunc::getResolver()
|
||||
*/
|
||||
LLVMValueRef LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc);
|
||||
|
||||
/**
|
||||
* Sets the resolver function associated with this indirect function.
|
||||
*
|
||||
* @see llvm::GlobalIFunc::setResolver()
|
||||
*/
|
||||
void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc, LLVMValueRef Resolver);
|
||||
|
||||
/**
|
||||
* Remove a global indirect function from its parent module and delete it.
|
||||
*
|
||||
* @see llvm::GlobalIFunc::eraseFromParent()
|
||||
*/
|
||||
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc);
|
||||
|
||||
/**
|
||||
* Remove a global indirect function from its parent module.
|
||||
*
|
||||
* This unlinks the global indirect function from its containing module but
|
||||
* keeps it alive.
|
||||
*
|
||||
* @see llvm::GlobalIFunc::removeFromParent()
|
||||
*/
|
||||
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -2630,34 +2735,23 @@ void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned Align);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Obtain a MDString value from a context.
|
||||
* Create an MDString value from a given string value.
|
||||
*
|
||||
* The returned instance corresponds to the llvm::MDString class.
|
||||
* The MDString value does not take ownership of the given string, it remains
|
||||
* the responsibility of the caller to free it.
|
||||
*
|
||||
* The instance is specified by string data of a specified length. The
|
||||
* string content is copied, so the backing memory can be freed after
|
||||
* this function returns.
|
||||
* @see llvm::MDString::get()
|
||||
*/
|
||||
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
|
||||
unsigned SLen);
|
||||
LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str,
|
||||
size_t SLen);
|
||||
|
||||
/**
|
||||
* Obtain a MDString value from the global context.
|
||||
*/
|
||||
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
|
||||
|
||||
/**
|
||||
* Obtain a MDNode value from a context.
|
||||
* Create an MDNode value with the given array of operands.
|
||||
*
|
||||
* The returned value corresponds to the llvm::MDNode class.
|
||||
* @see llvm::MDNode::get()
|
||||
*/
|
||||
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
|
||||
unsigned Count);
|
||||
|
||||
/**
|
||||
* Obtain a MDNode value from the global context.
|
||||
*/
|
||||
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
|
||||
LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs,
|
||||
size_t Count);
|
||||
|
||||
/**
|
||||
* Obtain a Metadata as a Value.
|
||||
@ -2699,6 +2793,17 @@ unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V);
|
||||
*/
|
||||
void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest);
|
||||
|
||||
/** Deprecated: Use LLVMMDStringInContext2 instead. */
|
||||
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
|
||||
unsigned SLen);
|
||||
/** Deprecated: Use LLVMMDStringInContext2 instead. */
|
||||
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
|
||||
/** Deprecated: Use LLVMMDNodeInContext2 instead. */
|
||||
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
|
||||
unsigned Count);
|
||||
/** Deprecated: Use LLVMMDNodeInContext2 instead. */
|
||||
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -2811,6 +2916,24 @@ LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB);
|
||||
*/
|
||||
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn);
|
||||
|
||||
/**
|
||||
* Insert the given basic block after the insertion point of the given builder.
|
||||
*
|
||||
* The insertion point must be valid.
|
||||
*
|
||||
* @see llvm::Function::BasicBlockListType::insertAfter()
|
||||
*/
|
||||
void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder,
|
||||
LLVMBasicBlockRef BB);
|
||||
|
||||
/**
|
||||
* Append the given basic block to the basic block list of the given function.
|
||||
*
|
||||
* @see llvm::Function::BasicBlockListType::push_back()
|
||||
*/
|
||||
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn,
|
||||
LLVMBasicBlockRef BB);
|
||||
|
||||
/**
|
||||
* Create a new basic block without inserting it into a function.
|
||||
*
|
||||
@ -3387,10 +3510,60 @@ void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr,
|
||||
void LLVMDisposeBuilder(LLVMBuilderRef Builder);
|
||||
|
||||
/* Metadata */
|
||||
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L);
|
||||
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder);
|
||||
|
||||
/**
|
||||
* Get location information used by debugging information.
|
||||
*
|
||||
* @see llvm::IRBuilder::getCurrentDebugLocation()
|
||||
*/
|
||||
LLVMMetadataRef LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder);
|
||||
|
||||
/**
|
||||
* Set location information used by debugging information.
|
||||
*
|
||||
* To clear the location metadata of the given instruction, pass NULL to \p Loc.
|
||||
*
|
||||
* @see llvm::IRBuilder::SetCurrentDebugLocation()
|
||||
*/
|
||||
void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc);
|
||||
|
||||
/**
|
||||
* Attempts to set the debug location for the given instruction using the
|
||||
* current debug location for the given builder. If the builder has no current
|
||||
* debug location, this function is a no-op.
|
||||
*
|
||||
* @see llvm::IRBuilder::SetInstDebugLocation()
|
||||
*/
|
||||
void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst);
|
||||
|
||||
/**
|
||||
* Get the dafult floating-point math metadata for a given builder.
|
||||
*
|
||||
* @see llvm::IRBuilder::getDefaultFPMathTag()
|
||||
*/
|
||||
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder);
|
||||
|
||||
/**
|
||||
* Set the default floating-point math metadata for the given builder.
|
||||
*
|
||||
* To clear the metadata, pass NULL to \p FPMathTag.
|
||||
*
|
||||
* @see llvm::IRBuilder::setDefaultFPMathTag()
|
||||
*/
|
||||
void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder,
|
||||
LLVMMetadataRef FPMathTag);
|
||||
|
||||
/**
|
||||
* Deprecated: Passing the NULL location will crash.
|
||||
* Use LLVMGetCurrentDebugLocation2 instead.
|
||||
*/
|
||||
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L);
|
||||
/**
|
||||
* Deprecated: Returning the NULL location will crash.
|
||||
* Use LLVMGetCurrentDebugLocation2 instead.
|
||||
*/
|
||||
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder);
|
||||
|
||||
/* Terminators */
|
||||
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef);
|
||||
LLVMValueRef LLVMBuildRet(LLVMBuilderRef, LLVMValueRef V);
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- include/llvm-c/DataTypes.h - Define fixed size types ------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
@ -51,13 +50,12 @@ typedef enum {
|
||||
LLVMDIFlagIntroducedVirtual = 1 << 18,
|
||||
LLVMDIFlagBitField = 1 << 19,
|
||||
LLVMDIFlagNoReturn = 1 << 20,
|
||||
LLVMDIFlagMainSubprogram = 1 << 21,
|
||||
LLVMDIFlagTypePassByValue = 1 << 22,
|
||||
LLVMDIFlagTypePassByReference = 1 << 23,
|
||||
LLVMDIFlagEnumClass = 1 << 24,
|
||||
LLVMDIFlagFixedEnum = LLVMDIFlagEnumClass, // Deprecated.
|
||||
LLVMDIFlagThunk = 1 << 25,
|
||||
LLVMDIFlagTrivial = 1 << 26,
|
||||
LLVMDIFlagNonTrivial = 1 << 26,
|
||||
LLVMDIFlagBigEndian = 1 << 27,
|
||||
LLVMDIFlagLittleEndian = 1 << 28,
|
||||
LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),
|
||||
@ -161,7 +159,8 @@ enum {
|
||||
LLVMDIObjCPropertyMetadataKind,
|
||||
LLVMDIImportedEntityMetadataKind,
|
||||
LLVMDIMacroMetadataKind,
|
||||
LLVMDIMacroFileMetadataKind
|
||||
LLVMDIMacroFileMetadataKind,
|
||||
LLVMDICommonBlockMetadataKind
|
||||
};
|
||||
typedef unsigned LLVMMetadataKind;
|
||||
|
||||
@ -452,6 +451,49 @@ unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location);
|
||||
*/
|
||||
LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location);
|
||||
|
||||
/**
|
||||
* Get the "inline at" location associated with this debug location.
|
||||
* \param Location The debug location.
|
||||
*
|
||||
* @see DILocation::getInlinedAt()
|
||||
*/
|
||||
LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location);
|
||||
|
||||
/**
|
||||
* Get the metadata of the file associated with a given scope.
|
||||
* \param Scope The scope object.
|
||||
*
|
||||
* @see DIScope::getFile()
|
||||
*/
|
||||
LLVMMetadataRef LLVMDIScopeGetFile(LLVMMetadataRef Scope);
|
||||
|
||||
/**
|
||||
* Get the directory of a given file.
|
||||
* \param File The file object.
|
||||
* \param Len The length of the returned string.
|
||||
*
|
||||
* @see DIFile::getDirectory()
|
||||
*/
|
||||
const char *LLVMDIFileGetDirectory(LLVMMetadataRef File, unsigned *Len);
|
||||
|
||||
/**
|
||||
* Get the name of a given file.
|
||||
* \param File The file object.
|
||||
* \param Len The length of the returned string.
|
||||
*
|
||||
* @see DIFile::getFilename()
|
||||
*/
|
||||
const char *LLVMDIFileGetFilename(LLVMMetadataRef File, unsigned *Len);
|
||||
|
||||
/**
|
||||
* Get the source of a given file.
|
||||
* \param File The file object.
|
||||
* \param Len The length of the returned string.
|
||||
*
|
||||
* @see DIFile::getSource()
|
||||
*/
|
||||
const char *LLVMDIFileGetSource(LLVMMetadataRef File, unsigned *Len);
|
||||
|
||||
/**
|
||||
* Create a type array.
|
||||
* \param Builder The DIBuilder.
|
||||
@ -479,6 +521,19 @@ LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,
|
||||
unsigned NumParameterTypes,
|
||||
LLVMDIFlags Flags);
|
||||
|
||||
/**
|
||||
* Create debugging information entry for an enumerator.
|
||||
* @param Builder The DIBuilder.
|
||||
* @param Name Enumerator name.
|
||||
* @param NameLen Length of enumerator name.
|
||||
* @param Value Enumerator value.
|
||||
* @param IsUnsigned True if the value is unsigned.
|
||||
*/
|
||||
LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder,
|
||||
const char *Name, size_t NameLen,
|
||||
int64_t Value,
|
||||
LLVMBool IsUnsigned);
|
||||
|
||||
/**
|
||||
* Create debugging information entry for an enumeration.
|
||||
* \param Builder The DIBuilder.
|
||||
@ -1017,6 +1072,48 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(
|
||||
size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File,
|
||||
unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
|
||||
LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits);
|
||||
|
||||
/**
|
||||
* Retrieves the \c DIVariable associated with this global variable expression.
|
||||
* \param GVE The global variable expression.
|
||||
*
|
||||
* @see llvm::DIGlobalVariableExpression::getVariable()
|
||||
*/
|
||||
LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE);
|
||||
|
||||
/**
|
||||
* Retrieves the \c DIExpression associated with this global variable expression.
|
||||
* \param GVE The global variable expression.
|
||||
*
|
||||
* @see llvm::DIGlobalVariableExpression::getExpression()
|
||||
*/
|
||||
LLVMMetadataRef LLVMDIGlobalVariableExpressionGetExpression(
|
||||
LLVMMetadataRef GVE);
|
||||
|
||||
/**
|
||||
* Get the metadata of the file associated with a given variable.
|
||||
* \param Var The variable object.
|
||||
*
|
||||
* @see DIVariable::getFile()
|
||||
*/
|
||||
LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var);
|
||||
|
||||
/**
|
||||
* Get the metadata of the scope associated with a given variable.
|
||||
* \param Var The variable object.
|
||||
*
|
||||
* @see DIVariable::getScope()
|
||||
*/
|
||||
LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var);
|
||||
|
||||
/**
|
||||
* Get the source line where this \c DIVariable is declared.
|
||||
* \param Var The DIVariable.
|
||||
*
|
||||
* @see DIVariable::getLine()
|
||||
*/
|
||||
unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var);
|
||||
|
||||
/**
|
||||
* Create a new temporary \c MDNode. Suitable for use in constructing cyclic
|
||||
* \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd,
|
||||
@ -1180,6 +1277,30 @@ LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func);
|
||||
*/
|
||||
void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP);
|
||||
|
||||
/**
|
||||
* Get the line associated with a given subprogram.
|
||||
* \param Subprogram The subprogram object.
|
||||
*
|
||||
* @see DISubprogram::getLine()
|
||||
*/
|
||||
unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram);
|
||||
|
||||
/**
|
||||
* Get the debug location for the given instruction.
|
||||
*
|
||||
* @see llvm::Instruction::getDebugLoc()
|
||||
*/
|
||||
LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst);
|
||||
|
||||
/**
|
||||
* Set the debug location for the given instruction.
|
||||
*
|
||||
* To clear the location metadata of the given instruction, pass NULL to \p Loc.
|
||||
*
|
||||
* @see llvm::Instruction::setDebugLoc()
|
||||
*/
|
||||
void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc);
|
||||
|
||||
/**
|
||||
* Obtain the enumerated type of a Metadata instance.
|
||||
*
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Disassembler.h - Disassembler Public C Interface ---*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/DisassemblerTypedefs.h -----------------------------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*/
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===------- llvm-c/Error.h - llvm::Error class C Interface -------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
@ -60,7 +60,7 @@ void LLVMDisposeErrorMessage(char *ErrMsg);
|
||||
/**
|
||||
* Returns the type id for llvm StringError.
|
||||
*/
|
||||
LLVMErrorTypeId LLVMGetStringErrorTypeId();
|
||||
LLVMErrorTypeId LLVMGetStringErrorTypeId(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/ErrorHandling.h - Error Handling C Interface -------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/ExecutionEngine.h - ExecutionEngine Lib C Iface --*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/IRReader.h - IR Reader C Interface -----------------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Initialization.h - Initialization C Interface ------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/LinkTimeOptimizer.h - LTO Public C Interface -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Linker.h - Module Linker C Interface -------------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Object.h - Object Lib C Iface --------------------*- C++ -*-===*/
|
||||
/* */
|
||||
/* The LLVM Compiler Infrastructure */
|
||||
/* */
|
||||
/* This file is distributed under the University of Illinois Open Source */
|
||||
/* License. See LICENSE.TXT for details. */
|
||||
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||
/* Exceptions. */
|
||||
/* See https://llvm.org/LICENSE.txt for license information. */
|
||||
/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
|
||||
/* */
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
/* */
|
||||
@ -34,29 +34,140 @@ extern "C" {
|
||||
*/
|
||||
|
||||
// Opaque type wrappers
|
||||
typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef;
|
||||
typedef struct LLVMOpaqueSectionIterator *LLVMSectionIteratorRef;
|
||||
typedef struct LLVMOpaqueSymbolIterator *LLVMSymbolIteratorRef;
|
||||
typedef struct LLVMOpaqueRelocationIterator *LLVMRelocationIteratorRef;
|
||||
|
||||
// ObjectFile creation
|
||||
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf);
|
||||
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile);
|
||||
typedef enum {
|
||||
LLVMBinaryTypeArchive, /**< Archive file. */
|
||||
LLVMBinaryTypeMachOUniversalBinary, /**< Mach-O Universal Binary file. */
|
||||
LLVMBinaryTypeCOFFImportFile, /**< COFF Import file. */
|
||||
LLVMBinaryTypeIR, /**< LLVM IR. */
|
||||
LLVMBinaryTypeWinRes, /**< Windows resource (.res) file. */
|
||||
LLVMBinaryTypeCOFF, /**< COFF Object file. */
|
||||
LLVMBinaryTypeELF32L, /**< ELF 32-bit, little endian. */
|
||||
LLVMBinaryTypeELF32B, /**< ELF 32-bit, big endian. */
|
||||
LLVMBinaryTypeELF64L, /**< ELF 64-bit, little endian. */
|
||||
LLVMBinaryTypeELF64B, /**< ELF 64-bit, big endian. */
|
||||
LLVMBinaryTypeMachO32L, /**< MachO 32-bit, little endian. */
|
||||
LLVMBinaryTypeMachO32B, /**< MachO 32-bit, big endian. */
|
||||
LLVMBinaryTypeMachO64L, /**< MachO 64-bit, little endian. */
|
||||
LLVMBinaryTypeMachO64B, /**< MachO 64-bit, big endian. */
|
||||
LLVMBinaryTypeWasm, /**< Web Assembly. */
|
||||
} LLVMBinaryType;
|
||||
|
||||
/**
|
||||
* Create a binary file from the given memory buffer.
|
||||
*
|
||||
* The exact type of the binary file will be inferred automatically, and the
|
||||
* appropriate implementation selected. The context may be NULL except if
|
||||
* the resulting file is an LLVM IR file.
|
||||
*
|
||||
* The memory buffer is not consumed by this function. It is the responsibilty
|
||||
* of the caller to free it with \c LLVMDisposeMemoryBuffer.
|
||||
*
|
||||
* If NULL is returned, the \p ErrorMessage parameter is populated with the
|
||||
* error's description. It is then the caller's responsibility to free this
|
||||
* message by calling \c LLVMDisposeMessage.
|
||||
*
|
||||
* @see llvm::object::createBinary
|
||||
*/
|
||||
LLVMBinaryRef LLVMCreateBinary(LLVMMemoryBufferRef MemBuf,
|
||||
LLVMContextRef Context,
|
||||
char **ErrorMessage);
|
||||
|
||||
/**
|
||||
* Dispose of a binary file.
|
||||
*
|
||||
* The binary file does not own its backing buffer. It is the responsibilty
|
||||
* of the caller to free it with \c LLVMDisposeMemoryBuffer.
|
||||
*/
|
||||
void LLVMDisposeBinary(LLVMBinaryRef BR);
|
||||
|
||||
/**
|
||||
* Retrieves a copy of the memory buffer associated with this object file.
|
||||
*
|
||||
* The returned buffer is merely a shallow copy and does not own the actual
|
||||
* backing buffer of the binary. Nevertheless, it is the responsibility of the
|
||||
* caller to free it with \c LLVMDisposeMemoryBuffer.
|
||||
*
|
||||
* @see llvm::object::getMemoryBufferRef
|
||||
*/
|
||||
LLVMMemoryBufferRef LLVMBinaryCopyMemoryBuffer(LLVMBinaryRef BR);
|
||||
|
||||
/**
|
||||
* Retrieve the specific type of a binary.
|
||||
*
|
||||
* @see llvm::object::Binary::getType
|
||||
*/
|
||||
LLVMBinaryType LLVMBinaryGetType(LLVMBinaryRef BR);
|
||||
|
||||
/*
|
||||
* For a Mach-O universal binary file, retrieves the object file corresponding
|
||||
* to the given architecture if it is present as a slice.
|
||||
*
|
||||
* If NULL is returned, the \p ErrorMessage parameter is populated with the
|
||||
* error's description. It is then the caller's responsibility to free this
|
||||
* message by calling \c LLVMDisposeMessage.
|
||||
*
|
||||
* It is the responsiblity of the caller to free the returned object file by
|
||||
* calling \c LLVMDisposeBinary.
|
||||
*/
|
||||
LLVMBinaryRef LLVMMachOUniversalBinaryCopyObjectForArch(LLVMBinaryRef BR,
|
||||
const char *Arch,
|
||||
size_t ArchLen,
|
||||
char **ErrorMessage);
|
||||
|
||||
/**
|
||||
* Retrieve a copy of the section iterator for this object file.
|
||||
*
|
||||
* If there are no sections, the result is NULL.
|
||||
*
|
||||
* The returned iterator is merely a shallow copy. Nevertheless, it is
|
||||
* the responsibility of the caller to free it with
|
||||
* \c LLVMDisposeSectionIterator.
|
||||
*
|
||||
* @see llvm::object::sections()
|
||||
*/
|
||||
LLVMSectionIteratorRef LLVMObjectFileCopySectionIterator(LLVMBinaryRef BR);
|
||||
|
||||
/**
|
||||
* Returns whether the given section iterator is at the end.
|
||||
*
|
||||
* @see llvm::object::section_end
|
||||
*/
|
||||
LLVMBool LLVMObjectFileIsSectionIteratorAtEnd(LLVMBinaryRef BR,
|
||||
LLVMSectionIteratorRef SI);
|
||||
|
||||
/**
|
||||
* Retrieve a copy of the symbol iterator for this object file.
|
||||
*
|
||||
* If there are no symbols, the result is NULL.
|
||||
*
|
||||
* The returned iterator is merely a shallow copy. Nevertheless, it is
|
||||
* the responsibility of the caller to free it with
|
||||
* \c LLVMDisposeSymbolIterator.
|
||||
*
|
||||
* @see llvm::object::symbols()
|
||||
*/
|
||||
LLVMSymbolIteratorRef LLVMObjectFileCopySymbolIterator(LLVMBinaryRef BR);
|
||||
|
||||
/**
|
||||
* Returns whether the given symbol iterator is at the end.
|
||||
*
|
||||
* @see llvm::object::symbol_end
|
||||
*/
|
||||
LLVMBool LLVMObjectFileIsSymbolIteratorAtEnd(LLVMBinaryRef BR,
|
||||
LLVMSymbolIteratorRef SI);
|
||||
|
||||
// ObjectFile Section iterators
|
||||
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile);
|
||||
void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI);
|
||||
LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
||||
LLVMSectionIteratorRef SI);
|
||||
|
||||
void LLVMMoveToNextSection(LLVMSectionIteratorRef SI);
|
||||
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
|
||||
LLVMSymbolIteratorRef Sym);
|
||||
|
||||
// ObjectFile Symbol iterators
|
||||
LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile);
|
||||
void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI);
|
||||
LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
||||
LLVMSymbolIteratorRef SI);
|
||||
void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI);
|
||||
|
||||
// SectionRef accessors
|
||||
@ -89,6 +200,28 @@ uint64_t LLVMGetRelocationType(LLVMRelocationIteratorRef RI);
|
||||
const char *LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI);
|
||||
const char *LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI);
|
||||
|
||||
/** Deprecated: Use LLVMBinaryRef instead. */
|
||||
typedef struct LLVMOpaqueObjectFile *LLVMObjectFileRef;
|
||||
|
||||
/** Deprecated: Use LLVMCreateBinary instead. */
|
||||
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf);
|
||||
|
||||
/** Deprecated: Use LLVMDisposeBinary instead. */
|
||||
void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile);
|
||||
|
||||
/** Deprecated: Use LLVMObjectFileCopySectionIterator instead. */
|
||||
LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile);
|
||||
|
||||
/** Deprecated: Use LLVMObjectFileIsSectionIteratorAtEnd instead. */
|
||||
LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
||||
LLVMSectionIteratorRef SI);
|
||||
|
||||
/** Deprecated: Use LLVMObjectFileCopySymbolIterator instead. */
|
||||
LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile);
|
||||
|
||||
/** Deprecated: Use LLVMObjectFileIsSymbolIteratorAtEnd instead. */
|
||||
LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile,
|
||||
LLVMSymbolIteratorRef SI);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,204 +0,0 @@
|
||||
/*===-- llvm-c/OptRemarks.h - OptRemarks Public C Interface -------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header provides a public interface to an opt-remark library. *|
|
||||
|* LLVM provides an implementation of this interface. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_OPT_REMARKS_H
|
||||
#define LLVM_C_OPT_REMARKS_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/Types.h"
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
extern "C" {
|
||||
#else
|
||||
#include <stddef.h>
|
||||
#endif /* !defined(__cplusplus) */
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCOPTREMARKS OptRemarks
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define OPT_REMARKS_API_VERSION 0
|
||||
|
||||
/**
|
||||
* String containing a buffer and a length. The buffer is not guaranteed to be
|
||||
* zero-terminated.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
typedef struct {
|
||||
const char *Str;
|
||||
uint32_t Len;
|
||||
} LLVMOptRemarkStringRef;
|
||||
|
||||
/**
|
||||
* DebugLoc containing File, Line and Column.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
typedef struct {
|
||||
// File:
|
||||
LLVMOptRemarkStringRef SourceFile;
|
||||
// Line:
|
||||
uint32_t SourceLineNumber;
|
||||
// Column:
|
||||
uint32_t SourceColumnNumber;
|
||||
} LLVMOptRemarkDebugLoc;
|
||||
|
||||
/**
|
||||
* Element of the "Args" list. The key might give more information about what
|
||||
* are the semantics of the value, e.g. "Callee" will tell you that the value
|
||||
* is a symbol that names a function.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
typedef struct {
|
||||
// e.g. "Callee"
|
||||
LLVMOptRemarkStringRef Key;
|
||||
// e.g. "malloc"
|
||||
LLVMOptRemarkStringRef Value;
|
||||
|
||||
// "DebugLoc": Optional
|
||||
LLVMOptRemarkDebugLoc DebugLoc;
|
||||
} LLVMOptRemarkArg;
|
||||
|
||||
/**
|
||||
* One remark entry.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
typedef struct {
|
||||
// e.g. !Missed, !Passed
|
||||
LLVMOptRemarkStringRef RemarkType;
|
||||
// "Pass": Required
|
||||
LLVMOptRemarkStringRef PassName;
|
||||
// "Name": Required
|
||||
LLVMOptRemarkStringRef RemarkName;
|
||||
// "Function": Required
|
||||
LLVMOptRemarkStringRef FunctionName;
|
||||
|
||||
// "DebugLoc": Optional
|
||||
LLVMOptRemarkDebugLoc DebugLoc;
|
||||
// "Hotness": Optional
|
||||
uint32_t Hotness;
|
||||
// "Args": Optional. It is an array of `num_args` elements.
|
||||
uint32_t NumArgs;
|
||||
LLVMOptRemarkArg *Args;
|
||||
} LLVMOptRemarkEntry;
|
||||
|
||||
typedef struct LLVMOptRemarkOpaqueParser *LLVMOptRemarkParserRef;
|
||||
|
||||
/**
|
||||
* Creates a remark parser that can be used to read and parse the buffer located
|
||||
* in \p Buf of size \p Size.
|
||||
*
|
||||
* \p Buf cannot be NULL.
|
||||
*
|
||||
* This function should be paired with LLVMOptRemarkParserDispose() to avoid
|
||||
* leaking resources.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMOptRemarkParserRef LLVMOptRemarkParserCreate(const void *Buf,
|
||||
uint64_t Size);
|
||||
|
||||
/**
|
||||
* Returns the next remark in the file.
|
||||
*
|
||||
* The value pointed to by the return value is invalidated by the next call to
|
||||
* LLVMOptRemarkParserGetNext().
|
||||
*
|
||||
* If the parser reaches the end of the buffer, the return value will be NULL.
|
||||
*
|
||||
* In the case of an error, the return value will be NULL, and:
|
||||
*
|
||||
* 1) LLVMOptRemarkParserHasError() will return `1`.
|
||||
*
|
||||
* 2) LLVMOptRemarkParserGetErrorMessage() will return a descriptive error
|
||||
* message.
|
||||
*
|
||||
* An error may occur if:
|
||||
*
|
||||
* 1) An argument is invalid.
|
||||
*
|
||||
* 2) There is a YAML parsing error. This type of error aborts parsing
|
||||
* immediately and returns `1`. It can occur on malformed YAML.
|
||||
*
|
||||
* 3) Remark parsing error. If this type of error occurs, the parser won't call
|
||||
* the handler and will continue to the next one. It can occur on malformed
|
||||
* remarks, like missing or extra fields in the file.
|
||||
*
|
||||
* Here is a quick example of the usage:
|
||||
*
|
||||
* ```
|
||||
* LLVMOptRemarkParserRef Parser = LLVMOptRemarkParserCreate(Buf, Size);
|
||||
* LLVMOptRemarkEntry *Remark = NULL;
|
||||
* while ((Remark == LLVMOptRemarkParserGetNext(Parser))) {
|
||||
* // use Remark
|
||||
* }
|
||||
* bool HasError = LLVMOptRemarkParserHasError(Parser);
|
||||
* LLVMOptRemarkParserDispose(Parser);
|
||||
* ```
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMOptRemarkEntry *
|
||||
LLVMOptRemarkParserGetNext(LLVMOptRemarkParserRef Parser);
|
||||
|
||||
/**
|
||||
* Returns `1` if the parser encountered an error while parsing the buffer.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMBool LLVMOptRemarkParserHasError(LLVMOptRemarkParserRef Parser);
|
||||
|
||||
/**
|
||||
* Returns a null-terminated string containing an error message.
|
||||
*
|
||||
* In case of no error, the result is `NULL`.
|
||||
*
|
||||
* The memory of the string is bound to the lifetime of \p Parser. If
|
||||
* LLVMOptRemarkParserDispose() is called, the memory of the string will be
|
||||
* released.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern const char *
|
||||
LLVMOptRemarkParserGetErrorMessage(LLVMOptRemarkParserRef Parser);
|
||||
|
||||
/**
|
||||
* Releases all the resources used by \p Parser.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern void LLVMOptRemarkParserDispose(LLVMOptRemarkParserRef Parser);
|
||||
|
||||
/**
|
||||
* Returns the version of the opt-remarks dylib.
|
||||
*
|
||||
* \since OPT_REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern uint32_t LLVMOptRemarkVersion(void);
|
||||
|
||||
/**
|
||||
* @} // endgoup LLVMCOPTREMARKS
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* !defined(__cplusplus) */
|
||||
|
||||
#endif /* LLVM_C_OPT_REMARKS_H */
|
@ -1,9 +1,9 @@
|
||||
/*===----------- llvm-c/OrcBindings.h - Orc Lib C Iface ---------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
329
contrib/llvm/include/llvm-c/Remarks.h
Normal file
329
contrib/llvm/include/llvm-c/Remarks.h
Normal file
@ -0,0 +1,329 @@
|
||||
/*===-- llvm-c/Remarks.h - Remarks Public C Interface -------------*- C -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header provides a public interface to a remark diagnostics library. *|
|
||||
|* LLVM provides an implementation of this interface. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_REMARKS_H
|
||||
#define LLVM_C_REMARKS_H
|
||||
|
||||
#include "llvm-c/Types.h"
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
extern "C" {
|
||||
#else
|
||||
#include <stddef.h>
|
||||
#endif /* !defined(__cplusplus) */
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCREMARKS Remarks
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define REMARKS_API_VERSION 0
|
||||
|
||||
/**
|
||||
* The type of the emitted remark.
|
||||
*/
|
||||
enum LLVMRemarkType {
|
||||
LLVMRemarkTypeUnknown,
|
||||
LLVMRemarkTypePassed,
|
||||
LLVMRemarkTypeMissed,
|
||||
LLVMRemarkTypeAnalysis,
|
||||
LLVMRemarkTypeAnalysisFPCommute,
|
||||
LLVMRemarkTypeAnalysisAliasing,
|
||||
LLVMRemarkTypeFailure
|
||||
};
|
||||
|
||||
/**
|
||||
* String containing a buffer and a length. The buffer is not guaranteed to be
|
||||
* zero-terminated.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
typedef struct LLVMRemarkOpaqueString *LLVMRemarkStringRef;
|
||||
|
||||
/**
|
||||
* Returns the buffer holding the string.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern const char *LLVMRemarkStringGetData(LLVMRemarkStringRef String);
|
||||
|
||||
/**
|
||||
* Returns the size of the string.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern uint32_t LLVMRemarkStringGetLen(LLVMRemarkStringRef String);
|
||||
|
||||
/**
|
||||
* DebugLoc containing File, Line and Column.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
typedef struct LLVMRemarkOpaqueDebugLoc *LLVMRemarkDebugLocRef;
|
||||
|
||||
/**
|
||||
* Return the path to the source file for a debug location.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkStringRef
|
||||
LLVMRemarkDebugLocGetSourceFilePath(LLVMRemarkDebugLocRef DL);
|
||||
|
||||
/**
|
||||
* Return the line in the source file for a debug location.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern uint32_t LLVMRemarkDebugLocGetSourceLine(LLVMRemarkDebugLocRef DL);
|
||||
|
||||
/**
|
||||
* Return the column in the source file for a debug location.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern uint32_t LLVMRemarkDebugLocGetSourceColumn(LLVMRemarkDebugLocRef DL);
|
||||
|
||||
/**
|
||||
* Element of the "Args" list. The key might give more information about what
|
||||
* the semantics of the value are, e.g. "Callee" will tell you that the value
|
||||
* is a symbol that names a function.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
typedef struct LLVMRemarkOpaqueArg *LLVMRemarkArgRef;
|
||||
|
||||
/**
|
||||
* Returns the key of an argument. The key defines what the value is, and the
|
||||
* same key can appear multiple times in the list of arguments.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkStringRef LLVMRemarkArgGetKey(LLVMRemarkArgRef Arg);
|
||||
|
||||
/**
|
||||
* Returns the value of an argument. This is a string that can contain newlines.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkStringRef LLVMRemarkArgGetValue(LLVMRemarkArgRef Arg);
|
||||
|
||||
/**
|
||||
* Returns the debug location that is attached to the value of this argument.
|
||||
*
|
||||
* If there is no debug location, the return value will be `NULL`.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkDebugLocRef LLVMRemarkArgGetDebugLoc(LLVMRemarkArgRef Arg);
|
||||
|
||||
/**
|
||||
* A remark emitted by the compiler.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
typedef struct LLVMRemarkOpaqueEntry *LLVMRemarkEntryRef;
|
||||
|
||||
/**
|
||||
* Free the resources used by the remark entry.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern void LLVMRemarkEntryDispose(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* The type of the remark. For example, it can allow users to only keep the
|
||||
* missed optimizations from the compiler.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern enum LLVMRemarkType LLVMRemarkEntryGetType(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* Get the name of the pass that emitted this remark.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkStringRef
|
||||
LLVMRemarkEntryGetPassName(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* Get an identifier of the remark.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkStringRef
|
||||
LLVMRemarkEntryGetRemarkName(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* Get the name of the function being processed when the remark was emitted.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkStringRef
|
||||
LLVMRemarkEntryGetFunctionName(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* Returns the debug location that is attached to this remark.
|
||||
*
|
||||
* If there is no debug location, the return value will be `NULL`.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkDebugLocRef
|
||||
LLVMRemarkEntryGetDebugLoc(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* Return the hotness of the remark.
|
||||
*
|
||||
* A hotness of `0` means this value is not set.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern uint64_t LLVMRemarkEntryGetHotness(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* The number of arguments the remark holds.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern uint32_t LLVMRemarkEntryGetNumArgs(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* Get a new iterator to iterate over a remark's argument.
|
||||
*
|
||||
* If there are no arguments in \p Remark, the return value will be `NULL`.
|
||||
*
|
||||
* The lifetime of the returned value is bound to the lifetime of \p Remark.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkArgRef LLVMRemarkEntryGetFirstArg(LLVMRemarkEntryRef Remark);
|
||||
|
||||
/**
|
||||
* Get the next argument in \p Remark from the position of \p It.
|
||||
*
|
||||
* Returns `NULL` if there are no more arguments available.
|
||||
*
|
||||
* The lifetime of the returned value is bound to the lifetime of \p Remark.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkArgRef LLVMRemarkEntryGetNextArg(LLVMRemarkArgRef It,
|
||||
LLVMRemarkEntryRef Remark);
|
||||
|
||||
typedef struct LLVMRemarkOpaqueParser *LLVMRemarkParserRef;
|
||||
|
||||
/**
|
||||
* Creates a remark parser that can be used to parse the buffer located in \p
|
||||
* Buf of size \p Size bytes.
|
||||
*
|
||||
* \p Buf cannot be `NULL`.
|
||||
*
|
||||
* This function should be paired with LLVMRemarkParserDispose() to avoid
|
||||
* leaking resources.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkParserRef LLVMRemarkParserCreateYAML(const void *Buf,
|
||||
uint64_t Size);
|
||||
|
||||
/**
|
||||
* Returns the next remark in the file.
|
||||
*
|
||||
* The value pointed to by the return value needs to be disposed using a call to
|
||||
* LLVMRemarkEntryDispose().
|
||||
*
|
||||
* All the entries in the returned value that are of LLVMRemarkStringRef type
|
||||
* will become invalidated once a call to LLVMRemarkParserDispose is made.
|
||||
*
|
||||
* If the parser reaches the end of the buffer, the return value will be `NULL`.
|
||||
*
|
||||
* In the case of an error, the return value will be `NULL`, and:
|
||||
*
|
||||
* 1) LLVMRemarkParserHasError() will return `1`.
|
||||
*
|
||||
* 2) LLVMRemarkParserGetErrorMessage() will return a descriptive error
|
||||
* message.
|
||||
*
|
||||
* An error may occur if:
|
||||
*
|
||||
* 1) An argument is invalid.
|
||||
*
|
||||
* 2) There is a parsing error. This can occur on things like malformed YAML.
|
||||
*
|
||||
* 3) There is a Remark semantic error. This can occur on well-formed files with
|
||||
* missing or extra fields.
|
||||
*
|
||||
* Here is a quick example of the usage:
|
||||
*
|
||||
* ```
|
||||
* LLVMRemarkParserRef Parser = LLVMRemarkParserCreateYAML(Buf, Size);
|
||||
* LLVMRemarkEntryRef Remark = NULL;
|
||||
* while ((Remark = LLVMRemarkParserGetNext(Parser))) {
|
||||
* // use Remark
|
||||
* LLVMRemarkEntryDispose(Remark); // Release memory.
|
||||
* }
|
||||
* bool HasError = LLVMRemarkParserHasError(Parser);
|
||||
* LLVMRemarkParserDispose(Parser);
|
||||
* ```
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMRemarkEntryRef LLVMRemarkParserGetNext(LLVMRemarkParserRef Parser);
|
||||
|
||||
/**
|
||||
* Returns `1` if the parser encountered an error while parsing the buffer.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern LLVMBool LLVMRemarkParserHasError(LLVMRemarkParserRef Parser);
|
||||
|
||||
/**
|
||||
* Returns a null-terminated string containing an error message.
|
||||
*
|
||||
* In case of no error, the result is `NULL`.
|
||||
*
|
||||
* The memory of the string is bound to the lifetime of \p Parser. If
|
||||
* LLVMRemarkParserDispose() is called, the memory of the string will be
|
||||
* released.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern const char *LLVMRemarkParserGetErrorMessage(LLVMRemarkParserRef Parser);
|
||||
|
||||
/**
|
||||
* Releases all the resources used by \p Parser.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern void LLVMRemarkParserDispose(LLVMRemarkParserRef Parser);
|
||||
|
||||
/**
|
||||
* Returns the version of the remarks library.
|
||||
*
|
||||
* \since REMARKS_API_VERSION=0
|
||||
*/
|
||||
extern uint32_t LLVMRemarkVersion(void);
|
||||
|
||||
/**
|
||||
* @} // endgoup LLVMCREMARKS
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* !defined(__cplusplus) */
|
||||
|
||||
#endif /* LLVM_C_REMARKS_H */
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Support.h - Support C Interface --------------------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Target.h - Target Lib C Iface --------------------*- C++ -*-===*/
|
||||
/* */
|
||||
/* The LLVM Compiler Infrastructure */
|
||||
/* */
|
||||
/* This file is distributed under the University of Illinois Open Source */
|
||||
/* License. See LICENSE.TXT for details. */
|
||||
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||
/* Exceptions. */
|
||||
/* See https://llvm.org/LICENSE.txt for license information. */
|
||||
/* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */
|
||||
/* */
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
/* */
|
||||
@ -22,10 +22,6 @@
|
||||
#include "llvm-c/Types.h"
|
||||
#include "llvm/Config/llvm-config.h"
|
||||
|
||||
#if defined(_MSC_VER) && !defined(inline)
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/TargetMachine.h - Target Machine Library C Interface - C++ -*-=*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- AggressiveInstCombine.h ---------------------------------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- Coroutines.h - Coroutines Library C Interface -----------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- IPO.h - Interprocedural Transformations C Interface -----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Transform/PassManagerBuilder.h - PMB C Interface ---*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- Utils.h - Transformation Utils Library C Interface ------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
@ -38,6 +38,9 @@ void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM);
|
||||
/** See llvm::createPromoteMemoryToRegisterPass function. */
|
||||
void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createAddDiscriminatorsPass function. */
|
||||
void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*===---------------------------Vectorize.h --------------------- -*- C -*-===*\
|
||||
|*===----------- Vectorization Transformation Library C Interface ---------===*|
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/Support.h - C Interface Types declarations ---------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
@ -163,6 +163,11 @@ typedef struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry;
|
||||
*/
|
||||
typedef struct LLVMOpaqueJITEventListener *LLVMJITEventListenerRef;
|
||||
|
||||
/**
|
||||
* @see llvm::object::Binary
|
||||
*/
|
||||
typedef struct LLVMOpaqueBinary *LLVMBinaryRef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*===-- llvm-c/lto.h - LTO Public C Interface ---------------------*- C -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
@ -44,7 +44,7 @@ typedef bool lto_bool_t;
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define LTO_API_VERSION 23
|
||||
#define LTO_API_VERSION 24
|
||||
|
||||
/**
|
||||
* \since prior to LTO_API_VERSION=3
|
||||
@ -846,7 +846,47 @@ thinlto_codegen_set_cache_size_megabytes(thinlto_code_gen_t cg,
|
||||
extern void thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg,
|
||||
unsigned max_size_files);
|
||||
|
||||
/** Opaque reference to an LTO input file */
|
||||
typedef struct LLVMOpaqueLTOInput *lto_input_t;
|
||||
|
||||
/**
|
||||
* Creates an LTO input file from a buffer. The path
|
||||
* argument is used for diagnotics as this function
|
||||
* otherwise does not know which file the given buffer
|
||||
* is associated with.
|
||||
*
|
||||
* \since LTO_API_VERSION=24
|
||||
*/
|
||||
extern lto_input_t lto_input_create(const void *buffer,
|
||||
size_t buffer_size,
|
||||
const char *path);
|
||||
|
||||
/**
|
||||
* Frees all memory internally allocated by the LTO input file.
|
||||
* Upon return the lto_module_t is no longer valid.
|
||||
*
|
||||
* \since LTO_API_VERSION=24
|
||||
*/
|
||||
extern void lto_input_dispose(lto_input_t input);
|
||||
|
||||
/**
|
||||
* Returns the number of dependent library specifiers
|
||||
* for the given LTO input file.
|
||||
*
|
||||
* \since LTO_API_VERSION=24
|
||||
*/
|
||||
extern unsigned lto_input_get_num_dependent_libraries(lto_input_t input);
|
||||
|
||||
/**
|
||||
* Returns the ith dependent library specifier
|
||||
* for the given LTO input file. The returned
|
||||
* string is not null-terminated.
|
||||
*
|
||||
* \since LTO_API_VERSION=24
|
||||
*/
|
||||
extern const char * lto_input_get_dependent_library(lto_input_t input,
|
||||
size_t index,
|
||||
size_t *size);
|
||||
|
||||
/**
|
||||
* @} // endgroup LLVMCTLTO_CACHING
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/APFloat.h - Arbitrary Precision Floating Point ---*- C++ -*-==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
@ -148,6 +147,17 @@ struct APFloatBase {
|
||||
|
||||
/// \name Floating Point Semantics.
|
||||
/// @{
|
||||
enum Semantics {
|
||||
S_IEEEhalf,
|
||||
S_IEEEsingle,
|
||||
S_IEEEdouble,
|
||||
S_x87DoubleExtended,
|
||||
S_IEEEquad,
|
||||
S_PPCDoubleDouble
|
||||
};
|
||||
|
||||
static const llvm::fltSemantics &EnumToSemantics(Semantics S);
|
||||
static Semantics SemanticsToEnum(const llvm::fltSemantics &Sem);
|
||||
|
||||
static const fltSemantics &IEEEhalf() LLVM_READNONE;
|
||||
static const fltSemantics &IEEEsingle() LLVM_READNONE;
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/ADT/APInt.h - For Arbitrary Precision Integer -----*- C++ -*--===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
@ -2213,6 +2212,15 @@ Optional<APInt> SolveQuadraticEquationWrap(APInt A, APInt B, APInt C,
|
||||
// See friend declaration above. This additional declaration is required in
|
||||
// order to compile LLVM with IBM xlC compiler.
|
||||
hash_code hash_value(const APInt &Arg);
|
||||
} // End of llvm namespace
|
||||
|
||||
/// StoreIntToMemory - Fills the StoreBytes bytes of memory starting from Dst
|
||||
/// with the integer held in IntVal.
|
||||
void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, unsigned StoreBytes);
|
||||
|
||||
/// LoadIntFromMemory - Loads the integer stored in the LoadBytes bytes starting
|
||||
/// from Src into IntVal, which is assumed to be wide enough and to hold zero.
|
||||
void LoadIntFromMemory(APInt &IntVal, uint8_t *Src, unsigned LoadBytes);
|
||||
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/ADT/APSInt.h - Arbitrary Precision Signed Int -----*- C++ -*--===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -43,6 +42,24 @@ class LLVM_NODISCARD APSInt : public APInt {
|
||||
/// \param Str the string to be interpreted.
|
||||
explicit APSInt(StringRef Str);
|
||||
|
||||
/// Determine sign of this APSInt.
|
||||
///
|
||||
/// \returns true if this APSInt is negative, false otherwise
|
||||
bool isNegative() const { return isSigned() && APInt::isNegative(); }
|
||||
|
||||
/// Determine if this APSInt Value is non-negative (>= 0)
|
||||
///
|
||||
/// \returns true if this APSInt is non-negative, false otherwise
|
||||
bool isNonNegative() const { return !isNegative(); }
|
||||
|
||||
/// Determine if this APSInt Value is positive.
|
||||
///
|
||||
/// This tests if the value of this APSInt is positive (> 0). Note
|
||||
/// that 0 is not a positive value.
|
||||
///
|
||||
/// \returns true if this APSInt is positive.
|
||||
bool isStrictlyPositive() const { return isNonNegative() && !isNullValue(); }
|
||||
|
||||
APSInt &operator=(APInt RHS) {
|
||||
// Retain our current sign.
|
||||
APInt::operator=(std::move(RHS));
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/AllocatorList.h - Custom allocator list ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- Any.h - Generic type erased holder of any type -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- ArrayRef.h - Array Reference Wrapper ---------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@ -431,7 +430,7 @@ namespace llvm {
|
||||
std::copy(Data.begin(), Data.end(), this->begin());
|
||||
}
|
||||
|
||||
OwningArrayRef(OwningArrayRef &&Other) { *this = Other; }
|
||||
OwningArrayRef(OwningArrayRef &&Other) { *this = std::move(Other); }
|
||||
|
||||
OwningArrayRef &operator=(OwningArrayRef &&Other) {
|
||||
delete[] this->data();
|
||||
@ -526,12 +525,6 @@ namespace llvm {
|
||||
|
||||
/// @}
|
||||
|
||||
// ArrayRefs can be treated like a POD type.
|
||||
template <typename T> struct isPodLike;
|
||||
template <typename T> struct isPodLike<ArrayRef<T>> {
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <typename T> hash_code hash_value(ArrayRef<T> S) {
|
||||
return hash_combine_range(S.begin(), S.end());
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/BitVector.h - Bit vectors -----------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/ADT/BitmaskEnum.h ----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/BreadthFirstIterator.h - Breadth First iterator -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -125,7 +124,7 @@ class bf_iterator
|
||||
|
||||
const NodeRef &operator*() const { return VisitQueue.front()->first; }
|
||||
|
||||
// This is a nonstandard operator-> that dereferenfces the pointer an extra
|
||||
// This is a nonstandard operator-> that dereferences the pointer an extra
|
||||
// time so that you can actually call methods on the node, because the
|
||||
// contained type is a pointer.
|
||||
NodeRef operator->() const { return **this; }
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/CachedHashString.h - Prehashed string/StringRef -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- DAGDeltaAlgorithm.h - A DAG Minimization Algorithm ------*- C++ -*--===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ADT_DAGDELTAALGORITHM_H
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- DeltaAlgorithm.h - A Set Minimization Algorithm ---------*- C++ -*--===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ADT_DELTAALGORITHM_H
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/DenseMap.h - Dense probed hash table ------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -64,7 +63,7 @@ struct DenseMapPair : public std::pair<KeyT, ValueT> {
|
||||
template <typename AltPairT>
|
||||
DenseMapPair(AltPairT &&AltPair,
|
||||
typename std::enable_if<std::is_convertible<
|
||||
AltPairT, std::pair<KeyT, ValueT>>::value>::type * = 0)
|
||||
AltPairT, std::pair<KeyT, ValueT>>::value>::type * = nullptr)
|
||||
: std::pair<KeyT, ValueT>(std::forward<AltPairT>(AltPair)) {}
|
||||
|
||||
KeyT &getFirst() { return std::pair<KeyT, ValueT>::first; }
|
||||
@ -146,7 +145,8 @@ class DenseMapBase : public DebugEpochBase {
|
||||
}
|
||||
|
||||
const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
|
||||
if (isPodLike<KeyT>::value && isPodLike<ValueT>::value) {
|
||||
if (is_trivially_copyable<KeyT>::value &&
|
||||
is_trivially_copyable<ValueT>::value) {
|
||||
// Use a simpler loop when these are trivial types.
|
||||
for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P)
|
||||
P->getFirst() = EmptyKey;
|
||||
@ -422,7 +422,8 @@ class DenseMapBase : public DebugEpochBase {
|
||||
setNumEntries(other.getNumEntries());
|
||||
setNumTombstones(other.getNumTombstones());
|
||||
|
||||
if (isPodLike<KeyT>::value && isPodLike<ValueT>::value)
|
||||
if (is_trivially_copyable<KeyT>::value &&
|
||||
is_trivially_copyable<ValueT>::value)
|
||||
memcpy(reinterpret_cast<void *>(getBuckets()), other.getBuckets(),
|
||||
getNumBuckets() * sizeof(BucketT));
|
||||
else
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/DenseMapInfo.h - Type traits for DenseMap -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -18,6 +17,7 @@
|
||||
#include "llvm/ADT/Hashing.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/PointerLikeTypeTraits.h"
|
||||
#include "llvm/Support/ScalableSize.h"
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -269,6 +269,21 @@ template <> struct DenseMapInfo<hash_code> {
|
||||
static bool isEqual(hash_code LHS, hash_code RHS) { return LHS == RHS; }
|
||||
};
|
||||
|
||||
template <> struct DenseMapInfo<ElementCount> {
|
||||
static inline ElementCount getEmptyKey() { return {~0U, true}; }
|
||||
static inline ElementCount getTombstoneKey() { return {~0U - 1, false}; }
|
||||
static unsigned getHashValue(const ElementCount& EltCnt) {
|
||||
if (EltCnt.Scalable)
|
||||
return (EltCnt.Min * 37U) - 1U;
|
||||
|
||||
return EltCnt.Min * 37U;
|
||||
}
|
||||
|
||||
static bool isEqual(const ElementCount& LHS, const ElementCount& RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_ADT_DENSEMAPINFO_H
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/DenseSet.h - Dense probed hash table ------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -131,7 +130,7 @@ class DenseSetImpl {
|
||||
|
||||
class ConstIterator {
|
||||
typename MapTy::const_iterator I;
|
||||
friend class DenseSet;
|
||||
friend class DenseSetImpl;
|
||||
friend class Iterator;
|
||||
|
||||
public:
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/DepthFirstIterator.h - Depth First iterator -----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/EpochTracker.h - ADT epoch tracking --------------*- C++ -*-==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/EquivalenceClasses.h - Generic Equiv. Classes ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/FoldingSet.h - Uniquing Hash Set ----------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- FunctionExtras.h - Function type erasure utilities -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// \file
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/GraphTraits.h - Graph traits template -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/ADT/Hashing.h - Utilities for hashing --------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -192,7 +191,7 @@ inline uint64_t hash_1to3_bytes(const char *s, size_t len, uint64_t seed) {
|
||||
uint8_t b = s[len >> 1];
|
||||
uint8_t c = s[len - 1];
|
||||
uint32_t y = static_cast<uint32_t>(a) + (static_cast<uint32_t>(b) << 8);
|
||||
uint32_t z = len + (static_cast<uint32_t>(c) << 2);
|
||||
uint32_t z = static_cast<uint32_t>(len) + (static_cast<uint32_t>(c) << 2);
|
||||
return shift_mix(y * k2 ^ z * k3 ^ seed) * k2;
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
//==--- ImmutableList.h - Immutable (functional) list interface --*- C++ -*-==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -242,10 +241,6 @@ template<typename T> struct DenseMapInfo<ImmutableList<T>> {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> struct isPodLike;
|
||||
template <typename T>
|
||||
struct isPodLike<ImmutableList<T>> { static const bool value = true; };
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_ADT_IMMUTABLELIST_H
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===--- ImmutableMap.h - Immutable (functional) map interface --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===--- ImmutableSet.h - Immutable (functional) set interface --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/IndexedMap.h - An index map implementation ------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/ADT/IntEqClasses.h - Equiv. Classes of Integers ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/IntervalMap.h - A sorted interval map -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//==- llvm/ADT/IntrusiveRefCntPtr.h - Smart Refcounting Pointer --*- C++ -*-==//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/MapVector.h - Map w/ deterministic value order --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- None.h - Simple null value for implicit construction ------*- C++ -*-=//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- Optional.h - Simple variant for passing optional values --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -17,94 +16,197 @@
|
||||
#define LLVM_ADT_OPTIONAL_H
|
||||
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/Support/AlignOf.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class raw_ostream;
|
||||
|
||||
namespace optional_detail {
|
||||
|
||||
struct in_place_t {};
|
||||
|
||||
/// Storage for any type.
|
||||
template <typename T, bool = isPodLike<T>::value> struct OptionalStorage {
|
||||
AlignedCharArrayUnion<T> storage;
|
||||
bool hasVal = false;
|
||||
|
||||
OptionalStorage() = default;
|
||||
|
||||
OptionalStorage(const T &y) : hasVal(true) { new (storage.buffer) T(y); }
|
||||
OptionalStorage(const OptionalStorage &O) : hasVal(O.hasVal) {
|
||||
if (hasVal)
|
||||
new (storage.buffer) T(*O.getPointer());
|
||||
}
|
||||
OptionalStorage(T &&y) : hasVal(true) {
|
||||
new (storage.buffer) T(std::forward<T>(y));
|
||||
}
|
||||
OptionalStorage(OptionalStorage &&O) : hasVal(O.hasVal) {
|
||||
if (O.hasVal) {
|
||||
new (storage.buffer) T(std::move(*O.getPointer()));
|
||||
}
|
||||
}
|
||||
|
||||
OptionalStorage &operator=(T &&y) {
|
||||
if (hasVal)
|
||||
*getPointer() = std::move(y);
|
||||
else {
|
||||
new (storage.buffer) T(std::move(y));
|
||||
hasVal = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
OptionalStorage &operator=(OptionalStorage &&O) {
|
||||
if (!O.hasVal)
|
||||
reset();
|
||||
else {
|
||||
*this = std::move(*O.getPointer());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// FIXME: these assignments (& the equivalent const T&/const Optional& ctors)
|
||||
// could be made more efficient by passing by value, possibly unifying them
|
||||
// with the rvalue versions above - but this could place a different set of
|
||||
// requirements (notably: the existence of a default ctor) when implemented
|
||||
// in that way. Careful SFINAE to avoid such pitfalls would be required.
|
||||
OptionalStorage &operator=(const T &y) {
|
||||
if (hasVal)
|
||||
*getPointer() = y;
|
||||
else {
|
||||
new (storage.buffer) T(y);
|
||||
hasVal = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
OptionalStorage &operator=(const OptionalStorage &O) {
|
||||
if (!O.hasVal)
|
||||
reset();
|
||||
else
|
||||
*this = *O.getPointer();
|
||||
return *this;
|
||||
}
|
||||
template <typename T, bool = is_trivially_copyable<T>::value>
|
||||
class OptionalStorage {
|
||||
union {
|
||||
char empty;
|
||||
T value;
|
||||
};
|
||||
bool hasVal;
|
||||
|
||||
public:
|
||||
~OptionalStorage() { reset(); }
|
||||
|
||||
void reset() {
|
||||
OptionalStorage() noexcept : empty(), hasVal(false) {}
|
||||
|
||||
OptionalStorage(OptionalStorage const &other) : OptionalStorage() {
|
||||
if (other.hasValue()) {
|
||||
emplace(other.value);
|
||||
}
|
||||
}
|
||||
OptionalStorage(OptionalStorage &&other) : OptionalStorage() {
|
||||
if (other.hasValue()) {
|
||||
emplace(std::move(other.value));
|
||||
}
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
explicit OptionalStorage(in_place_t, Args &&... args)
|
||||
: value(std::forward<Args>(args)...), hasVal(true) {}
|
||||
|
||||
void reset() noexcept {
|
||||
if (hasVal) {
|
||||
(*getPointer()).~T();
|
||||
value.~T();
|
||||
hasVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
T *getPointer() {
|
||||
bool hasValue() const noexcept { return hasVal; }
|
||||
|
||||
T &getValue() LLVM_LVALUE_FUNCTION noexcept {
|
||||
assert(hasVal);
|
||||
return reinterpret_cast<T *>(storage.buffer);
|
||||
return value;
|
||||
}
|
||||
const T *getPointer() const {
|
||||
T const &getValue() const LLVM_LVALUE_FUNCTION noexcept {
|
||||
assert(hasVal);
|
||||
return reinterpret_cast<const T *>(storage.buffer);
|
||||
return value;
|
||||
}
|
||||
#if LLVM_HAS_RVALUE_REFERENCE_THIS
|
||||
T &&getValue() && noexcept {
|
||||
assert(hasVal);
|
||||
return std::move(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class... Args> void emplace(Args &&... args) {
|
||||
reset();
|
||||
::new ((void *)std::addressof(value)) T(std::forward<Args>(args)...);
|
||||
hasVal = true;
|
||||
}
|
||||
|
||||
OptionalStorage &operator=(T const &y) {
|
||||
if (hasValue()) {
|
||||
value = y;
|
||||
} else {
|
||||
::new ((void *)std::addressof(value)) T(y);
|
||||
hasVal = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
OptionalStorage &operator=(T &&y) {
|
||||
if (hasValue()) {
|
||||
value = std::move(y);
|
||||
} else {
|
||||
::new ((void *)std::addressof(value)) T(std::move(y));
|
||||
hasVal = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
OptionalStorage &operator=(OptionalStorage const &other) {
|
||||
if (other.hasValue()) {
|
||||
if (hasValue()) {
|
||||
value = other.value;
|
||||
} else {
|
||||
::new ((void *)std::addressof(value)) T(other.value);
|
||||
hasVal = true;
|
||||
}
|
||||
} else {
|
||||
reset();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
OptionalStorage &operator=(OptionalStorage &&other) {
|
||||
if (other.hasValue()) {
|
||||
if (hasValue()) {
|
||||
value = std::move(other.value);
|
||||
} else {
|
||||
::new ((void *)std::addressof(value)) T(std::move(other.value));
|
||||
hasVal = true;
|
||||
}
|
||||
} else {
|
||||
reset();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> class OptionalStorage<T, true> {
|
||||
union {
|
||||
char empty;
|
||||
T value;
|
||||
};
|
||||
bool hasVal = false;
|
||||
|
||||
public:
|
||||
~OptionalStorage() = default;
|
||||
|
||||
OptionalStorage() noexcept : empty{} {}
|
||||
|
||||
OptionalStorage(OptionalStorage const &other) = default;
|
||||
OptionalStorage(OptionalStorage &&other) = default;
|
||||
|
||||
OptionalStorage &operator=(OptionalStorage const &other) = default;
|
||||
OptionalStorage &operator=(OptionalStorage &&other) = default;
|
||||
|
||||
template <class... Args>
|
||||
explicit OptionalStorage(in_place_t, Args &&... args)
|
||||
: value(std::forward<Args>(args)...), hasVal(true) {}
|
||||
|
||||
void reset() noexcept {
|
||||
if (hasVal) {
|
||||
value.~T();
|
||||
hasVal = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasValue() const noexcept { return hasVal; }
|
||||
|
||||
T &getValue() LLVM_LVALUE_FUNCTION noexcept {
|
||||
assert(hasVal);
|
||||
return value;
|
||||
}
|
||||
T const &getValue() const LLVM_LVALUE_FUNCTION noexcept {
|
||||
assert(hasVal);
|
||||
return value;
|
||||
}
|
||||
#if LLVM_HAS_RVALUE_REFERENCE_THIS
|
||||
T &&getValue() && noexcept {
|
||||
assert(hasVal);
|
||||
return std::move(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class... Args> void emplace(Args &&... args) {
|
||||
reset();
|
||||
::new ((void *)std::addressof(value)) T(std::forward<Args>(args)...);
|
||||
hasVal = true;
|
||||
}
|
||||
|
||||
OptionalStorage &operator=(T const &y) {
|
||||
if (hasValue()) {
|
||||
value = y;
|
||||
} else {
|
||||
::new ((void *)std::addressof(value)) T(y);
|
||||
hasVal = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
OptionalStorage &operator=(T &&y) {
|
||||
if (hasValue()) {
|
||||
value = std::move(y);
|
||||
} else {
|
||||
::new ((void *)std::addressof(value)) T(std::move(y));
|
||||
hasVal = true;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
@ -119,10 +221,10 @@ template <typename T> class Optional {
|
||||
constexpr Optional() {}
|
||||
constexpr Optional(NoneType) {}
|
||||
|
||||
Optional(const T &y) : Storage(y) {}
|
||||
Optional(const T &y) : Storage(optional_detail::in_place_t{}, y) {}
|
||||
Optional(const Optional &O) = default;
|
||||
|
||||
Optional(T &&y) : Storage(std::forward<T>(y)) {}
|
||||
Optional(T &&y) : Storage(optional_detail::in_place_t{}, std::move(y)) {}
|
||||
Optional(Optional &&O) = default;
|
||||
|
||||
Optional &operator=(T &&y) {
|
||||
@ -133,9 +235,7 @@ template <typename T> class Optional {
|
||||
|
||||
/// Create a new object by constructing it in place with the given arguments.
|
||||
template <typename... ArgTypes> void emplace(ArgTypes &&... Args) {
|
||||
reset();
|
||||
Storage.hasVal = true;
|
||||
new (getPointer()) T(std::forward<ArgTypes>(Args)...);
|
||||
Storage.emplace(std::forward<ArgTypes>(Args)...);
|
||||
}
|
||||
|
||||
static inline Optional create(const T *y) {
|
||||
@ -150,23 +250,17 @@ template <typename T> class Optional {
|
||||
|
||||
void reset() { Storage.reset(); }
|
||||
|
||||
const T *getPointer() const {
|
||||
assert(Storage.hasVal);
|
||||
return reinterpret_cast<const T *>(Storage.storage.buffer);
|
||||
}
|
||||
T *getPointer() {
|
||||
assert(Storage.hasVal);
|
||||
return reinterpret_cast<T *>(Storage.storage.buffer);
|
||||
}
|
||||
const T &getValue() const LLVM_LVALUE_FUNCTION { return *getPointer(); }
|
||||
T &getValue() LLVM_LVALUE_FUNCTION { return *getPointer(); }
|
||||
const T *getPointer() const { return &Storage.getValue(); }
|
||||
T *getPointer() { return &Storage.getValue(); }
|
||||
const T &getValue() const LLVM_LVALUE_FUNCTION { return Storage.getValue(); }
|
||||
T &getValue() LLVM_LVALUE_FUNCTION { return Storage.getValue(); }
|
||||
|
||||
explicit operator bool() const { return Storage.hasVal; }
|
||||
bool hasValue() const { return Storage.hasVal; }
|
||||
explicit operator bool() const { return hasValue(); }
|
||||
bool hasValue() const { return Storage.hasValue(); }
|
||||
const T *operator->() const { return getPointer(); }
|
||||
T *operator->() { return getPointer(); }
|
||||
const T &operator*() const LLVM_LVALUE_FUNCTION { return *getPointer(); }
|
||||
T &operator*() LLVM_LVALUE_FUNCTION { return *getPointer(); }
|
||||
const T &operator*() const LLVM_LVALUE_FUNCTION { return getValue(); }
|
||||
T &operator*() LLVM_LVALUE_FUNCTION { return getValue(); }
|
||||
|
||||
template <typename U>
|
||||
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION {
|
||||
@ -174,8 +268,8 @@ template <typename T> class Optional {
|
||||
}
|
||||
|
||||
#if LLVM_HAS_RVALUE_REFERENCE_THIS
|
||||
T &&getValue() && { return std::move(*getPointer()); }
|
||||
T &&operator*() && { return std::move(*getPointer()); }
|
||||
T &&getValue() && { return std::move(Storage.getValue()); }
|
||||
T &&operator*() && { return std::move(Storage.getValue()); }
|
||||
|
||||
template <typename U>
|
||||
T getValueOr(U &&value) && {
|
||||
@ -184,11 +278,6 @@ template <typename T> class Optional {
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename T> struct isPodLike<Optional<T>> {
|
||||
// An Optional<T> is pod-like if T is.
|
||||
static const bool value = isPodLike<T>::value;
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
bool operator==(const Optional<T> &X, const Optional<U> &Y) {
|
||||
if (X && Y)
|
||||
@ -323,6 +412,18 @@ template <typename T> bool operator>=(const T &X, const Optional<T> &Y) {
|
||||
return !(X < Y);
|
||||
}
|
||||
|
||||
raw_ostream &operator<<(raw_ostream &OS, NoneType);
|
||||
|
||||
template <typename T, typename = decltype(std::declval<raw_ostream &>()
|
||||
<< std::declval<const T &>())>
|
||||
raw_ostream &operator<<(raw_ostream &OS, const Optional<T> &O) {
|
||||
if (O)
|
||||
OS << *O;
|
||||
else
|
||||
OS << None;
|
||||
return OS;
|
||||
}
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_ADT_OPTIONAL_H
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/PackedVector.h - Packed values vector -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/PointerEmbeddedInt.h ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/PointerIntPair.h - Pair for pointer and int -----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -15,6 +14,7 @@
|
||||
#define LLVM_ADT_POINTERINTPAIR_H
|
||||
|
||||
#include "llvm/Support/PointerLikeTypeTraits.h"
|
||||
#include "llvm/Support/type_traits.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
@ -126,6 +126,19 @@ class PointerIntPair {
|
||||
}
|
||||
};
|
||||
|
||||
// Specialize is_trivially_copyable to avoid limitation of llvm::is_trivially_copyable
|
||||
// when compiled with gcc 4.9.
|
||||
template <typename PointerTy, unsigned IntBits, typename IntType,
|
||||
typename PtrTraits,
|
||||
typename Info>
|
||||
struct is_trivially_copyable<PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>> : std::true_type {
|
||||
#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
|
||||
static_assert(std::is_trivially_copyable<PointerIntPair<PointerTy, IntBits, IntType, PtrTraits, Info>>::value,
|
||||
"inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
template <typename PointerT, unsigned IntBits, typename PtrTraits>
|
||||
struct PointerIntPairInfo {
|
||||
static_assert(PtrTraits::NumLowBitsAvailable <
|
||||
@ -176,12 +189,6 @@ struct PointerIntPairInfo {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> struct isPodLike;
|
||||
template <typename PointerTy, unsigned IntBits, typename IntType>
|
||||
struct isPodLike<PointerIntPair<PointerTy, IntBits, IntType>> {
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
// Provide specialization of DenseMapInfo for PointerIntPair.
|
||||
template <typename PointerTy, unsigned IntBits, typename IntType>
|
||||
struct DenseMapInfo<PointerIntPair<PointerTy, IntBits, IntType>> {
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/PointerSumType.h --------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/PointerUnion.h - Discriminated Union of 2 Ptrs --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -54,22 +53,98 @@ struct PointerUnionTypeSelectorReturn<
|
||||
typename PointerUnionTypeSelector<T1, T2, RET_EQ, RET_NE>::Return;
|
||||
};
|
||||
|
||||
/// Provide PointerLikeTypeTraits for void* that is used by PointerUnion
|
||||
/// for the two template arguments.
|
||||
template <typename PT1, typename PT2> class PointerUnionUIntTraits {
|
||||
public:
|
||||
static inline void *getAsVoidPointer(void *P) { return P; }
|
||||
static inline void *getFromVoidPointer(void *P) { return P; }
|
||||
namespace pointer_union_detail {
|
||||
constexpr int constexprMin(int a, int b) { return a < b ? a : b; }
|
||||
/// Determine the number of bits required to store integers with values < n.
|
||||
/// This is ceil(log2(n)).
|
||||
constexpr int bitsRequired(unsigned n) {
|
||||
return n > 1 ? 1 + bitsRequired((n + 1) / 2) : 0;
|
||||
}
|
||||
|
||||
enum {
|
||||
PT1BitsAv = (int)(PointerLikeTypeTraits<PT1>::NumLowBitsAvailable),
|
||||
PT2BitsAv = (int)(PointerLikeTypeTraits<PT2>::NumLowBitsAvailable),
|
||||
NumLowBitsAvailable = PT1BitsAv < PT2BitsAv ? PT1BitsAv : PT2BitsAv
|
||||
// FIXME: In C++14, replace this with
|
||||
// std::min({PointerLikeTypeTraits<Ts>::NumLowBitsAvailable...})
|
||||
template <typename T> constexpr int lowBitsAvailable() {
|
||||
return PointerLikeTypeTraits<T>::NumLowBitsAvailable;
|
||||
}
|
||||
template <typename T1, typename T2, typename... Ts>
|
||||
constexpr int lowBitsAvailable() {
|
||||
return constexprMin(lowBitsAvailable<T1>(), lowBitsAvailable<T2, Ts...>());
|
||||
}
|
||||
|
||||
/// Find the index of a type in a list of types. TypeIndex<T, Us...>::Index
|
||||
/// is the index of T in Us, or sizeof...(Us) if T does not appear in the
|
||||
/// list.
|
||||
template <typename T, typename ...Us> struct TypeIndex;
|
||||
template <typename T, typename ...Us> struct TypeIndex<T, T, Us...> {
|
||||
static constexpr int Index = 0;
|
||||
};
|
||||
template <typename T, typename U, typename... Us>
|
||||
struct TypeIndex<T, U, Us...> {
|
||||
static constexpr int Index = 1 + TypeIndex<T, Us...>::Index;
|
||||
};
|
||||
template <typename T> struct TypeIndex<T> {
|
||||
static constexpr int Index = 0;
|
||||
};
|
||||
};
|
||||
|
||||
/// A discriminated union of two pointer types, with the discriminator in the
|
||||
/// low bit of the pointer.
|
||||
/// Find the first type in a list of types.
|
||||
template <typename T, typename...> struct GetFirstType {
|
||||
using type = T;
|
||||
};
|
||||
|
||||
/// Provide PointerLikeTypeTraits for void* that is used by PointerUnion
|
||||
/// for the template arguments.
|
||||
template <typename ...PTs> class PointerUnionUIntTraits {
|
||||
public:
|
||||
static inline void *getAsVoidPointer(void *P) { return P; }
|
||||
static inline void *getFromVoidPointer(void *P) { return P; }
|
||||
static constexpr int NumLowBitsAvailable = lowBitsAvailable<PTs...>();
|
||||
};
|
||||
|
||||
/// Implement assigment in terms of construction.
|
||||
template <typename Derived, typename T> struct AssignableFrom {
|
||||
Derived &operator=(T t) {
|
||||
return static_cast<Derived &>(*this) = Derived(t);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Derived, typename ValTy, int I, typename ...Types>
|
||||
class PointerUnionMembers;
|
||||
|
||||
template <typename Derived, typename ValTy, int I>
|
||||
class PointerUnionMembers<Derived, ValTy, I> {
|
||||
protected:
|
||||
ValTy Val;
|
||||
PointerUnionMembers() = default;
|
||||
PointerUnionMembers(ValTy Val) : Val(Val) {}
|
||||
|
||||
friend struct PointerLikeTypeTraits<Derived>;
|
||||
};
|
||||
|
||||
template <typename Derived, typename ValTy, int I, typename Type,
|
||||
typename ...Types>
|
||||
class PointerUnionMembers<Derived, ValTy, I, Type, Types...>
|
||||
: public PointerUnionMembers<Derived, ValTy, I + 1, Types...> {
|
||||
using Base = PointerUnionMembers<Derived, ValTy, I + 1, Types...>;
|
||||
public:
|
||||
using Base::Base;
|
||||
PointerUnionMembers() = default;
|
||||
PointerUnionMembers(Type V)
|
||||
: Base(ValTy(const_cast<void *>(
|
||||
PointerLikeTypeTraits<Type>::getAsVoidPointer(V)),
|
||||
I)) {}
|
||||
|
||||
using Base::operator=;
|
||||
Derived &operator=(Type V) {
|
||||
this->Val = ValTy(
|
||||
const_cast<void *>(PointerLikeTypeTraits<Type>::getAsVoidPointer(V)),
|
||||
I);
|
||||
return static_cast<Derived &>(*this);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/// A discriminated union of two or more pointer types, with the discriminator
|
||||
/// in the low bit of the pointer.
|
||||
///
|
||||
/// This implementation is extremely efficient in space due to leveraging the
|
||||
/// low bits of the pointer, while exposing a natural and type-safe API.
|
||||
@ -84,49 +159,44 @@ template <typename PT1, typename PT2> class PointerUnionUIntTraits {
|
||||
/// P = (float*)0;
|
||||
/// Y = P.get<float*>(); // ok.
|
||||
/// X = P.get<int*>(); // runtime assertion failure.
|
||||
template <typename PT1, typename PT2> class PointerUnion {
|
||||
public:
|
||||
using ValTy =
|
||||
PointerIntPair<void *, 1, bool, PointerUnionUIntTraits<PT1, PT2>>;
|
||||
|
||||
private:
|
||||
ValTy Val;
|
||||
|
||||
struct IsPT1 {
|
||||
static const int Num = 0;
|
||||
};
|
||||
struct IsPT2 {
|
||||
static const int Num = 1;
|
||||
};
|
||||
template <typename T> struct UNION_DOESNT_CONTAIN_TYPE {};
|
||||
template <typename... PTs>
|
||||
class PointerUnion
|
||||
: public pointer_union_detail::PointerUnionMembers<
|
||||
PointerUnion<PTs...>,
|
||||
PointerIntPair<
|
||||
void *, pointer_union_detail::bitsRequired(sizeof...(PTs)), int,
|
||||
pointer_union_detail::PointerUnionUIntTraits<PTs...>>,
|
||||
0, PTs...> {
|
||||
// The first type is special in some ways, but we don't want PointerUnion to
|
||||
// be a 'template <typename First, typename ...Rest>' because it's much more
|
||||
// convenient to have a name for the whole pack. So split off the first type
|
||||
// here.
|
||||
using First = typename pointer_union_detail::GetFirstType<PTs...>::type;
|
||||
using Base = typename PointerUnion::PointerUnionMembers;
|
||||
|
||||
public:
|
||||
PointerUnion() = default;
|
||||
PointerUnion(PT1 V)
|
||||
: Val(const_cast<void *>(
|
||||
PointerLikeTypeTraits<PT1>::getAsVoidPointer(V))) {}
|
||||
PointerUnion(PT2 V)
|
||||
: Val(const_cast<void *>(PointerLikeTypeTraits<PT2>::getAsVoidPointer(V)),
|
||||
1) {}
|
||||
|
||||
PointerUnion(std::nullptr_t) : PointerUnion() {}
|
||||
using Base::Base;
|
||||
|
||||
/// Test if the pointer held in the union is null, regardless of
|
||||
/// which type it is.
|
||||
bool isNull() const {
|
||||
// Convert from the void* to one of the pointer types, to make sure that
|
||||
// we recursively strip off low bits if we have a nested PointerUnion.
|
||||
return !PointerLikeTypeTraits<PT1>::getFromVoidPointer(Val.getPointer());
|
||||
return !PointerLikeTypeTraits<First>::getFromVoidPointer(
|
||||
this->Val.getPointer());
|
||||
}
|
||||
|
||||
explicit operator bool() const { return !isNull(); }
|
||||
|
||||
/// Test if the Union currently holds the type matching T.
|
||||
template <typename T> int is() const {
|
||||
using Ty = typename ::llvm::PointerUnionTypeSelector<
|
||||
PT1, T, IsPT1,
|
||||
::llvm::PointerUnionTypeSelector<PT2, T, IsPT2,
|
||||
UNION_DOESNT_CONTAIN_TYPE<T>>>::Return;
|
||||
int TyNo = Ty::Num;
|
||||
return static_cast<int>(Val.getInt()) == TyNo;
|
||||
constexpr int Index = pointer_union_detail::TypeIndex<T, PTs...>::Index;
|
||||
static_assert(Index < sizeof...(PTs),
|
||||
"PointerUnion::is<T> given type not in the union");
|
||||
return this->Val.getInt() == Index;
|
||||
}
|
||||
|
||||
/// Returns the value of the specified pointer type.
|
||||
@ -134,7 +204,7 @@ template <typename PT1, typename PT2> class PointerUnion {
|
||||
/// If the specified pointer type is incorrect, assert.
|
||||
template <typename T> T get() const {
|
||||
assert(is<T>() && "Invalid accessor called");
|
||||
return PointerLikeTypeTraits<T>::getFromVoidPointer(Val.getPointer());
|
||||
return PointerLikeTypeTraits<T>::getFromVoidPointer(this->Val.getPointer());
|
||||
}
|
||||
|
||||
/// Returns the current pointer if it is of the specified pointer type,
|
||||
@ -147,342 +217,100 @@ template <typename PT1, typename PT2> class PointerUnion {
|
||||
|
||||
/// If the union is set to the first pointer type get an address pointing to
|
||||
/// it.
|
||||
PT1 const *getAddrOfPtr1() const {
|
||||
First const *getAddrOfPtr1() const {
|
||||
return const_cast<PointerUnion *>(this)->getAddrOfPtr1();
|
||||
}
|
||||
|
||||
/// If the union is set to the first pointer type get an address pointing to
|
||||
/// it.
|
||||
PT1 *getAddrOfPtr1() {
|
||||
assert(is<PT1>() && "Val is not the first pointer");
|
||||
First *getAddrOfPtr1() {
|
||||
assert(is<First>() && "Val is not the first pointer");
|
||||
assert(
|
||||
get<PT1>() == Val.getPointer() &&
|
||||
get<First>() == this->Val.getPointer() &&
|
||||
"Can't get the address because PointerLikeTypeTraits changes the ptr");
|
||||
return const_cast<PT1 *>(
|
||||
reinterpret_cast<const PT1 *>(Val.getAddrOfPointer()));
|
||||
return const_cast<First *>(
|
||||
reinterpret_cast<const First *>(this->Val.getAddrOfPointer()));
|
||||
}
|
||||
|
||||
/// Assignment from nullptr which just clears the union.
|
||||
const PointerUnion &operator=(std::nullptr_t) {
|
||||
Val.initWithPointer(nullptr);
|
||||
this->Val.initWithPointer(nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Assignment operators - Allow assigning into this union from either
|
||||
/// pointer type, setting the discriminator to remember what it came from.
|
||||
const PointerUnion &operator=(const PT1 &RHS) {
|
||||
Val.initWithPointer(
|
||||
const_cast<void *>(PointerLikeTypeTraits<PT1>::getAsVoidPointer(RHS)));
|
||||
return *this;
|
||||
}
|
||||
const PointerUnion &operator=(const PT2 &RHS) {
|
||||
Val.setPointerAndInt(
|
||||
const_cast<void *>(PointerLikeTypeTraits<PT2>::getAsVoidPointer(RHS)),
|
||||
1);
|
||||
return *this;
|
||||
}
|
||||
/// Assignment from elements of the union.
|
||||
using Base::operator=;
|
||||
|
||||
void *getOpaqueValue() const { return Val.getOpaqueValue(); }
|
||||
void *getOpaqueValue() const { return this->Val.getOpaqueValue(); }
|
||||
static inline PointerUnion getFromOpaqueValue(void *VP) {
|
||||
PointerUnion V;
|
||||
V.Val = ValTy::getFromOpaqueValue(VP);
|
||||
V.Val = decltype(V.Val)::getFromOpaqueValue(VP);
|
||||
return V;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename PT1, typename PT2>
|
||||
bool operator==(PointerUnion<PT1, PT2> lhs, PointerUnion<PT1, PT2> rhs) {
|
||||
template <typename ...PTs>
|
||||
bool operator==(PointerUnion<PTs...> lhs, PointerUnion<PTs...> rhs) {
|
||||
return lhs.getOpaqueValue() == rhs.getOpaqueValue();
|
||||
}
|
||||
|
||||
template <typename PT1, typename PT2>
|
||||
bool operator!=(PointerUnion<PT1, PT2> lhs, PointerUnion<PT1, PT2> rhs) {
|
||||
template <typename ...PTs>
|
||||
bool operator!=(PointerUnion<PTs...> lhs, PointerUnion<PTs...> rhs) {
|
||||
return lhs.getOpaqueValue() != rhs.getOpaqueValue();
|
||||
}
|
||||
|
||||
template <typename PT1, typename PT2>
|
||||
bool operator<(PointerUnion<PT1, PT2> lhs, PointerUnion<PT1, PT2> rhs) {
|
||||
template <typename ...PTs>
|
||||
bool operator<(PointerUnion<PTs...> lhs, PointerUnion<PTs...> rhs) {
|
||||
return lhs.getOpaqueValue() < rhs.getOpaqueValue();
|
||||
}
|
||||
|
||||
// Teach SmallPtrSet that PointerUnion is "basically a pointer", that has
|
||||
// # low bits available = min(PT1bits,PT2bits)-1.
|
||||
template <typename PT1, typename PT2>
|
||||
struct PointerLikeTypeTraits<PointerUnion<PT1, PT2>> {
|
||||
static inline void *getAsVoidPointer(const PointerUnion<PT1, PT2> &P) {
|
||||
template <typename ...PTs>
|
||||
struct PointerLikeTypeTraits<PointerUnion<PTs...>> {
|
||||
static inline void *getAsVoidPointer(const PointerUnion<PTs...> &P) {
|
||||
return P.getOpaqueValue();
|
||||
}
|
||||
|
||||
static inline PointerUnion<PT1, PT2> getFromVoidPointer(void *P) {
|
||||
return PointerUnion<PT1, PT2>::getFromOpaqueValue(P);
|
||||
static inline PointerUnion<PTs...> getFromVoidPointer(void *P) {
|
||||
return PointerUnion<PTs...>::getFromOpaqueValue(P);
|
||||
}
|
||||
|
||||
// The number of bits available are the min of the two pointer types.
|
||||
enum {
|
||||
NumLowBitsAvailable = PointerLikeTypeTraits<
|
||||
typename PointerUnion<PT1, PT2>::ValTy>::NumLowBitsAvailable
|
||||
};
|
||||
// The number of bits available are the min of the pointer types minus the
|
||||
// bits needed for the discriminator.
|
||||
static constexpr int NumLowBitsAvailable = PointerLikeTypeTraits<decltype(
|
||||
PointerUnion<PTs...>::Val)>::NumLowBitsAvailable;
|
||||
};
|
||||
|
||||
/// A pointer union of three pointer types. See documentation for PointerUnion
|
||||
/// for usage.
|
||||
template <typename PT1, typename PT2, typename PT3> class PointerUnion3 {
|
||||
public:
|
||||
using InnerUnion = PointerUnion<PT1, PT2>;
|
||||
using ValTy = PointerUnion<InnerUnion, PT3>;
|
||||
|
||||
private:
|
||||
ValTy Val;
|
||||
|
||||
struct IsInnerUnion {
|
||||
ValTy Val;
|
||||
|
||||
IsInnerUnion(ValTy val) : Val(val) {}
|
||||
|
||||
template <typename T> int is() const {
|
||||
return Val.template is<InnerUnion>() &&
|
||||
Val.template get<InnerUnion>().template is<T>();
|
||||
}
|
||||
|
||||
template <typename T> T get() const {
|
||||
return Val.template get<InnerUnion>().template get<T>();
|
||||
}
|
||||
};
|
||||
|
||||
struct IsPT3 {
|
||||
ValTy Val;
|
||||
|
||||
IsPT3(ValTy val) : Val(val) {}
|
||||
|
||||
template <typename T> int is() const { return Val.template is<T>(); }
|
||||
template <typename T> T get() const { return Val.template get<T>(); }
|
||||
};
|
||||
|
||||
public:
|
||||
PointerUnion3() = default;
|
||||
PointerUnion3(PT1 V) { Val = InnerUnion(V); }
|
||||
PointerUnion3(PT2 V) { Val = InnerUnion(V); }
|
||||
PointerUnion3(PT3 V) { Val = V; }
|
||||
|
||||
/// Test if the pointer held in the union is null, regardless of
|
||||
/// which type it is.
|
||||
bool isNull() const { return Val.isNull(); }
|
||||
explicit operator bool() const { return !isNull(); }
|
||||
|
||||
/// Test if the Union currently holds the type matching T.
|
||||
template <typename T> int is() const {
|
||||
// If T is PT1/PT2 choose IsInnerUnion otherwise choose IsPT3.
|
||||
using Ty = typename ::llvm::PointerUnionTypeSelector<
|
||||
PT1, T, IsInnerUnion,
|
||||
::llvm::PointerUnionTypeSelector<PT2, T, IsInnerUnion, IsPT3>>::Return;
|
||||
return Ty(Val).template is<T>();
|
||||
}
|
||||
|
||||
/// Returns the value of the specified pointer type.
|
||||
///
|
||||
/// If the specified pointer type is incorrect, assert.
|
||||
template <typename T> T get() const {
|
||||
assert(is<T>() && "Invalid accessor called");
|
||||
// If T is PT1/PT2 choose IsInnerUnion otherwise choose IsPT3.
|
||||
using Ty = typename ::llvm::PointerUnionTypeSelector<
|
||||
PT1, T, IsInnerUnion,
|
||||
::llvm::PointerUnionTypeSelector<PT2, T, IsInnerUnion, IsPT3>>::Return;
|
||||
return Ty(Val).template get<T>();
|
||||
}
|
||||
|
||||
/// Returns the current pointer if it is of the specified pointer type,
|
||||
/// otherwises returns null.
|
||||
template <typename T> T dyn_cast() const {
|
||||
if (is<T>())
|
||||
return get<T>();
|
||||
return T();
|
||||
}
|
||||
|
||||
/// Assignment from nullptr which just clears the union.
|
||||
const PointerUnion3 &operator=(std::nullptr_t) {
|
||||
Val = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Assignment operators - Allow assigning into this union from either
|
||||
/// pointer type, setting the discriminator to remember what it came from.
|
||||
const PointerUnion3 &operator=(const PT1 &RHS) {
|
||||
Val = InnerUnion(RHS);
|
||||
return *this;
|
||||
}
|
||||
const PointerUnion3 &operator=(const PT2 &RHS) {
|
||||
Val = InnerUnion(RHS);
|
||||
return *this;
|
||||
}
|
||||
const PointerUnion3 &operator=(const PT3 &RHS) {
|
||||
Val = RHS;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void *getOpaqueValue() const { return Val.getOpaqueValue(); }
|
||||
static inline PointerUnion3 getFromOpaqueValue(void *VP) {
|
||||
PointerUnion3 V;
|
||||
V.Val = ValTy::getFromOpaqueValue(VP);
|
||||
return V;
|
||||
}
|
||||
};
|
||||
|
||||
// Teach SmallPtrSet that PointerUnion3 is "basically a pointer", that has
|
||||
// # low bits available = min(PT1bits,PT2bits,PT2bits)-2.
|
||||
template <typename PT1, typename PT2, typename PT3>
|
||||
struct PointerLikeTypeTraits<PointerUnion3<PT1, PT2, PT3>> {
|
||||
static inline void *getAsVoidPointer(const PointerUnion3<PT1, PT2, PT3> &P) {
|
||||
return P.getOpaqueValue();
|
||||
}
|
||||
|
||||
static inline PointerUnion3<PT1, PT2, PT3> getFromVoidPointer(void *P) {
|
||||
return PointerUnion3<PT1, PT2, PT3>::getFromOpaqueValue(P);
|
||||
}
|
||||
|
||||
// The number of bits available are the min of the two pointer types.
|
||||
enum {
|
||||
NumLowBitsAvailable = PointerLikeTypeTraits<
|
||||
typename PointerUnion3<PT1, PT2, PT3>::ValTy>::NumLowBitsAvailable
|
||||
};
|
||||
};
|
||||
|
||||
template <typename PT1, typename PT2, typename PT3>
|
||||
bool operator<(PointerUnion3<PT1, PT2, PT3> lhs,
|
||||
PointerUnion3<PT1, PT2, PT3> rhs) {
|
||||
return lhs.getOpaqueValue() < rhs.getOpaqueValue();
|
||||
}
|
||||
using PointerUnion3 = PointerUnion<PT1, PT2, PT3>;
|
||||
|
||||
/// A pointer union of four pointer types. See documentation for PointerUnion
|
||||
/// for usage.
|
||||
template <typename PT1, typename PT2, typename PT3, typename PT4>
|
||||
class PointerUnion4 {
|
||||
public:
|
||||
using InnerUnion1 = PointerUnion<PT1, PT2>;
|
||||
using InnerUnion2 = PointerUnion<PT3, PT4>;
|
||||
using ValTy = PointerUnion<InnerUnion1, InnerUnion2>;
|
||||
|
||||
private:
|
||||
ValTy Val;
|
||||
|
||||
public:
|
||||
PointerUnion4() = default;
|
||||
PointerUnion4(PT1 V) { Val = InnerUnion1(V); }
|
||||
PointerUnion4(PT2 V) { Val = InnerUnion1(V); }
|
||||
PointerUnion4(PT3 V) { Val = InnerUnion2(V); }
|
||||
PointerUnion4(PT4 V) { Val = InnerUnion2(V); }
|
||||
|
||||
/// Test if the pointer held in the union is null, regardless of
|
||||
/// which type it is.
|
||||
bool isNull() const { return Val.isNull(); }
|
||||
explicit operator bool() const { return !isNull(); }
|
||||
|
||||
/// Test if the Union currently holds the type matching T.
|
||||
template <typename T> int is() const {
|
||||
// If T is PT1/PT2 choose InnerUnion1 otherwise choose InnerUnion2.
|
||||
using Ty = typename ::llvm::PointerUnionTypeSelector<
|
||||
PT1, T, InnerUnion1,
|
||||
::llvm::PointerUnionTypeSelector<PT2, T, InnerUnion1,
|
||||
InnerUnion2>>::Return;
|
||||
return Val.template is<Ty>() && Val.template get<Ty>().template is<T>();
|
||||
}
|
||||
|
||||
/// Returns the value of the specified pointer type.
|
||||
///
|
||||
/// If the specified pointer type is incorrect, assert.
|
||||
template <typename T> T get() const {
|
||||
assert(is<T>() && "Invalid accessor called");
|
||||
// If T is PT1/PT2 choose InnerUnion1 otherwise choose InnerUnion2.
|
||||
using Ty = typename ::llvm::PointerUnionTypeSelector<
|
||||
PT1, T, InnerUnion1,
|
||||
::llvm::PointerUnionTypeSelector<PT2, T, InnerUnion1,
|
||||
InnerUnion2>>::Return;
|
||||
return Val.template get<Ty>().template get<T>();
|
||||
}
|
||||
|
||||
/// Returns the current pointer if it is of the specified pointer type,
|
||||
/// otherwises returns null.
|
||||
template <typename T> T dyn_cast() const {
|
||||
if (is<T>())
|
||||
return get<T>();
|
||||
return T();
|
||||
}
|
||||
|
||||
/// Assignment from nullptr which just clears the union.
|
||||
const PointerUnion4 &operator=(std::nullptr_t) {
|
||||
Val = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Assignment operators - Allow assigning into this union from either
|
||||
/// pointer type, setting the discriminator to remember what it came from.
|
||||
const PointerUnion4 &operator=(const PT1 &RHS) {
|
||||
Val = InnerUnion1(RHS);
|
||||
return *this;
|
||||
}
|
||||
const PointerUnion4 &operator=(const PT2 &RHS) {
|
||||
Val = InnerUnion1(RHS);
|
||||
return *this;
|
||||
}
|
||||
const PointerUnion4 &operator=(const PT3 &RHS) {
|
||||
Val = InnerUnion2(RHS);
|
||||
return *this;
|
||||
}
|
||||
const PointerUnion4 &operator=(const PT4 &RHS) {
|
||||
Val = InnerUnion2(RHS);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void *getOpaqueValue() const { return Val.getOpaqueValue(); }
|
||||
static inline PointerUnion4 getFromOpaqueValue(void *VP) {
|
||||
PointerUnion4 V;
|
||||
V.Val = ValTy::getFromOpaqueValue(VP);
|
||||
return V;
|
||||
}
|
||||
};
|
||||
|
||||
// Teach SmallPtrSet that PointerUnion4 is "basically a pointer", that has
|
||||
// # low bits available = min(PT1bits,PT2bits,PT2bits)-2.
|
||||
template <typename PT1, typename PT2, typename PT3, typename PT4>
|
||||
struct PointerLikeTypeTraits<PointerUnion4<PT1, PT2, PT3, PT4>> {
|
||||
static inline void *
|
||||
getAsVoidPointer(const PointerUnion4<PT1, PT2, PT3, PT4> &P) {
|
||||
return P.getOpaqueValue();
|
||||
}
|
||||
|
||||
static inline PointerUnion4<PT1, PT2, PT3, PT4> getFromVoidPointer(void *P) {
|
||||
return PointerUnion4<PT1, PT2, PT3, PT4>::getFromOpaqueValue(P);
|
||||
}
|
||||
|
||||
// The number of bits available are the min of the two pointer types.
|
||||
enum {
|
||||
NumLowBitsAvailable = PointerLikeTypeTraits<
|
||||
typename PointerUnion4<PT1, PT2, PT3, PT4>::ValTy>::NumLowBitsAvailable
|
||||
};
|
||||
};
|
||||
using PointerUnion4 = PointerUnion<PT1, PT2, PT3, PT4>;
|
||||
|
||||
// Teach DenseMap how to use PointerUnions as keys.
|
||||
template <typename T, typename U> struct DenseMapInfo<PointerUnion<T, U>> {
|
||||
using Pair = PointerUnion<T, U>;
|
||||
using FirstInfo = DenseMapInfo<T>;
|
||||
using SecondInfo = DenseMapInfo<U>;
|
||||
template <typename ...PTs> struct DenseMapInfo<PointerUnion<PTs...>> {
|
||||
using Union = PointerUnion<PTs...>;
|
||||
using FirstInfo =
|
||||
DenseMapInfo<typename pointer_union_detail::GetFirstType<PTs...>::type>;
|
||||
|
||||
static inline Pair getEmptyKey() { return Pair(FirstInfo::getEmptyKey()); }
|
||||
static inline Union getEmptyKey() { return Union(FirstInfo::getEmptyKey()); }
|
||||
|
||||
static inline Pair getTombstoneKey() {
|
||||
return Pair(FirstInfo::getTombstoneKey());
|
||||
static inline Union getTombstoneKey() {
|
||||
return Union(FirstInfo::getTombstoneKey());
|
||||
}
|
||||
|
||||
static unsigned getHashValue(const Pair &PairVal) {
|
||||
intptr_t key = (intptr_t)PairVal.getOpaqueValue();
|
||||
static unsigned getHashValue(const Union &UnionVal) {
|
||||
intptr_t key = (intptr_t)UnionVal.getOpaqueValue();
|
||||
return DenseMapInfo<intptr_t>::getHashValue(key);
|
||||
}
|
||||
|
||||
static bool isEqual(const Pair &LHS, const Pair &RHS) {
|
||||
return LHS.template is<T>() == RHS.template is<T>() &&
|
||||
(LHS.template is<T>() ? FirstInfo::isEqual(LHS.template get<T>(),
|
||||
RHS.template get<T>())
|
||||
: SecondInfo::isEqual(LHS.template get<U>(),
|
||||
RHS.template get<U>()));
|
||||
static bool isEqual(const Union &LHS, const Union &RHS) {
|
||||
return LHS == RHS;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/PostOrderIterator.h - PostOrder iterator --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/PriorityQueue.h - Priority queues ---------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- PriorityWorklist.h - Worklist with insertion priority ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- ADT/SCCIterator.h - Strongly Connected Comp. Iter. -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// \file
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/STLExtras.h - Useful STL related functions ------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -241,6 +240,13 @@ inline mapped_iterator<ItTy, FuncTy> map_iterator(ItTy I, FuncTy F) {
|
||||
return mapped_iterator<ItTy, FuncTy>(std::move(I), std::move(F));
|
||||
}
|
||||
|
||||
template <class ContainerTy, class FuncTy>
|
||||
auto map_range(ContainerTy &&C, FuncTy F)
|
||||
-> decltype(make_range(map_iterator(C.begin(), F),
|
||||
map_iterator(C.end(), F))) {
|
||||
return make_range(map_iterator(C.begin(), F), map_iterator(C.end(), F));
|
||||
}
|
||||
|
||||
/// Helper to determine if type T has a member called rbegin().
|
||||
template <typename Ty> class has_rbegin_impl {
|
||||
using yes = char[1];
|
||||
@ -1278,29 +1284,52 @@ auto partition(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range)) {
|
||||
|
||||
/// Provide wrappers to std::lower_bound which take ranges instead of having to
|
||||
/// pass begin/end explicitly.
|
||||
template <typename R, typename ForwardIt>
|
||||
auto lower_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range)) {
|
||||
return std::lower_bound(adl_begin(Range), adl_end(Range), I);
|
||||
template <typename R, typename T>
|
||||
auto lower_bound(R &&Range, T &&Value) -> decltype(adl_begin(Range)) {
|
||||
return std::lower_bound(adl_begin(Range), adl_end(Range),
|
||||
std::forward<T>(Value));
|
||||
}
|
||||
|
||||
template <typename R, typename ForwardIt, typename Compare>
|
||||
auto lower_bound(R &&Range, ForwardIt I, Compare C)
|
||||
template <typename R, typename T, typename Compare>
|
||||
auto lower_bound(R &&Range, T &&Value, Compare C)
|
||||
-> decltype(adl_begin(Range)) {
|
||||
return std::lower_bound(adl_begin(Range), adl_end(Range), I, C);
|
||||
return std::lower_bound(adl_begin(Range), adl_end(Range),
|
||||
std::forward<T>(Value), C);
|
||||
}
|
||||
|
||||
/// Provide wrappers to std::upper_bound which take ranges instead of having to
|
||||
/// pass begin/end explicitly.
|
||||
template <typename R, typename ForwardIt>
|
||||
auto upper_bound(R &&Range, ForwardIt I) -> decltype(adl_begin(Range)) {
|
||||
return std::upper_bound(adl_begin(Range), adl_end(Range), I);
|
||||
template <typename R, typename T>
|
||||
auto upper_bound(R &&Range, T &&Value) -> decltype(adl_begin(Range)) {
|
||||
return std::upper_bound(adl_begin(Range), adl_end(Range),
|
||||
std::forward<T>(Value));
|
||||
}
|
||||
|
||||
template <typename R, typename ForwardIt, typename Compare>
|
||||
auto upper_bound(R &&Range, ForwardIt I, Compare C)
|
||||
template <typename R, typename T, typename Compare>
|
||||
auto upper_bound(R &&Range, T &&Value, Compare C)
|
||||
-> decltype(adl_begin(Range)) {
|
||||
return std::upper_bound(adl_begin(Range), adl_end(Range), I, C);
|
||||
return std::upper_bound(adl_begin(Range), adl_end(Range),
|
||||
std::forward<T>(Value), C);
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
void stable_sort(R &&Range) {
|
||||
std::stable_sort(adl_begin(Range), adl_end(Range));
|
||||
}
|
||||
|
||||
template <typename R, typename Compare>
|
||||
void stable_sort(R &&Range, Compare C) {
|
||||
std::stable_sort(adl_begin(Range), adl_end(Range), C);
|
||||
}
|
||||
|
||||
/// Binary search for the first iterator in a range where a predicate is false.
|
||||
/// Requires that C is always true below some limit, and always false above it.
|
||||
template <typename R, typename Predicate,
|
||||
typename Val = decltype(*adl_begin(std::declval<R>()))>
|
||||
auto partition_point(R &&Range, Predicate P) -> decltype(adl_begin(Range)) {
|
||||
return std::partition_point(adl_begin(Range), adl_end(Range), P);
|
||||
}
|
||||
|
||||
/// Wrapper function around std::equal to detect if all elements
|
||||
/// in a container are same.
|
||||
template <typename R>
|
||||
@ -1331,6 +1360,33 @@ void erase_if(Container &C, UnaryPredicate P) {
|
||||
C.erase(remove_if(C, P), C.end());
|
||||
}
|
||||
|
||||
/// Given a sequence container Cont, replace the range [ContIt, ContEnd) with
|
||||
/// the range [ValIt, ValEnd) (which is not from the same container).
|
||||
template<typename Container, typename RandomAccessIterator>
|
||||
void replace(Container &Cont, typename Container::iterator ContIt,
|
||||
typename Container::iterator ContEnd, RandomAccessIterator ValIt,
|
||||
RandomAccessIterator ValEnd) {
|
||||
while (true) {
|
||||
if (ValIt == ValEnd) {
|
||||
Cont.erase(ContIt, ContEnd);
|
||||
return;
|
||||
} else if (ContIt == ContEnd) {
|
||||
Cont.insert(ContIt, ValIt, ValEnd);
|
||||
return;
|
||||
}
|
||||
*ContIt++ = *ValIt++;
|
||||
}
|
||||
}
|
||||
|
||||
/// Given a sequence container Cont, replace the range [ContIt, ContEnd) with
|
||||
/// the range R.
|
||||
template<typename Container, typename Range = std::initializer_list<
|
||||
typename Container::value_type>>
|
||||
void replace(Container &Cont, typename Container::iterator ContIt,
|
||||
typename Container::iterator ContEnd, Range R) {
|
||||
replace(Cont, ContIt, ContEnd, R.begin(), R.end());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Extra additions to <memory>
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -1418,6 +1474,9 @@ namespace detail {
|
||||
template <typename R> class enumerator_iter;
|
||||
|
||||
template <typename R> struct result_pair {
|
||||
using value_reference =
|
||||
typename std::iterator_traits<IterOfRange<R>>::reference;
|
||||
|
||||
friend class enumerator_iter<R>;
|
||||
|
||||
result_pair() = default;
|
||||
@ -1431,8 +1490,8 @@ template <typename R> struct result_pair {
|
||||
}
|
||||
|
||||
std::size_t index() const { return Index; }
|
||||
const ValueOfRange<R> &value() const { return *Iter; }
|
||||
ValueOfRange<R> &value() { return *Iter; }
|
||||
const value_reference value() const { return *Iter; }
|
||||
value_reference value() { return *Iter; }
|
||||
|
||||
private:
|
||||
std::size_t Index = std::numeric_limits<std::size_t>::max();
|
||||
@ -1577,6 +1636,19 @@ bool hasNItemsOrMore(
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Returns a raw pointer that represents the same address as the argument.
|
||||
///
|
||||
/// The late bound return should be removed once we move to C++14 to better
|
||||
/// align with the C++20 declaration. Also, this implementation can be removed
|
||||
/// once we move to C++20 where it's defined as std::to_addres()
|
||||
///
|
||||
/// The std::pointer_traits<>::to_address(p) variations of these overloads has
|
||||
/// not been implemented.
|
||||
template <class Ptr> auto to_address(const Ptr &P) -> decltype(P.operator->()) {
|
||||
return P.operator->();
|
||||
}
|
||||
template <class T> constexpr T *to_address(T *P) { return P; }
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_ADT_STLEXTRAS_H
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/ScopeExit.h - Execute code at scope exit --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- ScopedHashTable.h - A simple scoped hash table -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- Sequence.h - Utility for producing sequences of values ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// \file
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/ADT/SetOperations.h - Generic Set Operations -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SetVector.h - Set with insert order iteration ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SmallBitVector.h - 'Normally small' bit vectors -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SmallPtrSet.h - 'Normally small' pointer set ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SmallSet.h - 'Normally small' sets --------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SmallString.h - 'Normally small' strings --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SmallVector.h - 'Normally small' vectors --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -42,8 +41,8 @@ class SmallVectorBase {
|
||||
unsigned Size = 0, Capacity;
|
||||
|
||||
SmallVectorBase() = delete;
|
||||
SmallVectorBase(void *FirstEl, size_t Capacity)
|
||||
: BeginX(FirstEl), Capacity(Capacity) {}
|
||||
SmallVectorBase(void *FirstEl, size_t TotalCapacity)
|
||||
: BeginX(FirstEl), Capacity(TotalCapacity) {}
|
||||
|
||||
/// This is an implementation of the grow() method which only works
|
||||
/// on POD-like data types and is out of line to reduce code duplication.
|
||||
@ -64,9 +63,9 @@ class SmallVectorBase {
|
||||
/// of the buffer when they know that more elements are available, and only
|
||||
/// update the size later. This avoids the cost of value initializing elements
|
||||
/// which will only be overwritten.
|
||||
void set_size(size_t Size) {
|
||||
assert(Size <= capacity());
|
||||
this->Size = Size;
|
||||
void set_size(size_t N) {
|
||||
assert(N <= capacity());
|
||||
Size = N;
|
||||
}
|
||||
};
|
||||
|
||||
@ -125,13 +124,9 @@ class SmallVectorTemplateCommon : public SmallVectorBase {
|
||||
using const_pointer = const T *;
|
||||
|
||||
// forward iterator creation methods.
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
iterator begin() { return (iterator)this->BeginX; }
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
const_iterator begin() const { return (const_iterator)this->BeginX; }
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
iterator end() { return begin() + size(); }
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
const_iterator end() const { return begin() + size(); }
|
||||
|
||||
// reverse iterator creation methods.
|
||||
@ -150,12 +145,10 @@ class SmallVectorTemplateCommon : public SmallVectorBase {
|
||||
/// Return a pointer to the vector's buffer, even if empty().
|
||||
const_pointer data() const { return const_pointer(begin()); }
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
reference operator[](size_type idx) {
|
||||
assert(idx < size());
|
||||
return begin()[idx];
|
||||
}
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
const_reference operator[](size_type idx) const {
|
||||
assert(idx < size());
|
||||
return begin()[idx];
|
||||
@ -180,9 +173,9 @@ class SmallVectorTemplateCommon : public SmallVectorBase {
|
||||
}
|
||||
};
|
||||
|
||||
/// SmallVectorTemplateBase<isPodLike = false> - This is where we put method
|
||||
/// SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method
|
||||
/// implementations that are designed to work with non-POD-like T's.
|
||||
template <typename T, bool = isPodLike<T>::value>
|
||||
template <typename T, bool = is_trivially_copyable<T>::value>
|
||||
class SmallVectorTemplateBase : public SmallVectorTemplateCommon<T> {
|
||||
protected:
|
||||
SmallVectorTemplateBase(size_t Size) : SmallVectorTemplateCommon<T>(Size) {}
|
||||
@ -236,8 +229,8 @@ class SmallVectorTemplateBase : public SmallVectorTemplateCommon<T> {
|
||||
};
|
||||
|
||||
// Define this out-of-line to dissuade the C++ compiler from inlining it.
|
||||
template <typename T, bool isPodLike>
|
||||
void SmallVectorTemplateBase<T, isPodLike>::grow(size_t MinSize) {
|
||||
template <typename T, bool TriviallyCopyable>
|
||||
void SmallVectorTemplateBase<T, TriviallyCopyable>::grow(size_t MinSize) {
|
||||
if (MinSize > UINT32_MAX)
|
||||
report_bad_alloc_error("SmallVector capacity overflow during allocation");
|
||||
|
||||
@ -260,9 +253,8 @@ void SmallVectorTemplateBase<T, isPodLike>::grow(size_t MinSize) {
|
||||
this->Capacity = NewCapacity;
|
||||
}
|
||||
|
||||
|
||||
/// SmallVectorTemplateBase<isPodLike = true> - This is where we put method
|
||||
/// implementations that are designed to work with POD-like T's.
|
||||
/// SmallVectorTemplateBase<TriviallyCopyable = true> - This is where we put
|
||||
/// method implementations that are designed to work with POD-like T's.
|
||||
template <typename T>
|
||||
class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
|
||||
protected:
|
||||
@ -326,12 +318,13 @@ class SmallVectorImpl : public SmallVectorTemplateBase<T> {
|
||||
public:
|
||||
using iterator = typename SuperClass::iterator;
|
||||
using const_iterator = typename SuperClass::const_iterator;
|
||||
using reference = typename SuperClass::reference;
|
||||
using size_type = typename SuperClass::size_type;
|
||||
|
||||
protected:
|
||||
// Default ctor - Initialize to empty.
|
||||
explicit SmallVectorImpl(unsigned N)
|
||||
: SmallVectorTemplateBase<T, isPodLike<T>::value>(N) {}
|
||||
: SmallVectorTemplateBase<T>(N) {}
|
||||
|
||||
public:
|
||||
SmallVectorImpl(const SmallVectorImpl &) = delete;
|
||||
@ -393,22 +386,18 @@ class SmallVectorImpl : public SmallVectorTemplateBase<T> {
|
||||
std::input_iterator_tag>::value>::type>
|
||||
void append(in_iter in_start, in_iter in_end) {
|
||||
size_type NumInputs = std::distance(in_start, in_end);
|
||||
// Grow allocated space if needed.
|
||||
if (NumInputs > this->capacity() - this->size())
|
||||
this->grow(this->size()+NumInputs);
|
||||
|
||||
// Copy the new elements over.
|
||||
this->uninitialized_copy(in_start, in_end, this->end());
|
||||
this->set_size(this->size() + NumInputs);
|
||||
}
|
||||
|
||||
/// Add the specified range to the end of the SmallVector.
|
||||
/// Append \p NumInputs copies of \p Elt to the end.
|
||||
void append(size_type NumInputs, const T &Elt) {
|
||||
// Grow allocated space if needed.
|
||||
if (NumInputs > this->capacity() - this->size())
|
||||
this->grow(this->size()+NumInputs);
|
||||
|
||||
// Copy the new elements over.
|
||||
std::uninitialized_fill_n(this->end(), NumInputs, Elt);
|
||||
this->set_size(this->size() + NumInputs);
|
||||
}
|
||||
@ -649,11 +638,12 @@ class SmallVectorImpl : public SmallVectorTemplateBase<T> {
|
||||
insert(I, IL.begin(), IL.end());
|
||||
}
|
||||
|
||||
template <typename... ArgTypes> void emplace_back(ArgTypes &&... Args) {
|
||||
template <typename... ArgTypes> reference emplace_back(ArgTypes &&... Args) {
|
||||
if (LLVM_UNLIKELY(this->size() >= this->capacity()))
|
||||
this->grow();
|
||||
::new ((void *)this->end()) T(std::forward<ArgTypes>(Args)...);
|
||||
this->set_size(this->size() + 1);
|
||||
return this->back();
|
||||
}
|
||||
|
||||
SmallVectorImpl &operator=(const SmallVectorImpl &RHS);
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SparseBitVector.h - Efficient Sparse BitVector --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SparseMultiSet.h - Sparse multiset --------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/SparseSet.h - Sparse set ------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/ADT/Statistic.h - Easy way to expose stats ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/StringExtras.h - Useful string functions --------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- StringMap.h - String Hash table map interface ------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -360,6 +359,11 @@ class StringMap : public StringMapImpl {
|
||||
return find(Key) == end() ? 0 : 1;
|
||||
}
|
||||
|
||||
template <typename InputTy>
|
||||
size_type count(const StringMapEntry<InputTy> &MapEntry) const {
|
||||
return count(MapEntry.getKey());
|
||||
}
|
||||
|
||||
/// insert - Insert the specified key/value pair into the map. If the key
|
||||
/// already exists in the map, return false and ignore the request, otherwise
|
||||
/// insert it and return true.
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- StringRef.h - Constant String Reference Wrapper ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@ -63,7 +62,6 @@ namespace llvm {
|
||||
|
||||
// Workaround memcmp issue with null pointers (undefined behavior)
|
||||
// by providing a specialized version
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
static int compareMemory(const char *Lhs, const char *Rhs, size_t Length) {
|
||||
if (Length == 0) { return 0; }
|
||||
return ::memcmp(Lhs,Rhs,Length);
|
||||
@ -81,17 +79,14 @@ namespace llvm {
|
||||
StringRef(std::nullptr_t) = delete;
|
||||
|
||||
/// Construct a string ref from a cstring.
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
/*implicit*/ StringRef(const char *Str)
|
||||
: Data(Str), Length(Str ? ::strlen(Str) : 0) {}
|
||||
|
||||
/// Construct a string ref from a pointer and length.
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
/*implicit*/ constexpr StringRef(const char *data, size_t length)
|
||||
: Data(data), Length(length) {}
|
||||
|
||||
/// Construct a string ref from an std::string.
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
/*implicit*/ StringRef(const std::string &Str)
|
||||
: Data(Str.data()), Length(Str.length()) {}
|
||||
|
||||
@ -124,17 +119,14 @@ namespace llvm {
|
||||
/// data - Get a pointer to the start of the string (which may not be null
|
||||
/// terminated).
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
const char *data() const { return Data; }
|
||||
|
||||
/// empty - Check if the string is empty.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool empty() const { return Length == 0; }
|
||||
|
||||
/// size - Get the string size.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
size_t size() const { return Length; }
|
||||
|
||||
/// front - Get the first character in the string.
|
||||
@ -165,7 +157,6 @@ namespace llvm {
|
||||
/// equals - Check for string equality, this is more efficient than
|
||||
/// compare() when the relative ordering of inequal strings isn't needed.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool equals(StringRef RHS) const {
|
||||
return (Length == RHS.Length &&
|
||||
compareMemory(Data, RHS.Data, RHS.Length) == 0);
|
||||
@ -180,7 +171,6 @@ namespace llvm {
|
||||
/// compare - Compare two strings; the result is -1, 0, or 1 if this string
|
||||
/// is lexicographically less than, equal to, or greater than the \p RHS.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
int compare(StringRef RHS) const {
|
||||
// Check the prefix for a mismatch.
|
||||
if (int Res = compareMemory(Data, RHS.Data, std::min(Length, RHS.Length)))
|
||||
@ -263,7 +253,6 @@ namespace llvm {
|
||||
|
||||
/// Check if this string starts with the given \p Prefix.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool startswith(StringRef Prefix) const {
|
||||
return Length >= Prefix.Length &&
|
||||
compareMemory(Data, Prefix.Data, Prefix.Length) == 0;
|
||||
@ -275,7 +264,6 @@ namespace llvm {
|
||||
|
||||
/// Check if this string ends with the given \p Suffix.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool endswith(StringRef Suffix) const {
|
||||
return Length >= Suffix.Length &&
|
||||
compareMemory(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0;
|
||||
@ -294,7 +282,6 @@ namespace llvm {
|
||||
/// \returns The index of the first occurrence of \p C, or npos if not
|
||||
/// found.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
size_t find(char C, size_t From = 0) const {
|
||||
size_t FindBegin = std::min(From, Length);
|
||||
if (FindBegin < Length) { // Avoid calling memchr with nullptr.
|
||||
@ -317,7 +304,6 @@ namespace llvm {
|
||||
/// \returns The index of the first character satisfying \p F starting from
|
||||
/// \p From, or npos if not found.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
size_t find_if(function_ref<bool(char)> F, size_t From = 0) const {
|
||||
StringRef S = drop_front(From);
|
||||
while (!S.empty()) {
|
||||
@ -333,7 +319,6 @@ namespace llvm {
|
||||
/// \returns The index of the first character not satisfying \p F starting
|
||||
/// from \p From, or npos if not found.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
size_t find_if_not(function_ref<bool(char)> F, size_t From = 0) const {
|
||||
return find_if([F](char c) { return !F(c); }, From);
|
||||
}
|
||||
@ -444,19 +429,16 @@ namespace llvm {
|
||||
/// Return true if the given string is a substring of *this, and false
|
||||
/// otherwise.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool contains(StringRef Other) const { return find(Other) != npos; }
|
||||
|
||||
/// Return true if the given character is contained in *this, and false
|
||||
/// otherwise.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool contains(char C) const { return find_first_of(C) != npos; }
|
||||
|
||||
/// Return true if the given string is a substring of *this, and false
|
||||
/// otherwise.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool contains_lower(StringRef Other) const {
|
||||
return find_lower(Other) != npos;
|
||||
}
|
||||
@ -464,7 +446,6 @@ namespace llvm {
|
||||
/// Return true if the given character is contained in *this, and false
|
||||
/// otherwise.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool contains_lower(char C) const { return find_lower(C) != npos; }
|
||||
|
||||
/// @}
|
||||
@ -594,7 +575,6 @@ namespace llvm {
|
||||
/// exceeds the number of characters remaining in the string, the string
|
||||
/// suffix (starting with \p Start) will be returned.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef substr(size_t Start, size_t N = npos) const {
|
||||
Start = std::min(Start, Length);
|
||||
return StringRef(Data + Start, std::min(N, Length - Start));
|
||||
@ -604,7 +584,6 @@ namespace llvm {
|
||||
/// elements remaining. If \p N is greater than the length of the
|
||||
/// string, the entire string is returned.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef take_front(size_t N = 1) const {
|
||||
if (N >= size())
|
||||
return *this;
|
||||
@ -615,7 +594,6 @@ namespace llvm {
|
||||
/// elements remaining. If \p N is greater than the length of the
|
||||
/// string, the entire string is returned.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef take_back(size_t N = 1) const {
|
||||
if (N >= size())
|
||||
return *this;
|
||||
@ -625,7 +603,6 @@ namespace llvm {
|
||||
/// Return the longest prefix of 'this' such that every character
|
||||
/// in the prefix satisfies the given predicate.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef take_while(function_ref<bool(char)> F) const {
|
||||
return substr(0, find_if_not(F));
|
||||
}
|
||||
@ -633,7 +610,6 @@ namespace llvm {
|
||||
/// Return the longest prefix of 'this' such that no character in
|
||||
/// the prefix satisfies the given predicate.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef take_until(function_ref<bool(char)> F) const {
|
||||
return substr(0, find_if(F));
|
||||
}
|
||||
@ -641,7 +617,6 @@ namespace llvm {
|
||||
/// Return a StringRef equal to 'this' but with the first \p N elements
|
||||
/// dropped.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef drop_front(size_t N = 1) const {
|
||||
assert(size() >= N && "Dropping more elements than exist");
|
||||
return substr(N);
|
||||
@ -650,7 +625,6 @@ namespace llvm {
|
||||
/// Return a StringRef equal to 'this' but with the last \p N elements
|
||||
/// dropped.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef drop_back(size_t N = 1) const {
|
||||
assert(size() >= N && "Dropping more elements than exist");
|
||||
return substr(0, size()-N);
|
||||
@ -659,7 +633,6 @@ namespace llvm {
|
||||
/// Return a StringRef equal to 'this', but with all characters satisfying
|
||||
/// the given predicate dropped from the beginning of the string.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef drop_while(function_ref<bool(char)> F) const {
|
||||
return substr(find_if_not(F));
|
||||
}
|
||||
@ -667,14 +640,12 @@ namespace llvm {
|
||||
/// Return a StringRef equal to 'this', but with all characters not
|
||||
/// satisfying the given predicate dropped from the beginning of the string.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef drop_until(function_ref<bool(char)> F) const {
|
||||
return substr(find_if(F));
|
||||
}
|
||||
|
||||
/// Returns true if this StringRef has the given prefix and removes that
|
||||
/// prefix.
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool consume_front(StringRef Prefix) {
|
||||
if (!startswith(Prefix))
|
||||
return false;
|
||||
@ -685,7 +656,6 @@ namespace llvm {
|
||||
|
||||
/// Returns true if this StringRef has the given suffix and removes that
|
||||
/// suffix.
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
bool consume_back(StringRef Suffix) {
|
||||
if (!endswith(Suffix))
|
||||
return false;
|
||||
@ -706,7 +676,6 @@ namespace llvm {
|
||||
/// will be returned. If this is less than \p Start, an empty string will
|
||||
/// be returned.
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringRef slice(size_t Start, size_t End) const {
|
||||
Start = std::min(Start, Length);
|
||||
End = std::min(std::max(Start, End), Length);
|
||||
@ -894,12 +863,10 @@ namespace llvm {
|
||||
/// @name StringRef Comparison Operators
|
||||
/// @{
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
inline bool operator==(StringRef LHS, StringRef RHS) {
|
||||
return LHS.equals(RHS);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
inline bool operator!=(StringRef LHS, StringRef RHS) { return !(LHS == RHS); }
|
||||
|
||||
inline bool operator<(StringRef LHS, StringRef RHS) {
|
||||
@ -928,10 +895,6 @@ namespace llvm {
|
||||
LLVM_NODISCARD
|
||||
hash_code hash_value(StringRef S);
|
||||
|
||||
// StringRefs can be treated like a POD type.
|
||||
template <typename T> struct isPodLike;
|
||||
template <> struct isPodLike<StringRef> { static const bool value = true; };
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_ADT_STRINGREF_H
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- StringSet.h - The LLVM Compiler Driver -------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open
|
||||
// Source License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
@ -34,6 +33,7 @@ namespace llvm {
|
||||
for (StringRef X : S)
|
||||
insert(X);
|
||||
}
|
||||
explicit StringSet(AllocatorTy A) : base(A) {}
|
||||
|
||||
std::pair<typename base::iterator, bool> insert(StringRef Key) {
|
||||
assert(!Key.empty());
|
||||
@ -45,6 +45,12 @@ namespace llvm {
|
||||
for (auto It = Begin; It != End; ++It)
|
||||
base::insert(std::make_pair(*It, '\0'));
|
||||
}
|
||||
|
||||
template <typename ValueTy>
|
||||
std::pair<typename base::iterator, bool>
|
||||
insert(const StringMapEntry<ValueTy> &MapEntry) {
|
||||
return insert(MapEntry.getKey());
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===--- StringSwitch.h - Switch-on-literal-string Construct --------------===/
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//===----------------------------------------------------------------------===/
|
||||
//
|
||||
// This file implements the StringSwitch template, which mimics a switch()
|
||||
@ -49,7 +48,6 @@ class StringSwitch {
|
||||
Optional<T> Result;
|
||||
|
||||
public:
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
explicit StringSwitch(StringRef S)
|
||||
: Str(S), Result() { }
|
||||
|
||||
@ -66,7 +64,6 @@ class StringSwitch {
|
||||
~StringSwitch() = default;
|
||||
|
||||
// Case-sensitive case matchers
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Case(StringLiteral S, T Value) {
|
||||
if (!Result && Str == S) {
|
||||
Result = std::move(Value);
|
||||
@ -74,7 +71,6 @@ class StringSwitch {
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch& EndsWith(StringLiteral S, T Value) {
|
||||
if (!Result && Str.endswith(S)) {
|
||||
Result = std::move(Value);
|
||||
@ -82,7 +78,6 @@ class StringSwitch {
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch& StartsWith(StringLiteral S, T Value) {
|
||||
if (!Result && Str.startswith(S)) {
|
||||
Result = std::move(Value);
|
||||
@ -90,51 +85,43 @@ class StringSwitch {
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, T Value) {
|
||||
return Case(S0, Value).Case(S1, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
T Value) {
|
||||
return Case(S0, Value).Cases(S1, S2, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, T Value) {
|
||||
return Case(S0, Value).Cases(S1, S2, S3, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, StringLiteral S4, T Value) {
|
||||
return Case(S0, Value).Cases(S1, S2, S3, S4, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, StringLiteral S4, StringLiteral S5,
|
||||
T Value) {
|
||||
return Case(S0, Value).Cases(S1, S2, S3, S4, S5, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, StringLiteral S4, StringLiteral S5,
|
||||
StringLiteral S6, T Value) {
|
||||
return Case(S0, Value).Cases(S1, S2, S3, S4, S5, S6, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, StringLiteral S4, StringLiteral S5,
|
||||
StringLiteral S6, StringLiteral S7, T Value) {
|
||||
return Case(S0, Value).Cases(S1, S2, S3, S4, S5, S6, S7, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, StringLiteral S4, StringLiteral S5,
|
||||
StringLiteral S6, StringLiteral S7, StringLiteral S8,
|
||||
@ -142,7 +129,6 @@ class StringSwitch {
|
||||
return Case(S0, Value).Cases(S1, S2, S3, S4, S5, S6, S7, S8, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &Cases(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, StringLiteral S4, StringLiteral S5,
|
||||
StringLiteral S6, StringLiteral S7, StringLiteral S8,
|
||||
@ -151,7 +137,6 @@ class StringSwitch {
|
||||
}
|
||||
|
||||
// Case-insensitive case matchers.
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &CaseLower(StringLiteral S, T Value) {
|
||||
if (!Result && Str.equals_lower(S))
|
||||
Result = std::move(Value);
|
||||
@ -159,7 +144,6 @@ class StringSwitch {
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &EndsWithLower(StringLiteral S, T Value) {
|
||||
if (!Result && Str.endswith_lower(S))
|
||||
Result = Value;
|
||||
@ -167,7 +151,6 @@ class StringSwitch {
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &StartsWithLower(StringLiteral S, T Value) {
|
||||
if (!Result && Str.startswith_lower(S))
|
||||
Result = std::move(Value);
|
||||
@ -175,31 +158,26 @@ class StringSwitch {
|
||||
return *this;
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, T Value) {
|
||||
return CaseLower(S0, Value).CaseLower(S1, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
T Value) {
|
||||
return CaseLower(S0, Value).CasesLower(S1, S2, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, T Value) {
|
||||
return CaseLower(S0, Value).CasesLower(S1, S2, S3, Value);
|
||||
}
|
||||
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
StringSwitch &CasesLower(StringLiteral S0, StringLiteral S1, StringLiteral S2,
|
||||
StringLiteral S3, StringLiteral S4, T Value) {
|
||||
return CaseLower(S0, Value).CasesLower(S1, S2, S3, S4, Value);
|
||||
}
|
||||
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
R Default(T Value) {
|
||||
if (Result)
|
||||
return std::move(*Result);
|
||||
@ -207,7 +185,6 @@ class StringSwitch {
|
||||
}
|
||||
|
||||
LLVM_NODISCARD
|
||||
LLVM_ATTRIBUTE_ALWAYS_INLINE
|
||||
operator R() {
|
||||
assert(Result && "Fell off the end of a string-switch");
|
||||
return std::move(*Result);
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/TinyPtrVector.h - 'Normally tiny' vectors -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===-- llvm/ADT/Triple.h - Target triple helper class ----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@ -50,6 +49,7 @@ class Triple {
|
||||
armeb, // ARM (big endian): armeb
|
||||
aarch64, // AArch64 (little endian): aarch64
|
||||
aarch64_be, // AArch64 (big endian): aarch64_be
|
||||
aarch64_32, // AArch64 (little endian) ILP32: aarch64_32
|
||||
arc, // ARC: Synopsys ARC
|
||||
avr, // AVR: Atmel AVR microcontroller
|
||||
bpfel, // eBPF or extended BPF or 64-bit BPF (little endian)
|
||||
@ -109,6 +109,7 @@ class Triple {
|
||||
ARMSubArch_v8r,
|
||||
ARMSubArch_v8m_baseline,
|
||||
ARMSubArch_v8m_mainline,
|
||||
ARMSubArch_v8_1m_mainline,
|
||||
ARMSubArch_v7,
|
||||
ARMSubArch_v7em,
|
||||
ARMSubArch_v7m,
|
||||
@ -187,7 +188,8 @@ class Triple {
|
||||
HermitCore, // HermitCore Unikernel/Multikernel
|
||||
Hurd, // GNU/Hurd
|
||||
WASI, // Experimental WebAssembly OS
|
||||
LastOSType = WASI
|
||||
Emscripten,
|
||||
LastOSType = Emscripten
|
||||
};
|
||||
enum EnvironmentType {
|
||||
UnknownEnvironment,
|
||||
@ -201,6 +203,8 @@ class Triple {
|
||||
CODE16,
|
||||
EABI,
|
||||
EABIHF,
|
||||
ELFv1,
|
||||
ELFv2,
|
||||
Android,
|
||||
Musl,
|
||||
MuslEABI,
|
||||
@ -210,8 +214,9 @@ class Triple {
|
||||
Itanium,
|
||||
Cygnus,
|
||||
CoreCLR,
|
||||
Simulator, // Simulator variants of other systems, e.g., Apple's iOS
|
||||
LastEnvironmentType = Simulator
|
||||
Simulator, // Simulator variants of other systems, e.g., Apple's iOS
|
||||
MacABI, // Mac Catalyst variant of Apple's iOS deployment target.
|
||||
LastEnvironmentType = MacABI
|
||||
};
|
||||
enum ObjectFormatType {
|
||||
UnknownObjectFormat,
|
||||
@ -220,6 +225,7 @@ class Triple {
|
||||
ELF,
|
||||
MachO,
|
||||
Wasm,
|
||||
XCOFF,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -415,7 +421,7 @@ class Triple {
|
||||
if (LHS[1] != Minor)
|
||||
return LHS[1] < Minor;
|
||||
if (LHS[2] != Micro)
|
||||
return LHS[1] < Micro;
|
||||
return LHS[2] < Micro;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -480,6 +486,10 @@ class Triple {
|
||||
return getEnvironment() == Triple::Simulator;
|
||||
}
|
||||
|
||||
bool isMacCatalystEnvironment() const {
|
||||
return getEnvironment() == Triple::MacABI;
|
||||
}
|
||||
|
||||
bool isOSNetBSD() const {
|
||||
return getOS() == Triple::NetBSD;
|
||||
}
|
||||
@ -524,32 +534,36 @@ class Triple {
|
||||
return getOS() == Triple::Haiku;
|
||||
}
|
||||
|
||||
/// Checks if the environment could be MSVC.
|
||||
bool isWindowsMSVCEnvironment() const {
|
||||
return getOS() == Triple::Win32 &&
|
||||
(getEnvironment() == Triple::UnknownEnvironment ||
|
||||
getEnvironment() == Triple::MSVC);
|
||||
/// Tests whether the OS is Windows.
|
||||
bool isOSWindows() const {
|
||||
return getOS() == Triple::Win32;
|
||||
}
|
||||
|
||||
/// Checks if the environment is MSVC.
|
||||
bool isKnownWindowsMSVCEnvironment() const {
|
||||
return getOS() == Triple::Win32 && getEnvironment() == Triple::MSVC;
|
||||
return isOSWindows() && getEnvironment() == Triple::MSVC;
|
||||
}
|
||||
|
||||
/// Checks if the environment could be MSVC.
|
||||
bool isWindowsMSVCEnvironment() const {
|
||||
return isKnownWindowsMSVCEnvironment() ||
|
||||
(isOSWindows() && getEnvironment() == Triple::UnknownEnvironment);
|
||||
}
|
||||
|
||||
bool isWindowsCoreCLREnvironment() const {
|
||||
return getOS() == Triple::Win32 && getEnvironment() == Triple::CoreCLR;
|
||||
return isOSWindows() && getEnvironment() == Triple::CoreCLR;
|
||||
}
|
||||
|
||||
bool isWindowsItaniumEnvironment() const {
|
||||
return getOS() == Triple::Win32 && getEnvironment() == Triple::Itanium;
|
||||
return isOSWindows() && getEnvironment() == Triple::Itanium;
|
||||
}
|
||||
|
||||
bool isWindowsCygwinEnvironment() const {
|
||||
return getOS() == Triple::Win32 && getEnvironment() == Triple::Cygnus;
|
||||
return isOSWindows() && getEnvironment() == Triple::Cygnus;
|
||||
}
|
||||
|
||||
bool isWindowsGNUEnvironment() const {
|
||||
return getOS() == Triple::Win32 && getEnvironment() == Triple::GNU;
|
||||
return isOSWindows() && getEnvironment() == Triple::GNU;
|
||||
}
|
||||
|
||||
/// Tests for either Cygwin or MinGW OS
|
||||
@ -563,11 +577,6 @@ class Triple {
|
||||
isWindowsItaniumEnvironment();
|
||||
}
|
||||
|
||||
/// Tests whether the OS is Windows.
|
||||
bool isOSWindows() const {
|
||||
return getOS() == Triple::Win32;
|
||||
}
|
||||
|
||||
/// Tests whether the OS is NaCl (Native Client)
|
||||
bool isOSNaCl() const {
|
||||
return getOS() == Triple::NaCl;
|
||||
@ -593,6 +602,11 @@ class Triple {
|
||||
return getOS() == Triple::WASI;
|
||||
}
|
||||
|
||||
/// Tests whether the OS is Emscripten.
|
||||
bool isOSEmscripten() const {
|
||||
return getOS() == Triple::Emscripten;
|
||||
}
|
||||
|
||||
/// Tests whether the OS uses glibc.
|
||||
bool isOSGlibc() const {
|
||||
return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
|
||||
@ -600,6 +614,11 @@ class Triple {
|
||||
!isAndroid();
|
||||
}
|
||||
|
||||
/// Tests whether the OS is AIX.
|
||||
bool isOSAIX() const {
|
||||
return getOS() == Triple::AIX;
|
||||
}
|
||||
|
||||
/// Tests whether the OS uses the ELF binary format.
|
||||
bool isOSBinFormatELF() const {
|
||||
return getObjectFormat() == Triple::ELF;
|
||||
@ -620,6 +639,11 @@ class Triple {
|
||||
return getObjectFormat() == Triple::Wasm;
|
||||
}
|
||||
|
||||
/// Tests whether the OS uses the XCOFF binary format.
|
||||
bool isOSBinFormatXCOFF() const {
|
||||
return getObjectFormat() == Triple::XCOFF;
|
||||
}
|
||||
|
||||
/// Tests whether the target is the PS4 CPU
|
||||
bool isPS4CPU() const {
|
||||
return getArch() == Triple::x86_64 &&
|
||||
@ -656,6 +680,11 @@ class Triple {
|
||||
getEnvironment() == Triple::MuslEABIHF;
|
||||
}
|
||||
|
||||
/// Tests whether the target is SPIR (32- or 64-bit).
|
||||
bool isSPIR() const {
|
||||
return getArch() == Triple::spir || getArch() == Triple::spir64;
|
||||
}
|
||||
|
||||
/// Tests whether the target is NVPTX (32- or 64-bit).
|
||||
bool isNVPTX() const {
|
||||
return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;
|
||||
@ -691,6 +720,16 @@ class Triple {
|
||||
return isMIPS32() || isMIPS64();
|
||||
}
|
||||
|
||||
/// Tests whether the target is 64-bit PowerPC (little and big endian).
|
||||
bool isPPC64() const {
|
||||
return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
|
||||
}
|
||||
|
||||
/// Tests whether the target is RISC-V (32- and 64-bit).
|
||||
bool isRISCV() const {
|
||||
return getArch() == Triple::riscv32 || getArch() == Triple::riscv64;
|
||||
}
|
||||
|
||||
/// Tests whether the target supports comdat
|
||||
bool supportsCOMDAT() const {
|
||||
return !isOSBinFormatMachO();
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- Twine.h - Fast Temporary String Concatenation ------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
@ -274,6 +273,9 @@ namespace llvm {
|
||||
|
||||
assert(isValid() && "Invalid twine!");
|
||||
}
|
||||
/// Delete the implicit conversion from nullptr as Twine(const char *)
|
||||
/// cannot take nullptr.
|
||||
/*implicit*/ Twine(std::nullptr_t) = delete;
|
||||
|
||||
/// Construct from an std::string.
|
||||
/*implicit*/ Twine(const std::string &Str) : LHSKind(StdStringKind) {
|
||||
|
@ -1,9 +1,8 @@
|
||||
//===- llvm/ADT/UniqueVector.h ----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user