Skip to content

Commit 1ce6b1d

Browse files
committed
Merge branch 'mainline'
2 parents f62e532 + a6891df commit 1ce6b1d

6,515 files changed

Lines changed: 468129 additions & 81492 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/llvm/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ cscope.out
4141
autoconf/aclocal.m4
4242
autoconf/autom4te.cache
4343
/compile_commands.json
44+
# Visual Studio built-in CMake configuration
45+
/CMakeSettings.json
4446

4547
#==============================================================================#
4648
# Directories to ignore (do not add trailing '/'s, they skip symlinks).

src/llvm/CMakeLists.txt

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ if(POLICY CMP0068)
77
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
88
endif()
99

10+
if(POLICY CMP0075)
11+
cmake_policy(SET CMP0075 NEW)
12+
endif()
13+
1014
if(NOT DEFINED LLVM_VERSION_MAJOR)
1115
set(LLVM_VERSION_MAJOR 8)
1216
endif()
@@ -183,6 +187,11 @@ option(LLVM_INSTALL_UTILS "Include utility binaries in the 'install' target." OF
183187

184188
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
185189

190+
# Unfortunatly Clang is too eager to search directories for module maps, which can cause the
191+
# installed version of the maps to be found when building LLVM from source. Therefore we turn off
192+
# the installation by default. See llvm.org/PR31905.
193+
option(LLVM_INSTALL_MODULEMAPS "Install the modulemap files in the 'install' target." OFF)
194+
186195
option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
187196
if ( LLVM_USE_FOLDERS )
188197
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
@@ -395,8 +404,8 @@ option(LLVM_USE_OPROFILE
395404
option(LLVM_EXTERNALIZE_DEBUGINFO
396405
"Generate dSYM files and strip executables and libraries (Darwin Only)" OFF)
397406

398-
option(LLVM_CODESIGNING_IDENTITY
399-
"Sign executables and dylibs with the given identity (Darwin Only)" OFF)
407+
set(LLVM_CODESIGNING_IDENTITY "" CACHE STRING
408+
"Sign executables and dylibs with the given identity or skip if empty (Darwin Only)")
400409

401410
# If enabled, verify we are on a platform that supports oprofile.
402411
if( LLVM_USE_OPROFILE )
@@ -855,7 +864,7 @@ if( LLVM_INCLUDE_UTILS )
855864
else()
856865
if ( LLVM_INCLUDE_TESTS )
857866
message(FATAL_ERROR "Including tests when not building utils will not work.
858-
Either set LLVM_INCLUDE_UTILS to On, or set LLVM_INCLDE_TESTS to Off.")
867+
Either set LLVM_INCLUDE_UTILS to On, or set LLVM_INCLUDE_TESTS to Off.")
859868
endif()
860869
endif()
861870

@@ -969,6 +978,20 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
969978
PATTERN ".svn" EXCLUDE
970979
)
971980

981+
if (LLVM_INSTALL_MODULEMAPS)
982+
install(DIRECTORY include/llvm include/llvm-c
983+
DESTINATION include
984+
COMPONENT llvm-headers
985+
FILES_MATCHING
986+
PATTERN "module.modulemap"
987+
)
988+
install(FILES include/llvm/module.install.modulemap
989+
DESTINATION include/llvm
990+
COMPONENT llvm-headers
991+
RENAME "module.extern.modulemap"
992+
)
993+
endif(LLVM_INSTALL_MODULEMAPS)
994+
972995
# Installing the headers needs to depend on generating any public
973996
# tablegen'd headers.
974997
add_custom_target(llvm-headers DEPENDS intrinsics_gen)

src/llvm/CREDITS.TXT

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ D: Thread Local Storage implementation
492492
N: Bill Wendling
493493
I: wendling
494494
E: isanbard@gmail.com
495-
D: Release manager, IR Linker, LTO
496-
D: Bunches of stuff
495+
D: Release manager, IR Linker, LTO.
496+
D: Bunches of stuff.
497497

498498
N: Bob Wilson
499499
E: bob.wilson@acm.org
@@ -502,3 +502,11 @@ D: Advanced SIMD (NEON) support in the ARM backend.
502502
N: QingShan Zhang
503503
E: qshanz@cn.ibm.com
504504
D: PowerPC Backend Developer
505+
506+
N: Li Jia He
507+
E: hljhehlj@cn.ibm.com
508+
D: PowerPC Backend Developer
509+
510+
N: Zixuan Wu
511+
E: wuzish@cn.ibm.com
512+
D: PowerPC Backend Developer

src/llvm/RELEASE_TESTERS.TXT

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ E: hans@chromium.org
4141
T: x86
4242
O: Windows
4343

44-
N: Diana Picus
45-
E: diana.picus@linaro.org
44+
N: Diana Picus, Yvan Roux
45+
E: diana.picus@linaro.org, yvan.roux@linaro.org
4646
T: ARM, AArch64
4747
O: Linux

src/llvm/bindings/go/llvm/ir.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,6 @@ func (v Value) IsAPHINode() (rv Value) { rv.C = C.LLVMIsAPHINode(v.C
739739
func (v Value) IsASelectInst() (rv Value) { rv.C = C.LLVMIsASelectInst(v.C); return }
740740
func (v Value) IsAShuffleVectorInst() (rv Value) { rv.C = C.LLVMIsAShuffleVectorInst(v.C); return }
741741
func (v Value) IsAStoreInst() (rv Value) { rv.C = C.LLVMIsAStoreInst(v.C); return }
742-
func (v Value) IsATerminatorInst() (rv Value) { rv.C = C.LLVMIsATerminatorInst(v.C); return }
743742
func (v Value) IsABranchInst() (rv Value) { rv.C = C.LLVMIsABranchInst(v.C); return }
744743
func (v Value) IsAInvokeInst() (rv Value) { rv.C = C.LLVMIsAInvokeInst(v.C); return }
745744
func (v Value) IsAReturnInst() (rv Value) { rv.C = C.LLVMIsAReturnInst(v.C); return }
@@ -1259,6 +1258,19 @@ func InlineAsm(t Type, asmString, constraints string, hasSideEffects, isAlignSta
12591258
return
12601259
}
12611260

1261+
// Operations on aggregates
1262+
func (v Value) Indices() []uint32 {
1263+
num := C.LLVMGetNumIndices(v.C)
1264+
indicesPtr := C.LLVMGetIndices(v.C)
1265+
// https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices
1266+
rawIndices := (*[1 << 30]C.uint)(unsafe.Pointer(indicesPtr))[:num:num]
1267+
indices := make([]uint32, num)
1268+
for i := range indices {
1269+
indices[i] = uint32(rawIndices[i])
1270+
}
1271+
return indices
1272+
}
1273+
12621274
//-------------------------------------------------------------------------
12631275
// llvm.Builder
12641276
//-------------------------------------------------------------------------

src/llvm/bindings/ocaml/llvm/llvm.mli

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,16 +1887,16 @@ val set_volatile : bool -> llvalue -> unit
18871887
val is_terminator : llvalue -> bool
18881888

18891889
(** [successor v i] returns the successor at index [i] for the value [v].
1890-
See the method [llvm::TerminatorInst::getSuccessor]. *)
1890+
See the method [llvm::Instruction::getSuccessor]. *)
18911891
val successor : llvalue -> int -> llbasicblock
18921892

18931893
(** [set_successor v i o] sets the successor of the value [v] at the index [i] to
18941894
the value [o].
1895-
See the method [llvm::TerminatorInst::setSuccessor]. *)
1895+
See the method [llvm::Instruction::setSuccessor]. *)
18961896
val set_successor : llvalue -> int -> llbasicblock -> unit
18971897

18981898
(** [num_successors v] returns the number of successors for the value [v].
1899-
See the method [llvm::TerminatorInst::getNumSuccessors]. *)
1899+
See the method [llvm::Instruction::getNumSuccessors]. *)
19001900
val num_successors : llvalue -> int
19011901

19021902
(** [successors v] returns the successors of [v]. *)

src/llvm/bindings/ocaml/llvm/llvm_ocaml.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@ CAMLprim value llvm_struct_set_body(LLVMTypeRef Ty,
483483
CAMLprim value llvm_struct_name(LLVMTypeRef Ty)
484484
{
485485
CAMLparam0();
486+
CAMLlocal1(result);
486487
const char *C = LLVMGetStructName(Ty);
487488
if (C) {
488-
CAMLlocal1(result);
489489
result = caml_alloc_small(1, 0);
490490
Store_field(result, 0, caml_copy_string(C));
491491
CAMLreturn(result);
@@ -636,6 +636,7 @@ enum ValueKind {
636636

637637
CAMLprim value llvm_classify_value(LLVMValueRef Val) {
638638
CAMLparam0();
639+
CAMLlocal1(result);
639640
if (!Val)
640641
CAMLreturn(Val_int(NullValue));
641642
if (LLVMIsAConstant(Val)) {
@@ -652,7 +653,6 @@ CAMLprim value llvm_classify_value(LLVMValueRef Val) {
652653
DEFINE_CASE(Val, ConstantVector);
653654
}
654655
if (LLVMIsAInstruction(Val)) {
655-
CAMLlocal1(result);
656656
result = caml_alloc_small(1, 0);
657657
Store_field(result, 0, Val_int(LLVMGetInstructionOpcode(Val)));
658658
CAMLreturn(result);
@@ -822,12 +822,11 @@ CAMLprim LLVMValueRef llvm_mdnull(LLVMContextRef C) {
822822
/* llvalue -> string option */
823823
CAMLprim value llvm_get_mdstring(LLVMValueRef V) {
824824
CAMLparam0();
825+
CAMLlocal2(Option, Str);
825826
const char *S;
826827
unsigned Len;
827828

828829
if ((S = LLVMGetMDString(V, &Len))) {
829-
CAMLlocal2(Option, Str);
830-
831830
Str = caml_alloc_string(Len);
832831
memcpy(String_val(Str), S, Len);
833832
Option = alloc(1,0);

src/llvm/cmake/config-ix.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
128128
endif()
129129
if(LLVM_ENABLE_TERMINFO)
130130
set(HAVE_TERMINFO 0)
131-
foreach(library tinfo terminfo curses ncurses ncursesw)
131+
foreach(library terminfo tinfo curses ncurses ncursesw)
132132
string(TOUPPER ${library} library_suffix)
133133
check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
134134
if(HAVE_TERMINFO_${library_suffix})

src/llvm/cmake/modules/AddLLVM.cmake

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ function(llvm_add_library name)
580580

581581
if(ARG_SHARED OR ARG_MODULE)
582582
llvm_externalize_debuginfo(${name})
583-
llvm_codesign(${name})
583+
llvm_codesign(TARGET ${name})
584584
endif()
585585
endfunction()
586586

@@ -635,6 +635,7 @@ macro(add_llvm_library name)
635635
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
636636
else()
637637
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" OR
638+
${name} STREQUAL "OptRemarks" OR
638639
(LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
639640
set(install_dir lib${LLVM_LIBDIR_SUFFIX})
640641
if(ARG_SHARED OR BUILD_SHARED_LIBS)
@@ -707,7 +708,12 @@ endmacro(add_llvm_loadable_module name)
707708

708709

709710
macro(add_llvm_executable name)
710-
cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "DEPENDS" ${ARGN})
711+
cmake_parse_arguments(ARG
712+
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
713+
"ENTITLEMENTS"
714+
"DEPENDS"
715+
${ARGN})
716+
711717
llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} )
712718

713719
list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS})
@@ -786,7 +792,7 @@ macro(add_llvm_executable name)
786792
target_link_libraries(${name} PRIVATE ${LLVM_PTHREAD_LIB})
787793
endif()
788794

789-
llvm_codesign(${name})
795+
llvm_codesign(TARGET ${name} ENTITLEMENTS ${ARG_ENTITLEMENTS})
790796
endmacro(add_llvm_executable name)
791797

792798
function(export_executable_symbols target)
@@ -1368,16 +1374,6 @@ function(add_lit_target target comment)
13681374
message(STATUS "${target} does nothing.")
13691375
endif()
13701376

1371-
# Add lit test dependencies.
1372-
set(llvm_utils_deps
1373-
FileCheck count not
1374-
)
1375-
foreach(dep ${llvm_utils_deps})
1376-
if (TARGET ${dep})
1377-
add_dependencies(${target} ${dep})
1378-
endif()
1379-
endforeach()
1380-
13811377
if (ARG_DEPENDS)
13821378
add_dependencies(${target} ${ARG_DEPENDS})
13831379
endif()
@@ -1625,7 +1621,14 @@ function(llvm_externalize_debuginfo name)
16251621
endif()
16261622
endfunction()
16271623

1628-
function(llvm_codesign name)
1624+
# Usage: llvm_codesign(TARGET name [ENTITLEMENTS file])
1625+
#
1626+
# Code-sign the given TARGET with the global LLVM_CODESIGNING_IDENTITY or skip
1627+
# if undefined. Customize capabilities by passing a file path to ENTITLEMENTS.
1628+
#
1629+
function(llvm_codesign)
1630+
cmake_parse_arguments(ARG "" "TARGET;ENTITLEMENTS" "" ${ARGN})
1631+
16291632
if(NOT LLVM_CODESIGNING_IDENTITY)
16301633
return()
16311634
endif()
@@ -1641,12 +1644,16 @@ function(llvm_codesign name)
16411644
OUTPUT_VARIABLE CMAKE_CODESIGN_ALLOCATE
16421645
)
16431646
endif()
1647+
if(DEFINED ARG_ENTITLEMENTS)
1648+
set(PASS_ENTITLEMENTS --entitlements ${ARG_ENTITLEMENTS})
1649+
endif()
1650+
16441651
add_custom_command(
1645-
TARGET ${name} POST_BUILD
1652+
TARGET ${ARG_TARGET} POST_BUILD
16461653
COMMAND ${CMAKE_COMMAND} -E
16471654
env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE}
16481655
${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY}
1649-
$<TARGET_FILE:${name}>
1656+
${PASS_ENTITLEMENTS} $<TARGET_FILE:${ARG_TARGET}>
16501657
)
16511658
endif()
16521659
endfunction()

src/llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ endif()
138138
# build might work on ELF but fail on MachO/COFF.
139139
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
140140
${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
141-
${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
141+
${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" OR
142+
${CMAKE_SYSTEM_NAME} MATCHES "DragonFly") AND
142143
NOT LLVM_USE_SANITIZER)
143144
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")
144145
endif()
@@ -224,6 +225,10 @@ if(NOT WIN32 AND NOT CYGWIN)
224225
append_if(SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG "-fvisibility-inlines-hidden" CMAKE_CXX_FLAGS)
225226
endif()
226227

228+
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MINGW)
229+
add_definitions( -D_FILE_OFFSET_BITS=64 )
230+
endif()
231+
227232
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
228233
# TODO: support other platforms and toolchains.
229234
if( LLVM_BUILD_32_BITS )
@@ -508,6 +513,10 @@ if (MSVC)
508513
# Update 1. Re-evaluate the usefulness of this diagnostic with Update 2.
509514
-wd4592 # Suppress ''var': symbol will be dynamically initialized (implementation limitation)
510515
-wd4319 # Suppress ''operator' : zero extending 'type' to 'type' of greater size'
516+
# C4709 is disabled because of a bug with Visual Studio 2017 as of
517+
# v15.8.8. Re-evaluate the usefulness of this diagnostic when the bug
518+
# is fixed.
519+
-wd4709 # Suppress comma operator within array index expression
511520

512521
# Ideally, we'd like this warning to be enabled, but MSVC 2013 doesn't
513522
# support the 'aligned' attribute in the way that clang sources requires (for
@@ -576,6 +585,7 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
576585
append("-Wno-long-long" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
577586
endif()
578587

588+
add_flag_if_supported("-Wimplicit-fallthrough" IMPLICIT_FALLTHROUGH_FLAG)
579589
add_flag_if_supported("-Wcovered-switch-default" COVERED_SWITCH_DEFAULT_FLAG)
580590
append_if(USE_NO_UNINITIALIZED "-Wno-uninitialized" CMAKE_CXX_FLAGS)
581591
append_if(USE_NO_MAYBE_UNINITIALIZED "-Wno-maybe-uninitialized" CMAKE_CXX_FLAGS)

0 commit comments

Comments
 (0)