aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2016-04-13 19:50:01 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-04-13 19:50:02 +0000
commit197cdc48df63e008207c329704082306fd43c18a (patch)
tree99eb8d5e56ff0a77367a6ee93b3b52ebc85deba6
parent4ed58450c8e36413e44c80f77f2f874854916076 (diff)
parent7f32eebd938e20368fb808daf351a961a77ddce4 (diff)
downloadclang-197cdc48df63e008207c329704082306fd43c18a.tar.gz
Merge changes from topic 'merge_dev_master'
* changes: Support building 64-bit windows binaries for Clang. Build libclangToolingCore.a for extra host tools. Add -fnative-half-arguments-and-returns Revert "Handle __fp16 natively if HalfArgsAndReturns langopt is set"
-rw-r--r--Android.mk2
-rwxr-xr-xbuild.py6
-rw-r--r--include/clang/Basic/LangOptions.def1
-rw-r--r--include/clang/Driver/CC1Options.td2
-rw-r--r--lib/CodeGen/TargetInfo.cpp4
-rw-r--r--lib/Frontend/CompilerInvocation.cpp7
-rw-r--r--lib/Tooling/Core/Android.mk24
-rw-r--r--test/CodeGen/arm-fp16-arguments.c6
-rw-r--r--tools/driver/Android.mk8
9 files changed, 56 insertions, 4 deletions
diff --git a/Android.mk b/Android.mk
index 055094b5fe..3509d9f90c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -68,6 +68,7 @@ llvm-tools: \
ifneq ($(HOST_OS),darwin)
clang-toolchain: \
host_cross_clang \
+ host_cross_clang_64 \
libasan \
libasan_32 \
libasan_cxx \
@@ -113,6 +114,7 @@ subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
lib/StaticAnalyzer/Core \
lib/StaticAnalyzer/Frontend \
lib/Tooling \
+ lib/Tooling/Core \
tools/driver \
tools/libclang \
utils/TableGen \
diff --git a/build.py b/build.py
index bb7ba363cc..ebffff190a 100755
--- a/build.py
+++ b/build.py
@@ -159,7 +159,11 @@ def install_built_host_files(build_dir, install_dir, host):
'bin/clang' + bin_ext,
'bin/clang++' + bin_ext,
]
- if host != 'windows-x86':
+ if is_windows:
+ built_files.extend([
+ 'bin/clang_32' + bin_ext,
+ ])
+ else:
built_files.extend([
'bin/FileCheck' + bin_ext,
'bin/llvm-as' + bin_ext,
diff --git a/include/clang/Basic/LangOptions.def b/include/clang/Basic/LangOptions.def
index 492f650380..325a5540c5 100644
--- a/include/clang/Basic/LangOptions.def
+++ b/include/clang/Basic/LangOptions.def
@@ -161,6 +161,7 @@ LANGOPT(ShortEnums , 1, 0, "short enum types")
LANGOPT(OpenCL , 1, 0, "OpenCL")
LANGOPT(OpenCLVersion , 32, 0, "OpenCL version")
LANGOPT(NativeHalfType , 1, 0, "Native half type support")
+LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
LANGOPT(CUDA , 1, 0, "CUDA")
LANGOPT(OpenMP , 1, 0, "OpenMP support")
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index d7f42a991a..57a94226de 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -584,6 +584,8 @@ def fno_rtti_data : Flag<["-"], "fno-rtti-data">,
HelpText<"Control emission of RTTI data">;
def fnative_half_type: Flag<["-"], "fnative-half-type">,
HelpText<"Use the native half type for __fp16 instead of promoting to float">;
+def fnative_half_arguments_and_returns : Flag<["-"], "fnative-half-arguments-and-returns">,
+ HelpText<"Use the native __fp16 type for arguments and returns (and skip ABI-specific lowering)">;
def fallow_half_arguments_and_returns : Flag<["-"], "fallow-half-arguments-and-returns">,
HelpText<"Allow function arguments and returns of type half">;
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index 9457b6848f..38f30756cd 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -5001,7 +5001,7 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,
// __fp16 gets passed as if it were an int or float, but with the top 16 bits
// unspecified. This is not done for OpenCL as it handles the half type
// natively, and does not need to interwork with AAPCS code.
- if (Ty->isHalfType() && !getContext().getLangOpts().HalfArgsAndReturns) {
+ if (Ty->isHalfType() && !getContext().getLangOpts().NativeHalfArgsAndReturns) {
llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
llvm::Type::getFloatTy(getVMContext()) :
llvm::Type::getInt32Ty(getVMContext());
@@ -5197,7 +5197,7 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy,
// __fp16 gets returned as if it were an int or float, but with the top 16
// bits unspecified. This is not done for OpenCL as it handles the half type
// natively, and does not need to interwork with AAPCS code.
- if (RetTy->isHalfType() && !getContext().getLangOpts().HalfArgsAndReturns) {
+ if (RetTy->isHalfType() && !getContext().getLangOpts().NativeHalfArgsAndReturns) {
llvm::Type *ResType = IsEffectivelyAAPCS_VFP ?
llvm::Type::getFloatTy(getVMContext()) :
llvm::Type::getInt32Ty(getVMContext());
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 8481a735aa..d51a531de9 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -1359,6 +1359,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
Opts.LaxVectorConversions = 0;
Opts.DefaultFPContract = 1;
Opts.NativeHalfType = 1;
+ Opts.NativeHalfArgsAndReturns = 1;
}
Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
@@ -1715,7 +1716,11 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature);
std::sort(Opts.ModuleFeatures.begin(), Opts.ModuleFeatures.end());
Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type);
- Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns);
+ Opts.NativeHalfArgsAndReturns |= Args.hasArg(OPT_fnative_half_arguments_and_returns);
+ // Enable HalfArgsAndReturns if present in Args or if NativeHalfArgsAndReturns
+ // is enabled.
+ Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns)
+ | Opts.NativeHalfArgsAndReturns;
Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm);
// __declspec is enabled by default for the PS4 by the driver, and also
diff --git a/lib/Tooling/Core/Android.mk b/lib/Tooling/Core/Android.mk
new file mode 100644
index 0000000000..edba83e8f5
--- /dev/null
+++ b/lib/Tooling/Core/Android.mk
@@ -0,0 +1,24 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := \
+ DeclNodes.inc \
+ DiagnosticCommonKinds.inc \
+
+clang_tooling_core_SRC_FILES := \
+ Lookup.cpp \
+ Replacement.cpp \
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(clang_tooling_core_SRC_FILES)
+LOCAL_MODULE:= libclangToolingCore
+LOCAL_MODULE_TAGS := optional
+
+include $(CLANG_HOST_BUILD_MK)
+include $(CLANG_VERSION_INC_MK)
+include $(CLANG_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/test/CodeGen/arm-fp16-arguments.c b/test/CodeGen/arm-fp16-arguments.c
index 15a9ceb94c..65f076ac3c 100644
--- a/test/CodeGen/arm-fp16-arguments.c
+++ b/test/CodeGen/arm-fp16-arguments.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT
// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=HARD
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fnative-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=NATIVE
__fp16 g;
@@ -10,12 +11,17 @@ void t1(__fp16 a) { g = a; }
// HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
// HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
// CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*)
+// NATIVE: define void @t1(half [[PARAM:%.*]])
+// NATIVE: store half [[PARAM]], half* @g
__fp16 t2() { return g; }
// SOFT: define i32 @t2()
// HARD: define arm_aapcs_vfpcc float @t2()
+// NATIVE: define half @t2()
// CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*)
// CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
// SOFT: ret i32 [[ZEXT]]
// HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
// HARD: ret float [[BITCAST]]
+// NATIVE: [[LOAD:%.*]] = load half, half* @g
+// NATIVE: ret half [[LOAD]]
diff --git a/tools/driver/Android.mk b/tools/driver/Android.mk
index bd051ac65f..2f7ecf2001 100644
--- a/tools/driver/Android.mk
+++ b/tools/driver/Android.mk
@@ -114,4 +114,12 @@ include $(CLANG_HOST_BUILD_MK)
include $(CLANG_TBLGEN_RULES_MK)
include $(LLVM_GEN_ATTRIBUTES_MK)
include $(LLVM_GEN_INTRINSICS_MK)
+
+# Don't build both versions by default (to speed up local builds).
+ifeq (true,$(FORCE_BUILD_LLVM_COMPONENTS))
+LOCAL_MULTILIB := both
+LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)_32
+LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)
+endif
+
include $(BUILD_HOST_EXECUTABLE)