Skip to content

Commit 985d9f1

Browse files
committed
Creating branches/google/stable and tags/google/stable/2018-10-04 from r343360
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/google/stable@343826 91177308-0d34-0410-b5e6-96231b3b80d8
2 parents 8b1a840 + 770516e commit 985d9f1

File tree

3,404 files changed

+198657
-54868
lines changed

Some content is hidden

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

3,404 files changed

+198657
-54868
lines changed

CMakeLists.txt

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
cmake_minimum_required(VERSION 3.4.3)
44

5-
# CMake 3.1 and higher include generator expressions of the form
6-
# $<TARGETLIB:obj> in the SOURCES property. These need to be
7-
# stripped everywhere that access the SOURCES property, so we just
8-
# defer to the OLD behavior of not including generator expressions
9-
# in the output for now.
10-
cmake_policy(SET CMP0051 OLD)
11-
125
if(POLICY CMP0068)
136
cmake_policy(SET CMP0068 NEW)
147
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
@@ -320,6 +313,8 @@ if(LLVM_ENABLE_CRASH_OVERRIDES)
320313
set(ENABLE_CRASH_OVERRIDES 1)
321314
endif()
322315

316+
option(LLVM_ENABLE_CRASH_DUMPS "Turn on memory dumps on crashes. Currently only implemented on Windows." OFF)
317+
323318
option(LLVM_ENABLE_FFI "Use libffi to call external functions from the interpreter" OFF)
324319
set(FFI_LIBRARY_DIR "" CACHE PATH "Additional directory, where CMake should search for libffi.so")
325320
set(FFI_INCLUDE_DIR "" CACHE PATH "Additional directory, where CMake should search for ffi.h or ffi/ffi.h")
@@ -498,6 +493,10 @@ option(LLVM_BUILD_TESTS
498493
option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON)
499494
option(LLVM_INCLUDE_GO_TESTS "Include the Go bindings tests in test build targets." ON)
500495

496+
option(LLVM_BUILD_BENCHMARKS "Add LLVM benchmark targets to the list of default
497+
targets. If OFF, benchmarks still could be built using Benchmarks target." OFF)
498+
option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks can't be built." ON)
499+
501500
option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF)
502501
option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON)
503502
option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OFF)
@@ -979,6 +978,27 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
979978
DEPENDS llvm-headers
980979
COMPONENT llvm-headers)
981980
endif()
981+
982+
# Custom target to install all libraries.
983+
add_custom_target(llvm-libraries)
984+
set_target_properties(llvm-libraries PROPERTIES FOLDER "Misc")
985+
986+
if (NOT CMAKE_CONFIGURATION_TYPES)
987+
add_llvm_install_targets(install-llvm-libraries
988+
DEPENDS llvm-libraries
989+
COMPONENT llvm-libraries)
990+
endif()
991+
992+
get_property(LLVM_LIBS GLOBAL PROPERTY LLVM_LIBS)
993+
if(LLVM_LIBS)
994+
list(REMOVE_DUPLICATES LLVM_LIBS)
995+
foreach(lib ${LLVM_LIBS})
996+
add_dependencies(llvm-libraries ${lib})
997+
if (NOT CMAKE_CONFIGURATION_TYPES)
998+
add_dependencies(install-llvm-libraries install-${lib})
999+
endif()
1000+
endforeach()
1001+
endif()
9821002
endif()
9831003

9841004
# This must be at the end of the LLVM root CMakeLists file because it must run
@@ -1018,3 +1038,18 @@ endif()
10181038
if (MSVC AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_INSTALL_UCRT_LIBRARIES)
10191039
include(InstallRequiredSystemLibraries)
10201040
endif()
1041+
1042+
if (LLVM_INCLUDE_BENCHMARKS)
1043+
# Override benchmark defaults so that when the library itself is updated these
1044+
# modifications are not lost.
1045+
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing" FORCE)
1046+
set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "Disable benchmark exceptions" FORCE)
1047+
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Don't install benchmark" FORCE)
1048+
set(BENCHMARK_DOWNLOAD_DEPENDENCIES OFF CACHE BOOL "Don't download dependencies" FORCE)
1049+
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Disable Google Test in benchmark" FORCE)
1050+
# Since LLVM requires C++11 it is safe to assume that std::regex is available.
1051+
set(HAVE_STD_REGEX ON CACHE BOOL "OK" FORCE)
1052+
1053+
add_subdirectory(utils/benchmark)
1054+
add_subdirectory(benchmarks)
1055+
endif()

benchmarks/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
set(LLVM_LINK_COMPONENTS
2+
Support)
3+
4+
add_benchmark(DummyYAML DummyYAML.cpp)

benchmarks/DummyYAML.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "benchmark/benchmark.h"
2+
#include "llvm/Support/YAMLTraits.h"
3+
4+
static void BM_YAMLDummyIsNumeric(benchmark::State& state) {
5+
std::string x = "hello";
6+
for (auto _ : state) {
7+
std::string copy(x);
8+
llvm::yaml::isNumeric(copy);
9+
}
10+
}
11+
BENCHMARK(BM_YAMLDummyIsNumeric);
12+
13+
BENCHMARK_MAIN();

bindings/go/llvm/dibuilder.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func (d *DIBuilder) CreateBasicType(t DIBasicType) Metadata {
298298
name,
299299
C.size_t(len(t.Name)),
300300
C.uint64_t(t.SizeInBits),
301-
C.unsigned(t.Encoding),
301+
C.LLVMDWARFTypeEncoding(t.Encoding),
302302
C.LLVMDIFlags(0),
303303
)
304304
return Metadata{C: result}
@@ -565,15 +565,19 @@ func (d *DIBuilder) CreateExpression(addr []int64) Metadata {
565565

566566
// InsertDeclareAtEnd inserts a call to llvm.dbg.declare at the end of the
567567
// specified basic block for the given value and associated debug metadata.
568-
func (d *DIBuilder) InsertDeclareAtEnd(v Value, diVarInfo, expr Metadata, bb BasicBlock) Value {
569-
result := C.LLVMDIBuilderInsertDeclareAtEnd(d.ref, v.C, diVarInfo.C, expr.C, nil, bb.C)
568+
func (d *DIBuilder) InsertDeclareAtEnd(v Value, diVarInfo, expr Metadata, l DebugLoc, bb BasicBlock) Value {
569+
loc := C.LLVMDIBuilderCreateDebugLocation(
570+
d.m.Context().C, C.uint(l.Line), C.uint(l.Col), l.Scope.C, l.InlinedAt.C)
571+
result := C.LLVMDIBuilderInsertDeclareAtEnd(d.ref, v.C, diVarInfo.C, expr.C, loc, bb.C)
570572
return Value{C: result}
571573
}
572574

573575
// InsertValueAtEnd inserts a call to llvm.dbg.value at the end of the
574576
// specified basic block for the given value and associated debug metadata.
575-
func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, bb BasicBlock) Value {
576-
result := C.LLVMDIBuilderInsertDbgValueAtEnd(d.ref, v.C, diVarInfo.C, expr.C, nil, bb.C)
577+
func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, l DebugLoc, bb BasicBlock) Value {
578+
loc := C.LLVMDIBuilderCreateDebugLocation(
579+
d.m.Context().C, C.uint(l.Line), C.uint(l.Col), l.Scope.C, l.InlinedAt.C)
580+
result := C.LLVMDIBuilderInsertDbgValueAtEnd(d.ref, v.C, diVarInfo.C, expr.C, loc, bb.C)
577581
return Value{C: result}
578582
}
579583

bindings/go/llvm/ir.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ type (
7474
IntPredicate C.LLVMIntPredicate
7575
FloatPredicate C.LLVMRealPredicate
7676
LandingPadClause C.LLVMLandingPadClauseTy
77+
InlineAsmDialect C.LLVMInlineAsmDialect
7778
)
7879

7980
func (c Context) IsNil() bool { return c.C == nil }
@@ -211,6 +212,7 @@ const (
211212
PointerTypeKind TypeKind = C.LLVMPointerTypeKind
212213
VectorTypeKind TypeKind = C.LLVMVectorTypeKind
213214
MetadataTypeKind TypeKind = C.LLVMMetadataTypeKind
215+
TokenTypeKind TypeKind = C.LLVMTokenTypeKind
214216
)
215217

216218
//-------------------------------------------------------------------------
@@ -314,6 +316,15 @@ const (
314316
LandingPadFilter LandingPadClause = C.LLVMLandingPadFilter
315317
)
316318

319+
//-------------------------------------------------------------------------
320+
// llvm.InlineAsmDialect
321+
//-------------------------------------------------------------------------
322+
323+
const (
324+
InlineAsmDialectATT InlineAsmDialect = C.LLVMInlineAsmDialectATT
325+
InlineAsmDialectIntel InlineAsmDialect = C.LLVMInlineAsmDialectIntel
326+
)
327+
317328
//-------------------------------------------------------------------------
318329
// llvm.Context
319330
//-------------------------------------------------------------------------
@@ -655,6 +666,7 @@ func (t Type) VectorSize() int { return int(C.LLVMGetVectorSize(t.C)) }
655666
// Operations on other types
656667
func (c Context) VoidType() (t Type) { t.C = C.LLVMVoidTypeInContext(c.C); return }
657668
func (c Context) LabelType() (t Type) { t.C = C.LLVMLabelTypeInContext(c.C); return }
669+
func (c Context) TokenType() (t Type) { t.C = C.LLVMTokenTypeInContext(c.C); return }
658670

659671
func VoidType() (t Type) { t.C = C.LLVMVoidType(); return }
660672
func LabelType() (t Type) { t.C = C.LLVMLabelType(); return }
@@ -1237,6 +1249,16 @@ func (v Value) IncomingBlock(i int) (bb BasicBlock) {
12371249
return
12381250
}
12391251

1252+
// Operations on inline assembly
1253+
func InlineAsm(t Type, asmString, constraints string, hasSideEffects, isAlignStack bool, dialect InlineAsmDialect) (rv Value) {
1254+
casm := C.CString(asmString)
1255+
defer C.free(unsafe.Pointer(casm))
1256+
cconstraints := C.CString(constraints)
1257+
defer C.free(unsafe.Pointer(cconstraints))
1258+
rv.C = C.LLVMGetInlineAsm(t.C, casm, C.size_t(len(asmString)), cconstraints, C.size_t(len(constraints)), boolToLLVMBool(hasSideEffects), boolToLLVMBool(isAlignStack), C.LLVMInlineAsmDialect(dialect))
1259+
return
1260+
}
1261+
12401262
//-------------------------------------------------------------------------
12411263
// llvm.Builder
12421264
//-------------------------------------------------------------------------

bindings/go/llvm/target.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const (
6262
const (
6363
CodeModelDefault CodeModel = C.LLVMCodeModelDefault
6464
CodeModelJITDefault CodeModel = C.LLVMCodeModelJITDefault
65+
CodeModelTiny CodeModel = C.LLVMCodeModelTiny
6566
CodeModelSmall CodeModel = C.LLVMCodeModelSmall
6667
CodeModelKernel CodeModel = C.LLVMCodeModelKernel
6768
CodeModelMedium CodeModel = C.LLVMCodeModelMedium

bindings/ocaml/llvm/llvm.ml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module TypeKind = struct
4242
| Vector
4343
| Metadata
4444
| X86_mmx
45+
| Token
4546
end
4647

4748
module Linkage = struct
@@ -238,6 +239,12 @@ module Opcode = struct
238239
| AtomicRMW
239240
| Resume
240241
| LandingPad
242+
| AddrSpaceCast
243+
| CleanupRet
244+
| CatchRet
245+
| CatchPad
246+
| CleanupPad
247+
| CatchSwitch
241248
end
242249

243250
module LandingPadClauseTy = struct
@@ -303,6 +310,7 @@ module ValueKind = struct
303310
| ConstantVector
304311
| Function
305312
| GlobalAlias
313+
| GlobalIFunc
306314
| GlobalVariable
307315
| UndefValue
308316
| Instruction of Opcode.t
@@ -461,6 +469,7 @@ external struct_element_types : lltype -> lltype array
461469
= "llvm_struct_element_types"
462470
external is_packed : lltype -> bool = "llvm_is_packed"
463471
external is_opaque : lltype -> bool = "llvm_is_opaque"
472+
external is_literal : lltype -> bool = "llvm_is_literal"
464473

465474
(*--... Operations on pointer, vector, and array types .....................--*)
466475

@@ -529,6 +538,7 @@ external operand : llvalue -> int -> llvalue = "llvm_operand"
529538
external operand_use : llvalue -> int -> lluse = "llvm_operand_use"
530539
external set_operand : llvalue -> int -> llvalue -> unit = "llvm_set_operand"
531540
external num_operands : llvalue -> int = "llvm_num_operands"
541+
external indices : llvalue -> int array = "llvm_indices"
532542

533543
(*--... Operations on constants of (mostly) any type .......................--*)
534544
external is_constant : llvalue -> bool = "llvm_is_constant"
@@ -1044,9 +1054,12 @@ let remove_enum_call_site_attr f k i =
10441054
let remove_string_call_site_attr f k i =
10451055
llvm_remove_string_call_site_attr f k (AttrIndex.to_int i)
10461056

1047-
(*--... Operations on call instructions (only) .............................--*)
1057+
(*--... Operations on call and invoke instructions (only) ..................--*)
1058+
external num_arg_operands : llvalue -> int = "llvm_num_arg_operands"
10481059
external is_tail_call : llvalue -> bool = "llvm_is_tail_call"
10491060
external set_tail_call : bool -> llvalue -> unit = "llvm_set_tail_call"
1061+
external get_normal_dest : llvalue -> llbasicblock = "LLVMGetNormalDest"
1062+
external get_unwind_dest : llvalue -> llbasicblock = "LLVMGetUnwindDest"
10501063

10511064
(*--... Operations on load/store instructions (only) .......................--*)
10521065
external is_volatile : llvalue -> bool = "llvm_is_volatile"
@@ -1175,6 +1188,7 @@ external build_invoke : llvalue -> llvalue array -> llbasicblock ->
11751188
= "llvm_build_invoke_bc" "llvm_build_invoke_nat"
11761189
external build_landingpad : lltype -> llvalue -> int -> string -> llbuilder ->
11771190
llvalue = "llvm_build_landingpad"
1191+
external is_cleanup : llvalue -> bool = "llvm_is_cleanup"
11781192
external set_cleanup : llvalue -> bool -> unit = "llvm_set_cleanup"
11791193
external add_clause : llvalue -> llvalue -> unit = "llvm_add_clause"
11801194
external build_resume : llvalue -> llbuilder -> llvalue = "llvm_build_resume"

bindings/ocaml/llvm/llvm.mli

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ module TypeKind : sig
7777
| Vector
7878
| Metadata
7979
| X86_mmx
80+
| Token
8081
end
8182

8283
(** The linkage of a global value, accessed with {!linkage} and
@@ -260,6 +261,12 @@ module Opcode : sig
260261
| AtomicRMW
261262
| Resume
262263
| LandingPad
264+
| AddrSpaceCast
265+
| CleanupRet
266+
| CatchRet
267+
| CatchPad
268+
| CleanupPad
269+
| CatchSwitch
263270
end
264271

265272
(** The type of a clause of a [landingpad] instruction.
@@ -336,6 +343,7 @@ module ValueKind : sig
336343
| ConstantVector
337344
| Function
338345
| GlobalAlias
346+
| GlobalIFunc
339347
| GlobalVariable
340348
| UndefValue
341349
| Instruction of Opcode.t
@@ -657,6 +665,10 @@ val is_packed : lltype -> bool
657665
[false] otherwise. See the method [llvm::StructType::isOpaque]. *)
658666
val is_opaque : lltype -> bool
659667

668+
(** [is_literal sty] returns [true] if the structure type [sty] is literal.
669+
[false] otherwise. See the method [llvm::StructType::isLiteral]. *)
670+
val is_literal : lltype -> bool
671+
660672

661673
(** {7 Operations on pointer, vector, and array types} *)
662674

@@ -802,6 +814,11 @@ val set_operand : llvalue -> int -> llvalue -> unit
802814
val num_operands : llvalue -> int
803815

804816

817+
(** [indices i] returns the indices for the ExtractValue or InsertValue
818+
instruction [i].
819+
See the [llvm::getIndices] methods. *)
820+
val indices : llvalue -> int array
821+
805822
(** {7 Operations on constants of (mostly) any type} *)
806823

807824
(** [is_constant v] returns [true] if the value [v] is a constant, [false]
@@ -1824,7 +1841,12 @@ val remove_enum_call_site_attr : llvalue -> llattrkind -> AttrIndex.t -> unit
18241841
val remove_string_call_site_attr : llvalue -> string -> AttrIndex.t -> unit
18251842

18261843

1827-
(** {7 Operations on call instructions (only)} *)
1844+
(** {7 Operations on call and invoke instructions (only)} *)
1845+
1846+
(** [num_arg_operands ci] returns the number of arguments for the call or
1847+
invoke instruction [ci]. See the method
1848+
[llvm::CallInst::getNumArgOperands]. *)
1849+
val num_arg_operands : llvalue -> int
18281850

18291851
(** [is_tail_call ci] is [true] if the call instruction [ci] is flagged as
18301852
eligible for tail call optimization, [false] otherwise.
@@ -1836,6 +1858,14 @@ val is_tail_call : llvalue -> bool
18361858
See the method [llvm::CallInst::setTailCall]. *)
18371859
val set_tail_call : bool -> llvalue -> unit
18381860

1861+
(** [get_normal_dest ii] is the normal destination basic block of an invoke
1862+
instruction. See the method [llvm::InvokeInst::getNormalDest()]. *)
1863+
val get_normal_dest : llvalue -> llbasicblock
1864+
1865+
(** [get_unwind_dest ii] is the unwind destination basic block of an invoke
1866+
instruction. See the method [llvm::InvokeInst::getUnwindDest()]. *)
1867+
val get_unwind_dest : llvalue -> llbasicblock
1868+
18391869

18401870
(** {7 Operations on load/store instructions (only)} *)
18411871

@@ -2068,6 +2098,10 @@ val build_invoke : llvalue -> llvalue array -> llbasicblock ->
20682098
val build_landingpad : lltype -> llvalue -> int -> string -> llbuilder ->
20692099
llvalue
20702100

2101+
(** [is_cleanup lp] returns [true] if [landingpad] instruction lp is a cleanup.
2102+
See the method [llvm::LandingPadInst::isCleanup]. *)
2103+
val is_cleanup : llvalue -> bool
2104+
20712105
(** [set_cleanup lp] sets the cleanup flag in the [landingpad]instruction.
20722106
See the method [llvm::LandingPadInst::setCleanup]. *)
20732107
val set_cleanup : llvalue -> bool -> unit

0 commit comments

Comments
 (0)