Merge "Add regression test for debugging __fp16, float, and double constants"
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..54de172
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,189 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// 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.
+//
+
+cc_defaults {
+ name: "libbcc-defaults",
+ defaults: [
+ "llvm-defaults",
+ "rs-version",
+ "libbcc-targets",
+ ],
+
+ clang: true,
+ cflags: [
+ "-Wall",
+ "-Wno-unused-parameter",
+ "-Werror",
+ "-D__DISABLE_ASSERTS",
+ ],
+
+ target: {
+ android: {
+ cflags: [
+ "-DTARGET_BUILD",
+ ],
+ },
+ host: {
+ compile_multilib: "first",
+ cflags: [
+ "-D__HOST__",
+ ],
+ },
+ },
+
+ product_variables: {
+ eng: {
+ cflags: ["-U__DISABLE_ASSERTS"],
+ },
+ },
+
+ include_dirs: [
+ "frameworks/compile/libbcc/include",
+ "frameworks/rs",
+ ],
+}
+
+//=====================================================================
+// Architecture Selection
+//=====================================================================
+// Note: We should only use -DFORCE_ARCH_CODEGEN on target build.
+// For the host build, we will include as many architecture as possible,
+// so that we can test the execution engine easily.
+
+cc_defaults {
+ name: "libbcc-targets",
+ arch: {
+ arm: {
+ cflags: [
+ "-DFORCE_ARM_CODEGEN",
+ "-DARCH_ARM_HAVE_VFP",
+ ],
+ armv7_a_neon: {
+ cflags: [
+ "-DARCH_ARM_HAVE_VFP_D32",
+ "-DARCH_ARM_HAVE_NEON",
+ ],
+ },
+ },
+ arm64: {
+ cflags: [
+ "-DFORCE_ARM64_CODEGEN",
+ "-DARCH_ARM_HAVE_NEON",
+ "-DARCH_ARM_HAVE_VFP",
+ "-DARCH_ARM_HAVE_VFP_D32",
+ "-DDISABLE_CLCORE_NEON",
+ ],
+ },
+ mips: {
+ cflags: ["-DFORCE_MIPS_CODEGEN"],
+ },
+ mips64: {
+ cflags: ["-DFORCE_MIPS64_CODEGEN"],
+ },
+ },
+ target: {
+ android_x86: {
+ cflags: ["-DFORCE_X86_CODEGEN"],
+ },
+ android_x86_64: {
+ cflags: ["-DFORCE_X86_64_CODEGEN"],
+ },
+ arm_on_x86: {
+ cflags: [
+ "-DPROVIDE_ARM_CODEGEN",
+ "-DFORCE_BUILD_ARM",
+ ],
+ },
+ arm_on_x86_64: {
+ cflags: [
+ "-DPROVIDE_ARM_CODEGEN",
+ "-DFORCE_BUILD_ARM",
+ "-DPROVIDE_ARM64_CODEGEN",
+ ],
+ },
+ },
+}
+
+//=====================================================================
+// Shared Library libbcc
+//=====================================================================
+cc_library_shared {
+ name: "libbcc",
+ host_supported: true,
+
+ whole_static_libs: [
+ "libbccRenderscript",
+ "libbccCore",
+ "libbccSupport",
+ ],
+
+ shared_libs: [
+ "libbcinfo",
+ ],
+
+ target: {
+ windows: {
+ enabled: true,
+ shared_libs: ["libLLVM"],
+ },
+ darwin: {
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+
+ shared_libs: ["libLLVM"],
+ },
+ linux: {
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+ static_libs: ["libLLVMLinker"],
+ allow_undefined_symbols: true,
+ },
+ host: {
+ compile_multilib: "first",
+ static_libs: [
+ "libutils",
+ "libcutils",
+ "liblog",
+ ],
+ },
+ android: {
+ shared_libs: [
+ "libLLVM",
+ "libdl",
+ "libutils",
+ "libcutils",
+ "liblog",
+ ],
+ },
+ },
+
+ product_variables: {
+ unbundled_build: {
+ // Don't build in unbundled branches
+ enabled: false,
+ },
+ },
+}
+
+subdirs = [
+ "bcinfo",
+ "lib",
+ "tools",
+]
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index c19383b..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# Copyright (C) 2010-2012 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-LIBBCC_ROOT_PATH := $(LOCAL_PATH)
-
-FORCE_BUILD_LLVM_DISABLE_NDEBUG ?= false
-# Legality check: FORCE_BUILD_LLVM_DISABLE_NDEBUG should consist of one word -- either "true" or "false".
-ifneq "$(words $(FORCE_BUILD_LLVM_DISABLE_NDEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DISABLE_NDEBUG)))" "10"
- $(error FORCE_BUILD_LLVM_DISABLE_NDEBUG may only be true, false, or unset)
-endif
-
-FORCE_BUILD_LLVM_DEBUG ?= false
-# Legality check: FORCE_BUILD_LLVM_DEBUG should consist of one word -- either "true" or "false".
-ifneq "$(words $(FORCE_BUILD_LLVM_DEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DEBUG)))" "10"
- $(error FORCE_BUILD_LLVM_DEBUG may only be true, false, or unset)
-endif
-
-include $(LIBBCC_ROOT_PATH)/libbcc.mk
-
-include frameworks/compile/slang/rs_version.mk
-
-#=====================================================================
-# Whole Static Library to Be Linked In
-#=====================================================================
-
-libbcc_WHOLE_STATIC_LIBRARIES += \
- libbccRenderscript \
- libbccCore \
- libbccSupport
-
-#=====================================================================
-# Device Shared Library libbcc
-#=====================================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbcc
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-
-LOCAL_WHOLE_STATIC_LIBRARIES := $(libbcc_WHOLE_STATIC_LIBRARIES)
-
-LOCAL_SHARED_LIBRARIES := libbcinfo libLLVM libdl libutils libcutils liblog libc++
-
-# Modules that need get installed if and only if the target libbcc.so is
-# installed.
-LOCAL_REQUIRED_MODULES := libclcore.bc libclcore_debug.bc libclcore_g.bc libcompiler_rt
-
-LOCAL_REQUIRED_MODULES_x86 += libclcore_x86.bc
-LOCAL_REQUIRED_MODULES_x86_64 += libclcore_x86.bc
-
-ifeq ($(ARCH_ARM_HAVE_NEON),true)
- LOCAL_REQUIRED_MODULES_arm += libclcore_neon.bc
-endif
-
-include $(LIBBCC_DEVICE_BUILD_MK)
-include $(LLVM_DEVICE_BUILD_MK)
-include $(BUILD_SHARED_LIBRARY)
-endif
-
-#=====================================================================
-# Host Shared Library libbcc
-#=====================================================================
-
-# Don't build for unbundled branches
-ifeq (,$(TARGET_BUILD_APPS))
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbcc
-LOCAL_MODULE_HOST_OS := darwin linux windows
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_IS_HOST_MODULE := true
-
-LOCAL_WHOLE_STATIC_LIBRARIES += $(libbcc_WHOLE_STATIC_LIBRARIES)
-
-LOCAL_STATIC_LIBRARIES += \
- libutils \
- libcutils \
- liblog
-
-LOCAL_SHARED_LIBRARIES := libbcinfo
-
-LOCAL_LDLIBS_darwin := -ldl -lpthread
-LOCAL_LDLIBS_linux := -ldl -lpthread
-
-include $(LIBBCC_ROOT_PATH)/llvm-loadable-libbcc.mk
-
-ifeq ($(CAN_BUILD_HOST_LLVM_LOADABLE_MODULE),true)
-LOCAL_STATIC_LIBRARIES_linux += libLLVMLinker
-LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
-else
-LOCAL_SHARED_LIBRARIES_linux += libLLVM
-endif
-LOCAL_SHARED_LIBRARIES_darwin += libLLVM
-LOCAL_SHARED_LIBRARIES_windows += libLLVM
-
-include $(LIBBCC_HOST_BUILD_MK)
-include $(LLVM_HOST_BUILD_MK)
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-endif # Don't build in unbundled branches
-
-#=====================================================================
-# Include Subdirectories
-#=====================================================================
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/bcinfo/Android.bp b/bcinfo/Android.bp
new file mode 100644
index 0000000..2f788db
--- /dev/null
+++ b/bcinfo/Android.bp
@@ -0,0 +1,113 @@
+//
+// Copyright (C) 2011-2012 The Android Open Source Project
+//
+// 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.
+//
+
+cc_library_shared {
+ name: "libbcinfo",
+ host_supported: true,
+ defaults: [
+ "llvm-defaults",
+ "rs-version",
+ ],
+
+ srcs: [
+ "BitcodeTranslator.cpp",
+ "BitcodeWrapper.cpp",
+ "MetadataExtractor.cpp",
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Wno-unused-parameter",
+ "-Werror",
+
+ "-D__DISABLE_ASSERTS",
+ ],
+
+ product_variables: {
+ eng: {
+ cflags: ["-U__DISABLE_ASSERTS"],
+ },
+ },
+
+ include_dirs: [
+ "frameworks/compile/libbcc/include",
+ "frameworks/rs",
+ "frameworks/compile/slang",
+ ],
+
+ static_libs: [
+ "libLLVMWrap",
+ "libLLVMBitReader_2_7",
+ "libLLVMBitReader_3_0",
+ "libLLVMBitWriter_3_2",
+ ],
+
+ target: {
+ windows: {
+ enabled: true,
+ shared_libs: ["libLLVM"],
+ },
+ darwin: {
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+ shared_libs: ["libLLVM"],
+ },
+ linux: {
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+ allow_undefined_symbols: true,
+ },
+ host: {
+ compile_multilib: "first",
+ static_libs: [
+ "libcutils",
+ "liblog",
+ ],
+ product_variables: {
+ unbundled_build: {
+ // don't build for unbundled branches
+ enabled: false,
+ },
+ },
+ },
+ android: {
+ shared_libs: [
+ "libcutils",
+ "liblog",
+ ],
+ static_libs: [
+ // Statically link-in the required LLVM libraries
+ "libLLVMBitReader",
+ "libLLVMCore",
+ "libLLVMSupport",
+ ],
+ // Export only the symbols in the bcinfo namespace. In particular,
+ // do not, export symbols from the LLVM libraries.
+ version_script: "libbcinfo.map",
+ },
+ },
+}
+
+subdirs = [
+ "BitReader_2_7",
+ "BitReader_3_0",
+ "tools",
+ "Wrap",
+]
diff --git a/bcinfo/Android.mk b/bcinfo/Android.mk
deleted file mode 100644
index 4cba1e5..0000000
--- a/bcinfo/Android.mk
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# Copyright (C) 2011-2012 The Android Open Source Project
-#
-# 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.
-#
-
-local_cflags_for_libbcinfo := -Wall -Wno-unused-parameter -Werror
-ifneq ($(TARGET_BUILD_VARIANT),eng)
-local_cflags_for_libbcinfo += -D__DISABLE_ASSERTS
-endif
-
-LOCAL_PATH := $(call my-dir)
-
-include frameworks/compile/slang/rs_version.mk
-local_cflags_for_libbcinfo += $(RS_VERSION_DEFINE)
-
-libbcinfo_SRC_FILES := \
- BitcodeTranslator.cpp \
- BitcodeWrapper.cpp \
- MetadataExtractor.cpp
-
-libbcinfo_C_INCLUDES := \
- $(LOCAL_PATH)/../include \
- $(RS_ROOT_PATH) \
- $(LOCAL_PATH)/../../slang
-
-libbcinfo_STATIC_LIBRARIES := \
- libLLVMWrap \
- libLLVMBitReader_2_7 \
- libLLVMBitReader_3_0 \
- libLLVMBitWriter_3_2
-
-LLVM_ROOT_PATH := external/llvm
-
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbcinfo
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := $(libbcinfo_SRC_FILES)
-
-LOCAL_CFLAGS += $(local_cflags_for_libbcinfo)
-
-LOCAL_C_INCLUDES := $(libbcinfo_C_INCLUDES)
-
-LOCAL_STATIC_LIBRARIES := $(libbcinfo_STATIC_LIBRARIES)
-LOCAL_SHARED_LIBRARIES := libLLVM libcutils liblog
-
-include $(LLVM_ROOT_PATH)/llvm-device-build.mk
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(BUILD_SHARED_LIBRARY)
-endif
-
-# Don't build for unbundled branches
-ifeq (,$(TARGET_BUILD_APPS))
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbcinfo
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-LOCAL_MODULE_HOST_OS := darwin linux windows
-LOCAL_IS_HOST_MODULE := true
-
-LOCAL_SRC_FILES := $(libbcinfo_SRC_FILES)
-
-LOCAL_CFLAGS += $(local_cflags_for_libbcinfo)
-
-LOCAL_C_INCLUDES := $(libbcinfo_C_INCLUDES)
-
-LOCAL_STATIC_LIBRARIES += $(libbcinfo_STATIC_LIBRARIES)
-LOCAL_STATIC_LIBRARIES += libcutils liblog
-
-LOCAL_LDLIBS_darwin := -ldl -lpthread
-LOCAL_LDLIBS_linux := -ldl -lpthread
-
-include $(LOCAL_PATH)/../llvm-loadable-libbcc.mk
-
-ifneq ($(CAN_BUILD_HOST_LLVM_LOADABLE_MODULE),true)
-LOCAL_SHARED_LIBRARIES_linux += libLLVM
-else
-LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
-endif
-LOCAL_SHARED_LIBRARIES_darwin += libLLVM
-LOCAL_SHARED_LIBRARIES_windows += libLLVM
-
-include $(LLVM_ROOT_PATH)/llvm-host-build.mk
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(BUILD_HOST_SHARED_LIBRARY)
-
-endif # don't build for unbundled branches
-
-#=====================================================================
-# Include Subdirectories
-#=====================================================================
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/bcinfo/BitReader_2_7/Android.bp b/bcinfo/BitReader_2_7/Android.bp
new file mode 100644
index 0000000..6a57344
--- /dev/null
+++ b/bcinfo/BitReader_2_7/Android.bp
@@ -0,0 +1,16 @@
+cc_library_static {
+ name: "libLLVMBitReader_2_7",
+ defaults: ["llvm-defaults",],
+ host_supported: true,
+
+ srcs: ["BitcodeReader.cpp"],
+
+ target: {
+ host: {
+ cflags: ["-D__HOST__"],
+ },
+ windows: {
+ enabled: true,
+ },
+ },
+}
diff --git a/bcinfo/BitReader_2_7/Android.mk b/bcinfo/BitReader_2_7/Android.mk
deleted file mode 100644
index 773c3c9..0000000
--- a/bcinfo/BitReader_2_7/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-LLVM_ROOT_PATH := external/llvm
-include $(LLVM_ROOT_PATH)/llvm.mk
-
-bitcode_reader_2_7_SRC_FILES := \
- BitcodeReader.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(bitcode_reader_2_7_SRC_FILES)
-
-LOCAL_CFLAGS += -D__HOST__
-
-LOCAL_MODULE:= libLLVMBitReader_2_7
-
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-include $(LLVM_HOST_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the device
-# =====================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(bitcode_reader_2_7_SRC_FILES)
-
-LOCAL_MODULE:= libLLVMBitReader_2_7
-
-include $(LLVM_DEVICE_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_STATIC_LIBRARY)
-endif
diff --git a/bcinfo/BitReader_3_0/Android.bp b/bcinfo/BitReader_3_0/Android.bp
new file mode 100644
index 0000000..b68619e
--- /dev/null
+++ b/bcinfo/BitReader_3_0/Android.bp
@@ -0,0 +1,15 @@
+cc_library_static {
+ name: "libLLVMBitReader_3_0",
+ defaults: ["llvm-defaults"],
+ host_supported: true,
+
+ srcs: ["BitcodeReader.cpp"],
+ target: {
+ host: {
+ cflags: ["-D__HOST__"],
+ },
+ windows: {
+ enabled: true,
+ },
+ },
+}
diff --git a/bcinfo/BitReader_3_0/Android.mk b/bcinfo/BitReader_3_0/Android.mk
deleted file mode 100644
index dd6ce8d..0000000
--- a/bcinfo/BitReader_3_0/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-LLVM_ROOT_PATH := external/llvm
-include $(LLVM_ROOT_PATH)/llvm.mk
-
-bitcode_reader_3_0_SRC_FILES := \
- BitcodeReader.cpp
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libLLVMBitReader_3_0
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-LOCAL_SRC_FILES := $(bitcode_reader_3_0_SRC_FILES)
-LOCAL_CFLAGS += -D__HOST__
-
-include $(LLVM_HOST_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the device
-# =====================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libLLVMBitReader_3_0
-
-LOCAL_SRC_FILES := $(bitcode_reader_3_0_SRC_FILES)
-
-include $(LLVM_DEVICE_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_STATIC_LIBRARY)
-endif
diff --git a/bcinfo/MetadataExtractor.cpp b/bcinfo/MetadataExtractor.cpp
index b78c049..b08940f 100644
--- a/bcinfo/MetadataExtractor.cpp
+++ b/bcinfo/MetadataExtractor.cpp
@@ -494,7 +494,7 @@
if (!ReduceMetadata || !(mExportReduceCount = ReduceMetadata->getNumOperands()))
return true;
- Reduce *TmpReduceList = new Reduce[mExportReduceCount];
+ std::unique_ptr<Reduce[]> TmpReduceList(new Reduce[mExportReduceCount]);
for (size_t i = 0; i < mExportReduceCount; i++) {
llvm::MDNode *Node = ReduceMetadata->getOperand(i);
@@ -542,7 +542,7 @@
TmpReduceList[i].mHalterName = createStringFromOptionalValue(Node, 6);
}
- mExportReduceList = TmpReduceList;
+ mExportReduceList = TmpReduceList.release();
return true;
}
diff --git a/bcinfo/Wrap/Android.bp b/bcinfo/Wrap/Android.bp
new file mode 100644
index 0000000..fc35623
--- /dev/null
+++ b/bcinfo/Wrap/Android.bp
@@ -0,0 +1,39 @@
+//
+// Copyright (C) 2012 The Android Open Source Project
+//
+// 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.
+//
+
+cc_library_static {
+ name: "libLLVMWrap",
+ host_supported: true,
+
+ srcs: [
+ "bitcode_wrapperer.cpp",
+ "file_wrapper_input.cpp",
+ "file_wrapper_output.cpp",
+ "in_memory_wrapper_input.cpp",
+ "wrapper_output.cpp",
+ ],
+
+ target: {
+ host: {
+ cflags: ["-D__HOST__"],
+ },
+ windows: {
+ enabled: true,
+ },
+ },
+
+ include_dirs: ["frameworks/compile/libbcc/include"],
+}
diff --git a/bcinfo/Wrap/Android.mk b/bcinfo/Wrap/Android.mk
deleted file mode 100644
index 92508d8..0000000
--- a/bcinfo/Wrap/Android.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-LLVM_ROOT_PATH := external/llvm
-include $(LLVM_ROOT_PATH)/llvm.mk
-
-llvm_wrap_SRC_FILES := \
- bitcode_wrapperer.cpp \
- file_wrapper_input.cpp \
- file_wrapper_output.cpp \
- in_memory_wrapper_input.cpp \
- wrapper_output.cpp
-
-llvm_wrap_C_INCLUDES := $(LOCAL_PATH)/../../include
-
-# For the host
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libLLVMWrap
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-LOCAL_SRC_FILES := $(llvm_wrap_SRC_FILES)
-LOCAL_CFLAGS += -D__HOST__
-LOCAL_C_INCLUDES := $(llvm_wrap_C_INCLUDES)
-
-include $(LLVM_HOST_BUILD_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-# For the device
-# =====================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libLLVMWrap
-
-LOCAL_SRC_FILES := $(llvm_wrap_SRC_FILES)
-LOCAL_C_INCLUDES := $(llvm_wrap_C_INCLUDES)
-
-include $(LLVM_DEVICE_BUILD_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_STATIC_LIBRARY)
-endif
diff --git a/bcinfo/libbcinfo.map b/bcinfo/libbcinfo.map
new file mode 100644
index 0000000..15629ef
--- /dev/null
+++ b/bcinfo/libbcinfo.map
@@ -0,0 +1,6 @@
+libbcinfo {
+ global:
+ _ZN6bcinfo*;
+ local:
+ *;
+};
diff --git a/bcinfo/tools/Android.bp b/bcinfo/tools/Android.bp
new file mode 100644
index 0000000..62e0a7a
--- /dev/null
+++ b/bcinfo/tools/Android.bp
@@ -0,0 +1,42 @@
+//
+// Copyright (C) 2011 The Android Open Source Project
+//
+// 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.
+//
+
+// Executable for host
+// ========================================================
+cc_binary_host {
+ name: "bcinfo",
+ defaults: ["llvm-defaults"],
+
+ srcs: ["main.cpp"],
+
+ shared_libs: ["libbcinfo"],
+
+ static_libs: [
+ "libLLVMBitReader",
+ "libLLVMBitWriter",
+ "libLLVMCore",
+ "libLLVMSupport",
+ ],
+
+ cflags: ["-D__HOST__"],
+
+ include_dirs: ["frameworks/compile/libbcc/include"],
+
+ host_ldlibs: [
+ "-ldl",
+ "-lpthread",
+ ],
+}
diff --git a/bcinfo/tools/Android.mk b/bcinfo/tools/Android.mk
deleted file mode 100644
index 876a53c..0000000
--- a/bcinfo/tools/Android.mk
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-LLVM_ROOT_PATH := external/llvm
-include $(LLVM_ROOT_PATH)/llvm.mk
-
-# Executable for host
-# ========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := bcinfo
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-LOCAL_SRC_FILES := \
- main.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libbcinfo
-
-LOCAL_STATIC_LIBRARIES := \
- libLLVMBitReader \
- libLLVMBitWriter \
- libLLVMCore \
- libLLVMSupport
-
-LOCAL_CFLAGS += -D__HOST__
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/../../include
-
-LOCAL_LDLIBS = -ldl -lpthread
-
-include $(LLVM_HOST_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(BUILD_HOST_EXECUTABLE)
-
diff --git a/include/bcc/Renderscript/RSUtils.h b/include/bcc/Renderscript/RSUtils.h
index 4e80c4e..e7ce1b5 100644
--- a/include/bcc/Renderscript/RSUtils.h
+++ b/include/bcc/Renderscript/RSUtils.h
@@ -28,7 +28,7 @@
namespace {
static inline llvm::StringRef getUnsuffixedStructName(const llvm::StructType *T) {
-#ifdef FORCE_BUILD_LLVM_DISABLE_NDEBUG
+#ifdef _DEBUG
// Bug: 22926131
// When building with assertions enabled, LLVM cannot read the name of a
// literal (anonymous) structure, because they shouldn't actually ever have
diff --git a/lib/Android.bp b/lib/Android.bp
new file mode 100644
index 0000000..566c8db
--- /dev/null
+++ b/lib/Android.bp
@@ -0,0 +1,5 @@
+subdirs = [
+ "Core",
+ "Renderscript",
+ "Support",
+]
diff --git a/lib/Android.mk b/lib/Android.mk
deleted file mode 100644
index 9073ac3..0000000
--- a/lib/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/lib/Core/Android.bp b/lib/Core/Android.bp
new file mode 100644
index 0000000..43e9bcb
--- /dev/null
+++ b/lib/Core/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2012 The Android Open Source Project
+//
+// 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.
+//
+//
+
+cc_library_static {
+ name: "libbccCore",
+ host_supported: true,
+ defaults: ["libbcc-defaults"],
+
+ srcs: [
+ "BCCContext.cpp",
+ "BCCContextImpl.cpp",
+ "Compiler.cpp",
+ "Script.cpp",
+ "Source.cpp",
+ ],
+
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+}
diff --git a/lib/Core/Android.mk b/lib/Core/Android.mk
deleted file mode 100644
index d48fd0e..0000000
--- a/lib/Core/Android.mk
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# 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.
-#
-#
-
-LOCAL_PATH := $(call my-dir)
-
-#=====================================================================
-# Common: libbccCore
-#=====================================================================
-
-libbcc_core_SRC_FILES := \
- BCCContext.cpp \
- BCCContextImpl.cpp \
- Compiler.cpp \
- Script.cpp \
- Source.cpp
-
-#=====================================================================
-# Device Static Library: libbccCore
-#=====================================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbccCore
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-LOCAL_SRC_FILES := $(libbcc_core_SRC_FILES)
-
-include $(LIBBCC_DEVICE_BUILD_MK)
-include $(LLVM_DEVICE_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_STATIC_LIBRARY)
-endif
-
-#=====================================================================
-# Host Static Library: libbccCore
-#=====================================================================
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbccCore
-LOCAL_MODULE_HOST_OS := darwin linux windows
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-LOCAL_SRC_FILES := $(libbcc_core_SRC_FILES)
-
-include $(LIBBCC_HOST_BUILD_MK)
-include $(LLVM_HOST_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Renderscript/Android.bp b/lib/Renderscript/Android.bp
new file mode 100644
index 0000000..d8fddc1
--- /dev/null
+++ b/lib/Renderscript/Android.bp
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2012 The Android Open Source Project
+//
+// 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.
+//
+//
+
+cc_library_static {
+ name: "libbccRenderscript",
+ host_supported: true,
+ defaults: ["libbcc-defaults"],
+
+ srcs: [
+ "RSAddDebugInfoPass.cpp",
+ "RSCompilerDriver.cpp",
+ "RSEmbedInfo.cpp",
+ "RSKernelExpand.cpp",
+ "RSGlobalInfoPass.cpp",
+ "RSInvariant.cpp",
+ "RSScript.cpp",
+ "RSInvokeHelperPass.cpp",
+ "RSIsThreadablePass.cpp",
+ "RSScreenFunctionsPass.cpp",
+ "RSStubsWhiteList.cpp",
+ "RSScriptGroupFusion.cpp",
+ "RSX86CallConvPass.cpp",
+ "RSX86TranslateGEPPass.cpp",
+ ],
+
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+}
diff --git a/lib/Renderscript/Android.mk b/lib/Renderscript/Android.mk
deleted file mode 100644
index e392994..0000000
--- a/lib/Renderscript/Android.mk
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# 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.
-#
-#
-
-LOCAL_PATH := $(call my-dir)
-
-#=====================================================================
-# Common: libbccRenderscript
-#=====================================================================
-
-libbcc_renderscript_SRC_FILES := \
- RSAddDebugInfoPass.cpp \
- RSCompilerDriver.cpp \
- RSEmbedInfo.cpp \
- RSKernelExpand.cpp \
- RSGlobalInfoPass.cpp \
- RSInvariant.cpp \
- RSScript.cpp \
- RSInvokeHelperPass.cpp \
- RSIsThreadablePass.cpp \
- RSScreenFunctionsPass.cpp \
- RSStubsWhiteList.cpp \
- RSScriptGroupFusion.cpp \
- RSX86CallConvPass.cpp \
- RSX86TranslateGEPPass.cpp
-
-#=====================================================================
-# Device Static Library: libbccRenderscript
-#=====================================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbccRenderscript
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-LOCAL_SRC_FILES := $(libbcc_renderscript_SRC_FILES)
-
-include $(LIBBCC_DEVICE_BUILD_MK)
-include $(LLVM_DEVICE_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_STATIC_LIBRARY)
-endif
-
-#=====================================================================
-# Host Static Library: libbccRenderscript
-#=====================================================================
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbccRenderscript
-LOCAL_MODULE_HOST_OS := darwin linux windows
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-LOCAL_IS_HOST_MODULE := true
-
-LOCAL_SRC_FILES := $(libbcc_renderscript_SRC_FILES)
-
-include $(LIBBCC_HOST_BUILD_MK)
-include $(LLVM_HOST_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(LLVM_GEN_INTRINSICS_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Renderscript/RSAddDebugInfoPass.cpp b/lib/Renderscript/RSAddDebugInfoPass.cpp
index e89af4e..b1b3048 100644
--- a/lib/Renderscript/RSAddDebugInfoPass.cpp
+++ b/lib/Renderscript/RSAddDebugInfoPass.cpp
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <string>
#include "bcc/Assert.h"
#include "bcc/Renderscript/RSTransforms.h"
@@ -26,6 +27,7 @@
#include <llvm/IR/Instructions.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Module.h>
+#include <llvm/ADT/SetVector.h>
namespace {
@@ -57,21 +59,38 @@
return false;
}
- size_t nForEachKernels = me.getExportForEachSignatureCount();
+ const size_t nForEachKernels = me.getExportForEachSignatureCount();
const char **forEachKernels = me.getExportForEachNameList();
+ const bcinfo::MetadataExtractor::Reduce *reductions =
+ me.getExportReduceList();
+ const size_t nReductions = me.getExportReduceCount();
+
+ llvm::SmallSetVector<llvm::Function *, 16> expandFuncs{};
+ auto pushExpanded = [&](const char *const name) -> void {
+ bccAssert(name && *name && (::strcmp(name, ".") != 0));
+
+ const std::string expandName = std::string(name) + ".expand";
+ if (llvm::Function *const func = Module.getFunction(expandName))
+ expandFuncs.insert(func);
+ };
+
+ for (size_t i = 0; i < nForEachKernels; ++i)
+ pushExpanded(forEachKernels[i]);
+
+ for (size_t i = 0; i < nReductions; ++i) {
+ const bcinfo::MetadataExtractor::Reduce &reduction = reductions[i];
+ pushExpanded(reduction.mAccumulatorName);
+ }
// Set up the debug info builder.
llvm::DIBuilder DebugInfo(Module);
-
initializeDebugInfo(DebugInfo, Module);
- // Attach DI metadata to each generated function.
- for (size_t i = 0; i < nForEachKernels; ++i) {
- std::string expandedName = forEachKernels[i];
- expandedName += ".expand";
-
- if (llvm::Function *kernelFunc = Module.getFunction(expandedName))
- attachDebugInfo(DebugInfo, *kernelFunc);
+ for (const auto &expandFunc : expandFuncs) {
+ // Attach DI metadata to each generated function.
+ // No inlining has occurred at this point so it's safe to name match
+ // without worrying about inlined function bodies.
+ attachDebugInfo(DebugInfo, *expandFunc);
}
DebugInfo.finalize();
diff --git a/lib/Renderscript/RSCompilerDriver.cpp b/lib/Renderscript/RSCompilerDriver.cpp
index f288810..e067587 100644
--- a/lib/Renderscript/RSCompilerDriver.cpp
+++ b/lib/Renderscript/RSCompilerDriver.cpp
@@ -282,7 +282,7 @@
// Assertion-enabled builds can't compile legacy bitcode (due to the use of
// getName() with anonymous structure definitions).
-#ifdef FORCE_BUILD_LLVM_DISABLE_NDEBUG
+#ifdef _DEBUG
static const uint32_t kSlangMinimumFixedStructureNames = 2310;
uint32_t version = wrapper.getCompilerVersion();
if (version < kSlangMinimumFixedStructureNames) {
diff --git a/lib/Support/Android.bp b/lib/Support/Android.bp
new file mode 100644
index 0000000..a82876c
--- /dev/null
+++ b/lib/Support/Android.bp
@@ -0,0 +1,37 @@
+//
+// Copyright (C) 2012 The Android Open Source Project
+//
+// 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.
+//
+//
+
+cc_library_static {
+ name: "libbccSupport",
+ host_supported: true,
+ defaults: ["libbcc-defaults"],
+
+ srcs: [
+ "CompilerConfig.cpp",
+ "Disassembler.cpp",
+ "FileBase.cpp",
+ "Initialization.cpp",
+ "InputFile.cpp",
+ "OutputFile.cpp",
+ ],
+
+ target: {
+ windows: {
+ enabled: true,
+ },
+ },
+}
diff --git a/lib/Support/Android.mk b/lib/Support/Android.mk
deleted file mode 100644
index 5efbabd..0000000
--- a/lib/Support/Android.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# 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.
-#
-#
-
-LOCAL_PATH := $(call my-dir)
-
-#=====================================================================
-# Common: libbccSupport
-#=====================================================================
-
-libbcc_support_SRC_FILES := \
- CompilerConfig.cpp \
- Disassembler.cpp \
- FileBase.cpp \
- Initialization.cpp \
- InputFile.cpp \
- OutputFile.cpp \
-
-#=====================================================================
-# Device Static Library: libbccSupport
-#=====================================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbccSupport
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-LOCAL_SRC_FILES := \
- $(libbcc_support_SRC_FILES)
-
-include $(LIBBCC_DEVICE_BUILD_MK)
-include $(LLVM_DEVICE_BUILD_MK)
-include $(BUILD_STATIC_LIBRARY)
-endif
-
-#=====================================================================
-# Host Static Library: libbccSupport
-#=====================================================================
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbccSupport
-LOCAL_MODULE_HOST_OS := darwin linux windows
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-LOCAL_SRC_FILES := \
- $(libbcc_support_SRC_FILES)
-
-include $(LIBBCC_HOST_BUILD_MK)
-include $(LLVM_HOST_BUILD_MK)
-include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Support/CompilerConfig.cpp b/lib/Support/CompilerConfig.cpp
index cbeee86..1131f61 100644
--- a/lib/Support/CompilerConfig.cpp
+++ b/lib/Support/CompilerConfig.cpp
@@ -151,17 +151,9 @@
#if defined(TARGET_BUILD)
if (!getProperty("debug.rs.arm-no-tune-for-cpu")) {
-#ifndef FORCE_CPU_VARIANT_32
#ifdef DEFAULT_ARM_CODEGEN
setCPU(llvm::sys::getHostCPUName());
#endif
-#else
-#define XSTR(S) #S
-#define STR(S) XSTR(S)
- setCPU(STR(FORCE_CPU_VARIANT_32));
-#undef STR
-#undef XSTR
-#endif
}
#endif // TARGET_BUILD
@@ -173,18 +165,9 @@
case llvm::Triple::aarch64:
#if defined(TARGET_BUILD)
if (!getProperty("debug.rs.arm-no-tune-for-cpu")) {
-#ifndef FORCE_CPU_VARIANT_64
#ifdef DEFAULT_ARM64_CODEGEN
setCPU(llvm::sys::getHostCPUName());
#endif
-#else
-#define XSTR(S) #S
-#define STR(S) XSTR(S)
- setCPU(STR(FORCE_CPU_VARIANT_64));
-#undef STR
-#undef XSTR
-#endif
-
}
#endif // TARGET_BUILD
break;
diff --git a/libbcc-device-build.mk b/libbcc-device-build.mk
deleted file mode 100644
index b103da2..0000000
--- a/libbcc-device-build.mk
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_CLANG := true
-
-LOCAL_CFLAGS := \
- -Wall \
- -Wno-unused-parameter \
- -Werror \
- -DTARGET_BUILD \
- $(RS_VERSION_DEFINE) \
- $(LOCAL_CFLAGS)
-
-
-ifneq ($(BOARD_OVERRIDE_RS_CPU_VARIANT_32),)
-LOCAL_CFLAGS += -DFORCE_CPU_VARIANT_32=$(BOARD_OVERRIDE_RS_CPU_VARIANT_32)
-endif
-
-ifneq ($(BOARD_OVERRIDE_RS_CPU_VARIANT_64),)
-LOCAL_CFLAGS += -DFORCE_CPU_VARIANT_64=$(BOARD_OVERRIDE_RS_CPU_VARIANT_64)
-endif
-
-ifeq ($(TARGET_BUILD_VARIANT),eng)
-LOCAL_CFLAGS += -DANDROID_ENGINEERING_BUILD
-else
-LOCAL_CFLAGS += -D__DISABLE_ASSERTS
-endif
-
-ifeq ($(FORCE_BUILD_LLVM_DISABLE_NDEBUG),true)
-LOCAL_CFLAGS += -DFORCE_BUILD_LLVM_DISABLE_NDEBUG
-endif
-
-#=====================================================================
-# Architecture Selection
-#=====================================================================
-# Note: We should only use -DFORCE_ARCH_CODEGEN on target build.
-# For the host build, we will include as many architecture as possible,
-# so that we can test the execution engine easily.
-
-LOCAL_MODULE_TARGET_ARCH := $(LLVM_SUPPORTED_ARCH)
-
-include frameworks/compile/libbcc/libbcc-targets.mk
-
-LOCAL_C_INCLUDES := \
- $(LIBBCC_ROOT_PATH)/include \
- $(RS_ROOT_PATH) \
- $(LLVM_ROOT_PATH)/include \
- $(LLVM_ROOT_PATH)/device/include \
- $(LOCAL_C_INCLUDES)
diff --git a/libbcc-host-build.mk b/libbcc-host-build.mk
deleted file mode 100644
index 9fe5278..0000000
--- a/libbcc-host-build.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_CFLAGS := \
- -Wall \
- -Wno-unused-parameter \
- -Werror \
- -D__HOST__ \
- $(RS_VERSION_DEFINE) \
- $(LOCAL_CFLAGS)
-
-ifeq ($(TARGET_BUILD_VARIANT),eng)
-libbcc_CFLAGS += -DANDROID_ENGINEERING_BUILD
-else
-LOCAL_CFLAGS += -D__DISABLE_ASSERTS
-endif
-
-ifeq ($(FORCE_BUILD_LLVM_DISABLE_NDEBUG),true)
-LOCAL_CFLAGS += -DFORCE_BUILD_LLVM_DISABLE_NDEBUG
-endif
-
-LOCAL_C_INCLUDES := \
- $(LIBBCC_ROOT_PATH)/include \
- $(RS_ROOT_PATH) \
- $(LLVM_ROOT_PATH)/include \
- $(LLVM_ROOT_PATH)/host/include \
- $(LOCAL_C_INCLUDES)
-
-LOCAL_IS_HOST_MODULE := true
diff --git a/libbcc.mk b/libbcc.mk
deleted file mode 100644
index c3775b2..0000000
--- a/libbcc.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# 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.
-#
-
-ifeq ($(LIBBCC_ROOT_PATH),)
-$(error Must set variable LIBBCC_ROOT_PATH before including this! $(LOCAL_PATH))
-endif
-
-#=====================================================================
-# Root Path for Other Projects
-#=====================================================================
-
-LLVM_ROOT_PATH := external/llvm
-RS_ROOT_PATH := frameworks/rs
-
-#=====================================================================
-# Related Makefile Paths of libbcc
-#=====================================================================
-
-LIBBCC_HOST_BUILD_MK := $(LIBBCC_ROOT_PATH)/libbcc-host-build.mk
-LIBBCC_DEVICE_BUILD_MK := $(LIBBCC_ROOT_PATH)/libbcc-device-build.mk
-
-#=====================================================================
-# Related Makefile Paths of LLVM
-#=====================================================================
-include $(LLVM_ROOT_PATH)/llvm.mk
diff --git a/libbcc.sha1.mk b/libbcc.sha1.mk
deleted file mode 100644
index 60c05d7..0000000
--- a/libbcc.sha1.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-#=====================================================================
-# Calculate SHA1 checksum for libbcc.so, libRS.so and libclcore.bc
-#=====================================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libbcc.sha1
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-
-libbcc_SHA1_SRCS := \
- $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libbcc.so \
- $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libcompiler_rt.so \
- $($(my_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRS.so \
- $(call intermediates-dir-for,SHARED_LIBRARIES,libclcore.bc,,,$(my_2nd_arch_prefix))/libclcore.bc \
- $(call intermediates-dir-for,SHARED_LIBRARIES,libclcore_debug.bc,,,$(my_2nd_arch_prefix))/libclcore_debug.bc
-
-ifeq ($(TARGET_$(my_2nd_arch_prefix)ARCH),arm)
-ifeq ($(ARCH_ARM_HAVE_NEON),true)
- libbcc_SHA1_SRCS += \
- $(call intermediates-dir-for,SHARED_LIBRARIES,libclcore_neon.bc,,,$(my_2nd_arch_prefix))/libclcore_neon.bc
-endif
-endif
-
-libbcc_GEN_SHA1_STAMP := $(LOCAL_PATH)/tools/build/gen-sha1-stamp.py
-intermediates := $(call local-intermediates-dir,,$(my_2nd_arch_prefix))
-
-libbcc_SHA1_ASM := $(intermediates)/libbcc.sha1.S
-LOCAL_GENERATED_SOURCES += $(libbcc_SHA1_ASM)
-$(libbcc_SHA1_ASM): PRIVATE_SHA1_SRCS := $(libbcc_SHA1_SRCS)
-$(libbcc_SHA1_ASM): $(libbcc_SHA1_SRCS) $(libbcc_GEN_SHA1_STAMP)
- @echo libbcc.sha1: $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(libbcc_GEN_SHA1_STAMP) $(PRIVATE_SHA1_SRCS) > $@
-
-LOCAL_CFLAGS += -D_REENTRANT -DPIC -fPIC
-LOCAL_CFLAGS += -O3 -nodefaultlibs -nostdlib
-
-LOCAL_MODULE_TARGET_ARCH := $(filter $(TARGET_$(my_2nd_arch_prefix)ARCH),$(LLVM_SUPPORTED_ARCH))
-
-ifdef LOCAL_MODULE_TARGET_ARCH
-include $(BUILD_SHARED_LIBRARY)
-endif
-endif
diff --git a/llvm-loadable-libbcc.mk b/llvm-loadable-libbcc.mk
deleted file mode 100644
index 5e47ced..0000000
--- a/llvm-loadable-libbcc.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (C) 2015 The Android Open Source Project
-#
-# 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.
-#
-
-# Checks whether libbcc can be built as an LLVM loadable module on the
-# host.
-CAN_BUILD_HOST_LLVM_LOADABLE_MODULE := true
-
-ifneq ($(FORCE_BUILD_LLVM_COMPONENTS),true)
-CAN_BUILD_HOST_LLVM_LOADABLE_MODULE := false
-endif
diff --git a/tools/Android.bp b/tools/Android.bp
new file mode 100644
index 0000000..15e0a1e
--- /dev/null
+++ b/tools/Android.bp
@@ -0,0 +1,5 @@
+subdirs = [
+ "bcc",
+ "bcc_compat",
+ "bcc_strip_attr",
+]
diff --git a/tools/Android.mk b/tools/Android.mk
deleted file mode 100644
index 1106ba0..0000000
--- a/tools/Android.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright (C) 2010-2012 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tools/bcc/Android.bp b/tools/bcc/Android.bp
new file mode 100644
index 0000000..b1f7c7f
--- /dev/null
+++ b/tools/bcc/Android.bp
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2010-2012 The Android Open Source Project
+//
+// 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.
+//
+
+cc_binary {
+ name: "bcc",
+ host_supported: true,
+ defaults: ["libbcc-defaults"],
+
+ srcs: ["Main.cpp"],
+
+ shared_libs: [
+ "libbcc",
+ "libbcinfo",
+ "libLLVM",
+ ],
+
+ target: {
+ host: {
+ host_ldlibs: ["-ldl"],
+ },
+ android: {
+ shared_libs: [
+ "libdl",
+ "liblog",
+ "libutils",
+ "libcutils",
+ ],
+ },
+ },
+}
diff --git a/tools/bcc/Android.mk b/tools/bcc/Android.mk
deleted file mode 100644
index b2a8410..0000000
--- a/tools/bcc/Android.mk
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# Copyright (C) 2010-2012 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-# Executable for host
-# ========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := bcc
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-LOCAL_SRC_FILES := Main.cpp
-
-LOCAL_SHARED_LIBRARIES := \
- libbcc \
- libbcinfo \
- libLLVM
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/../../include
-
-LOCAL_LDLIBS = -ldl
-
-include $(LIBBCC_HOST_BUILD_MK)
-include $(LLVM_HOST_BUILD_MK)
-include $(BUILD_HOST_EXECUTABLE)
-
-# Executable for target
-# ========================================================
-ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := bcc
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-LOCAL_SRC_FILES := Main.cpp
-
-LOCAL_SHARED_LIBRARIES := libdl liblog libbcinfo libbcc libLLVM libutils libcutils
-
-include $(LIBBCC_DEVICE_BUILD_MK)
-include $(LLVM_DEVICE_BUILD_MK)
-include $(BUILD_EXECUTABLE)
-endif
diff --git a/tools/bcc_compat/Android.bp b/tools/bcc_compat/Android.bp
new file mode 100644
index 0000000..51f5a81
--- /dev/null
+++ b/tools/bcc_compat/Android.bp
@@ -0,0 +1,48 @@
+//
+// Copyright (C) 2012 The Android Open Source Project
+//
+// 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.
+//
+
+// Executable for host
+// ========================================================
+cc_binary_host {
+ name: "bcc_compat",
+ defaults: ["libbcc-defaults"],
+
+ srcs: ["Main.cpp"],
+
+ target: {
+ windows: {
+ enabled: true,
+ },
+ darwin: {
+ host_ldlibs: ["-ldl"],
+ },
+ linux: {
+ host_ldlibs: ["-ldl"],
+ },
+ },
+ shared_libs: [
+ "libbcc",
+ "libbcinfo",
+ "libLLVM",
+ ],
+
+ product_variables: {
+ unbundled_build: {
+ // Don't build for unbundled branches
+ enabled: false,
+ },
+ },
+}
diff --git a/tools/bcc_compat/Android.mk b/tools/bcc_compat/Android.mk
deleted file mode 100644
index 49f5f36..0000000
--- a/tools/bcc_compat/Android.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-# Don't build for unbundled branches
-ifeq (,$(TARGET_BUILD_APPS))
-
-# Executable for host
-# ========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := bcc_compat
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_MODULE_HOST_OS := darwin linux windows
-
-LOCAL_SHARED_LIBRARIES := \
- libbcc \
- libbcinfo \
- libLLVM
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/../../include
-
-LOCAL_LDLIBS_darwin = -ldl
-LOCAL_LDLIBS_linux = -ldl
-
-LOCAL_SRC_FILES := Main.cpp
-
-include $(LIBBCC_HOST_BUILD_MK)
-include $(LLVM_HOST_BUILD_MK)
-include $(BUILD_HOST_EXECUTABLE)
-
-endif # Don't build for PDK or unbundled branches
diff --git a/tools/bcc_strip_attr/Android.bp b/tools/bcc_strip_attr/Android.bp
new file mode 100644
index 0000000..bd6d4c3
--- /dev/null
+++ b/tools/bcc_strip_attr/Android.bp
@@ -0,0 +1,41 @@
+//
+// Copyright (C) 2013 The Android Open Source Project
+//
+// 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.
+//
+
+// Executable for host
+// ========================================================
+cc_binary_host {
+ name: "bcc_strip_attr",
+ defaults: ["libbcc-defaults"],
+
+ srcs: ["bcc_strip_attr.cpp"],
+ shared_libs: ["libLLVM"],
+
+ host_ldlibs: ["-lm"],
+ target: {
+ darwin: {
+ host_ldlibs: [
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ linux: {
+ host_ldlibs: [
+ "-lpthread",
+ "-ldl",
+ ],
+ },
+ },
+}
diff --git a/tools/bcc_strip_attr/Android.mk b/tools/bcc_strip_attr/Android.mk
deleted file mode 100644
index 1158f4e..0000000
--- a/tools/bcc_strip_attr/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (C) 2013 The Android Open Source Project
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-# Executable for host
-# ========================================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := bcc_strip_attr
-LOCAL_MODULE_CLASS := EXECUTABLES
-
-LOCAL_SHARED_LIBRARIES := libLLVM
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/../../include
-
-LOCAL_LDLIBS += -lm
-LOCAL_LDLIBS_darwin += -lpthread -ldl
-LOCAL_LDLIBS_linux += -lpthread -ldl
-LOCAL_SRC_FILES := bcc_strip_attr.cpp
-
-include $(LIBBCC_HOST_BUILD_MK)
-include $(LLVM_HOST_BUILD_MK)
-include $(LLVM_GEN_ATTRIBUTES_MK)
-include $(BUILD_HOST_EXECUTABLE)