summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-03-08 21:05:27 -0800
committerElliott Hughes <enh@google.com>2012-03-09 15:37:46 -0800
commitb3bd5f07884f5a1f2b84224363b1372d7c28d447 (patch)
tree6e2997ab64b4a4f32d7ef539a4649adc736ea553 /build
parentddbd01ac1660d57416879d5a576482f1048dde64 (diff)
downloadart-b3bd5f07884f5a1f2b84224363b1372d7c28d447.zip
art-b3bd5f07884f5a1f2b84224363b1372d7c28d447.tar.gz
art-b3bd5f07884f5a1f2b84224363b1372d7c28d447.tar.bz2
Refactor the compilers out of libart.
This builds three separate compilers and dynamically links with the right one at runtime. Change-Id: I59d22b9884f41de733c09f97e29ee290236d5f4b
Diffstat (limited to 'build')
-rw-r--r--build/Android.common.mk49
-rw-r--r--build/Android.libart-compiler.mk141
2 files changed, 143 insertions, 47 deletions
diff --git a/build/Android.common.mk b/build/Android.common.mk
index e84df3e..0ab796a 100644
--- a/build/Android.common.mk
+++ b/build/Android.common.mk
@@ -14,6 +14,7 @@
# limitations under the License.
#
+# TODO: move the LLVM compiler out into a separate .so too...
# Use llvm as the backend
ifneq ($(wildcard art/USE_LLVM_COMPILER),)
ART_USE_LLVM_COMPILER := true
@@ -21,20 +22,6 @@ else
ART_USE_LLVM_COMPILER := false
endif
-# Build for MIPS target (temporary)
-ifneq ($(wildcard art/MIPS_TARGET),)
-ART_MIPS_TARGET := true
-else
-ART_MIPS_TARGET := false
-endif
-
-# Build for x86 target (temporary)
-ifneq ($(wildcard art/X86_TARGET),)
-ART_X86_TARGET := true
-else
-ART_X86_TARGET := false
-endif
-
ifeq ($(ART_USE_LLVM_COMPILER),true)
LLVM_ROOT_PATH := external/llvm
include $(LLVM_ROOT_PATH)/llvm.mk
@@ -73,11 +60,6 @@ ifeq ($(ART_USE_LLVM_COMPILER),true)
art_cflags += -DART_USE_LLVM_COMPILER=1
endif
-# (temp) for testing
-ifeq ($(ART_MIPS_TARGET),true)
-art_cflags += -D__mips_hard_float
-endif
-
ifeq ($(HOST_OS),linux)
art_non_debug_cflags := \
-Wframe-larger-than=1728
@@ -237,38 +219,11 @@ LIBART_COMMON_SRC_FILES += \
src/compiler_llvm/upcall_compiler.cc \
src/compiler_llvm/utils_llvm.cc
else
+# TODO: should these be in libart-compiler.so instead?
LIBART_COMMON_SRC_FILES += \
- src/compiler/Dataflow.cc \
- src/compiler/Frontend.cc \
- src/compiler/IntermediateRep.cc \
- src/compiler/Ralloc.cc \
- src/compiler/SSATransformation.cc \
- src/compiler/Utility.cc \
- src/compiler/codegen/RallocUtil.cc \
src/jni_compiler.cc \
src/jni_internal_arm.cc \
src/jni_internal_x86.cc
-ifeq ($(ART_MIPS_TARGET),true)
-LIBART_COMMON_SRC_FILES += \
- src/compiler/codegen/mips/ArchUtility.cc \
- src/compiler/codegen/mips/MipsRallocUtil.cc \
- src/compiler/codegen/mips/Assemble.cc \
- src/compiler/codegen/mips/mips/Codegen.cc
-else
-ifeq ($(ART_X86_TARGET),true)
-LIBART_COMMON_SRC_FILES += \
- src/compiler/codegen/x86/ArchUtility.cc \
- src/compiler/codegen/x86/X86RallocUtil.cc \
- src/compiler/codegen/x86/Assemble.cc \
- src/compiler/codegen/x86/x86/Codegen.cc
-else
-LIBART_COMMON_SRC_FILES += \
- src/compiler/codegen/arm/ArchUtility.cc \
- src/compiler/codegen/arm/ArmRallocUtil.cc \
- src/compiler/codegen/arm/Assemble.cc \
- src/compiler/codegen/arm/armv7-a/Codegen.cc
-endif
-endif
endif
LIBART_TARGET_SRC_FILES := \
diff --git a/build/Android.libart-compiler.mk b/build/Android.libart-compiler.mk
new file mode 100644
index 0000000..a9108e0
--- /dev/null
+++ b/build/Android.libart-compiler.mk
@@ -0,0 +1,141 @@
+#
+# 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.
+#
+
+LIBART_COMPILER_COMMON_SRC_FILES += \
+ src/compiler/Dataflow.cc \
+ src/compiler/Frontend.cc \
+ src/compiler/IntermediateRep.cc \
+ src/compiler/Ralloc.cc \
+ src/compiler/SSATransformation.cc \
+ src/compiler/Utility.cc \
+ src/compiler/codegen/RallocUtil.cc
+
+LIBART_COMPILER_ARM_SRC_FILES += \
+ $(LIBART_COMPILER_COMMON_SRC_FILES) \
+ src/compiler/codegen/arm/ArchUtility.cc \
+ src/compiler/codegen/arm/ArmRallocUtil.cc \
+ src/compiler/codegen/arm/Assemble.cc \
+ src/compiler/codegen/arm/armv7-a/Codegen.cc
+
+LIBART_COMPILER_MIPS_SRC_FILES += \
+ $(LIBART_COMPILER_COMMON_SRC_FILES) \
+ src/compiler/codegen/mips/ArchUtility.cc \
+ src/compiler/codegen/mips/MipsRallocUtil.cc \
+ src/compiler/codegen/mips/Assemble.cc \
+ src/compiler/codegen/mips/mips/Codegen.cc
+
+LIBART_COMPILER_X86_SRC_FILES += \
+ $(LIBART_COMPILER_COMMON_SRC_FILES) \
+ src/compiler/codegen/x86/ArchUtility.cc \
+ src/compiler/codegen/x86/X86RallocUtil.cc \
+ src/compiler/codegen/x86/Assemble.cc \
+ src/compiler/codegen/x86/x86/Codegen.cc
+
+# $(1): target or host
+# $(2): ndebug or debug
+# $(3): architecture name
+# $(4): list of source files
+define build-libart-compiler
+ ifneq ($(1),target)
+ ifneq ($(1),host)
+ $$(error expected target or host for argument 1, received $(1))
+ endif
+ endif
+ ifneq ($(2),ndebug)
+ ifneq ($(2),debug)
+ $$(error expected ndebug or debug for argument 2, received $(2))
+ endif
+ endif
+
+ art_target_or_host := $(1)
+ art_ndebug_or_debug := $(2)
+ libart_compiler_arch := $(3)
+ libart_compiler_src_files := $(4)
+
+ include $(CLEAR_VARS)
+ ifeq ($$(art_target_or_host),target)
+ include external/stlport/libstlport.mk
+ endif
+ LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
+ ifeq ($$(art_ndebug_or_debug),ndebug)
+ LOCAL_MODULE := libart-compiler-$(libart_compiler_arch)
+ else # debug
+ LOCAL_MODULE := libartd-compiler-$(libart_compiler_arch)
+ endif
+
+ LOCAL_MODULE_TAGS := optional
+ LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+
+ LOCAL_SRC_FILES := $(libart_compiler_src_files)
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
+ else # host
+ LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
+ endif
+ LOCAL_SHARED_LIBRARIES := liblog
+ ifeq ($$(art_ndebug_or_debug),debug)
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
+ else # host
+ LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
+ endif
+ LOCAL_SHARED_LIBRARIES += libartd
+ else
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
+ else # host
+ LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
+ endif
+ LOCAL_SHARED_LIBRARIES += libart
+ endif
+
+ # TODO: temporary hack for testing.
+ ifeq ($(libart_compiler_arch),MIPS)
+ LOCAL_CFLAGS += -D__mips_hard_float
+ endif
+
+ LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
+ ifeq ($$(art_target_or_host),target)
+ LOCAL_SHARED_LIBRARIES += libstlport
+ else # host
+ LOCAL_LDLIBS := -ldl -lpthread
+ endif
+ ifeq ($$(art_target_or_host),target)
+ include $(BUILD_SHARED_LIBRARY)
+ else # host
+ LOCAL_IS_HOST_MODULE := true
+ include $(BUILD_HOST_SHARED_LIBRARY)
+ endif
+endef
+
+# $(1): target or host
+# $(2): ndebug or debug
+define build-libart-compilers
+ $(foreach arch,ARM MIPS X86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch),$(LIBART_COMPILER_$(arch)_SRC_FILES))))
+endef
+
+ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
+ $(eval $(call build-libart-compilers,target,ndebug))
+endif
+ifeq ($(ART_BUILD_TARGET_DEBUG),true)
+ $(eval $(call build-libart-compilers,target,debug))
+endif
+ifeq ($(ART_BUILD_HOST_NDEBUG),true)
+ $(eval $(call build-libart-compilers,host,ndebug))
+endif
+ifeq ($(ART_BUILD_HOST_DEBUG),true)
+ $(eval $(call build-libart-compilers,host,debug))
+endif