aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk46
-rw-r--r--device/include/llvm/Config/AsmParsers.def3
-rw-r--r--device/include/llvm/Config/AsmPrinters.def2
-rw-r--r--device/include/llvm/Config/Disassemblers.def3
-rw-r--r--device/include/llvm/Config/Targets.def2
-rw-r--r--device/include/llvm/Config/config.h4
-rw-r--r--host/include/llvm/Config/AsmParsers.def3
-rw-r--r--host/include/llvm/Config/AsmPrinters.def4
-rw-r--r--host/include/llvm/Config/Disassemblers.def2
-rw-r--r--host/include/llvm/Config/Targets.def1
-rw-r--r--lib/Support/Memory.cpp2
-rw-r--r--lib/Target/Mips/Android.mk67
-rw-r--r--lib/Target/Mips/InstPrinter/Android.mk43
-rw-r--r--lib/Target/Mips/MCTargetDesc/Android.mk53
-rw-r--r--lib/Target/Mips/TargetInfo/Android.mk47
-rw-r--r--tools/llc/Android.mk56
16 files changed, 306 insertions, 32 deletions
diff --git a/Android.mk b/Android.mk
index 21fe737..1b9e06d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -4,7 +4,8 @@ LLVM_ENABLE_ASSERTION := false
include $(CLEAR_VARS)
-subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
+# LLVM Libraries
+subdirs := \
lib/Analysis \
lib/Analysis/IPA \
lib/AsmParser \
@@ -20,31 +21,46 @@ subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
lib/Support \
lib/TableGen \
lib/Target \
+ lib/Transforms/IPO \
+ lib/Transforms/InstCombine \
+ lib/Transforms/Instrumentation \
+ lib/Transforms/Scalar \
+ lib/Transforms/Utils \
+ lib/VMCore \
+ utils/TableGen
+
+# ARM Code Generation Libraries
+subdirs += \
lib/Target/ARM \
lib/Target/ARM/AsmParser \
lib/Target/ARM/InstPrinter \
lib/Target/ARM/Disassembler \
lib/Target/ARM/MCTargetDesc \
- lib/Target/ARM/TargetInfo \
+ lib/Target/ARM/TargetInfo
+
+# MIPS Code Generation Libraries
+subdirs += \
+ lib/Target/Mips \
+ lib/Target/Mips/InstPrinter \
+ lib/Target/Mips/MCTargetDesc \
+ lib/Target/Mips/TargetInfo
+
+# X86 Code Generation Libraries
+subdirs += \
lib/Target/X86 \
lib/Target/X86/AsmParser \
lib/Target/X86/InstPrinter \
lib/Target/X86/Disassembler \
lib/Target/X86/MCTargetDesc \
lib/Target/X86/TargetInfo \
- lib/Target/X86/Utils \
- lib/Transforms/IPO \
- lib/Transforms/InstCombine \
- lib/Transforms/Instrumentation \
- lib/Transforms/Scalar \
- lib/Transforms/Utils \
- lib/VMCore \
- utils/TableGen \
- tools/llvm-as \
- tools/llvm-link \
- ))
+ lib/Target/X86/Utils
-include $(LOCAL_PATH)/llvm.mk
+# LLVM Command Line Tools
+#subdirs += tools/llc
+subdirs += tools/llvm-as
+subdirs += tools/llvm-link
+#subdirs += tools/opt
-include $(subdirs)
+include $(LOCAL_PATH)/llvm.mk
+include $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, $(subdirs)))
diff --git a/device/include/llvm/Config/AsmParsers.def b/device/include/llvm/Config/AsmParsers.def
index 45903a4..106734f 100644
--- a/device/include/llvm/Config/AsmParsers.def
+++ b/device/include/llvm/Config/AsmParsers.def
@@ -26,6 +26,9 @@
#if defined(__arm__)
LLVM_ASM_PARSER(ARM)
+#elif defined(__mips__)
+ // MIPS does not support assembly parser.
+ //LLVM_ASM_PARSER(Mips)
#elif defined(__i386__)
LLVM_ASM_PARSER(X86)
#else
diff --git a/device/include/llvm/Config/AsmPrinters.def b/device/include/llvm/Config/AsmPrinters.def
index b7311ba..c9c7902 100644
--- a/device/include/llvm/Config/AsmPrinters.def
+++ b/device/include/llvm/Config/AsmPrinters.def
@@ -26,6 +26,8 @@
#if defined(__arm__)
LLVM_ASM_PRINTER(ARM)
+#elif defined(__mips__)
+ LLVM_ASM_PRINTER(Mips)
#elif defined(__i386__)
LLVM_ASM_PRINTER(X86)
#else
diff --git a/device/include/llvm/Config/Disassemblers.def b/device/include/llvm/Config/Disassemblers.def
index 39df62e..c6d6a60 100644
--- a/device/include/llvm/Config/Disassemblers.def
+++ b/device/include/llvm/Config/Disassemblers.def
@@ -26,6 +26,9 @@
#if defined(__arm__)
LLVM_DISASSEMBLER(ARM)
+#elif defined(__mips__)
+ // MIPS does not support disassembler.
+ //LLVM_DISASSEMBLER(Mips)
#elif defined(__i386__)
LLVM_DISASSEMBLER(X86)
#else
diff --git a/device/include/llvm/Config/Targets.def b/device/include/llvm/Config/Targets.def
index 4094606..4a16bb3 100644
--- a/device/include/llvm/Config/Targets.def
+++ b/device/include/llvm/Config/Targets.def
@@ -25,6 +25,8 @@
#if defined(__arm__)
LLVM_TARGET(ARM)
+#elif defined(__mips__)
+ LLVM_TARGET(Mips)
#elif defined(__i386__)
LLVM_TARGET(X86)
#else
diff --git a/device/include/llvm/Config/config.h b/device/include/llvm/Config/config.h
index c2599c9..8f6b8f6 100644
--- a/device/include/llvm/Config/config.h
+++ b/device/include/llvm/Config/config.h
@@ -501,6 +501,8 @@
/* LLVM architecture name for the native architecture, if available */
#if defined(__arm__)
# define LLVM_NATIVE_ARCH ARMTarget
+#elif defined(__mips__)
+# define LLVM_NATIVE_ARCH MipsTarget
#elif defined(__i386__)
# define LLVM_NATIVE_ARCH X86Target
#else
@@ -510,6 +512,8 @@
/* Short LLVM architecture name for the native architecture, if available */
#if defined(__arm__)
# define LLVM_NATIVE_ARCHNAME ARM
+#elif defined(__mips__)
+# define LLVM_NATIVE_ARCHNAME Mips
#elif defined(__i386__)
# define LLVM_NATIVE_ARCHNAME X86
#else
diff --git a/host/include/llvm/Config/AsmParsers.def b/host/include/llvm/Config/AsmParsers.def
index dd5c70c..7e60e4e 100644
--- a/host/include/llvm/Config/AsmParsers.def
+++ b/host/include/llvm/Config/AsmParsers.def
@@ -24,6 +24,7 @@
# error Please define the macro LLVM_ASM_PARSER(TargetName)
#endif
-LLVM_ASM_PARSER(X86) LLVM_ASM_PARSER(X86)
+LLVM_ASM_PARSER(ARM)
+LLVM_ASM_PARSER(X86)
#undef LLVM_ASM_PARSER
diff --git a/host/include/llvm/Config/AsmPrinters.def b/host/include/llvm/Config/AsmPrinters.def
index cefdfeb..ed417b0 100644
--- a/host/include/llvm/Config/AsmPrinters.def
+++ b/host/include/llvm/Config/AsmPrinters.def
@@ -24,6 +24,8 @@
# error Please define the macro LLVM_ASM_PRINTER(TargetName)
#endif
-LLVM_ASM_PRINTER(ARM) LLVM_ASM_PRINTER(X86) LLVM_ASM_PRINTER(X86)
+LLVM_ASM_PRINTER(ARM)
+LLVM_ASM_PRINTER(Mips)
+LLVM_ASM_PRINTER(X86)
#undef LLVM_ASM_PRINTER
diff --git a/host/include/llvm/Config/Disassemblers.def b/host/include/llvm/Config/Disassemblers.def
index d3a679a..4b2abdd 100644
--- a/host/include/llvm/Config/Disassemblers.def
+++ b/host/include/llvm/Config/Disassemblers.def
@@ -24,7 +24,7 @@
# error Please define the macro LLVM_DISASSEMBLER(TargetName)
#endif
-LLVM_DISASSEMBLER(X86)
LLVM_DISASSEMBLER(ARM)
+LLVM_DISASSEMBLER(X86)
#undef LLVM_DISASSEMBLER
diff --git a/host/include/llvm/Config/Targets.def b/host/include/llvm/Config/Targets.def
index 9826f60..176bbbf 100644
--- a/host/include/llvm/Config/Targets.def
+++ b/host/include/llvm/Config/Targets.def
@@ -24,6 +24,7 @@
#endif
LLVM_TARGET(ARM)
+LLVM_TARGET(Mips)
LLVM_TARGET(X86)
#undef LLVM_TARGET
diff --git a/lib/Support/Memory.cpp b/lib/Support/Memory.cpp
index 2a1642a..6806c1d 100644
--- a/lib/Support/Memory.cpp
+++ b/lib/Support/Memory.cpp
@@ -71,7 +71,7 @@ void llvm::sys::Memory::InvalidateInstructionCache(const void *Addr,
char *End = Start + Len;
__clear_cache(Start, End);
# elif defined(__mips__)
- cacheflush((char*)Addr, Len, BCACHE);
+ cacheflush((intptr_t)Addr, Len, BCACHE);
# endif
#endif // end apple
diff --git a/lib/Target/Mips/Android.mk b/lib/Target/Mips/Android.mk
new file mode 100644
index 0000000..acd2150
--- /dev/null
+++ b/lib/Target/Mips/Android.mk
@@ -0,0 +1,67 @@
+LOCAL_PATH := $(call my-dir)
+
+mips_codegen_TBLGEN_TABLES := \
+ MipsGenRegisterInfo.inc \
+ MipsGenInstrInfo.inc \
+ MipsGenCodeEmitter.inc \
+ MipsGenMCCodeEmitter.inc \
+ MipsGenAsmWriter.inc \
+ MipsGenDAGISel.inc \
+ MipsGenCallingConv.inc \
+ MipsGenSubtargetInfo.inc
+
+mips_codegen_SRC_FILES := \
+ MipsAsmPrinter.cpp \
+ MipsCodeEmitter.cpp \
+ MipsDelaySlotFiller.cpp \
+ MipsEmitGPRestore.cpp \
+ MipsExpandPseudo.cpp \
+ MipsJITInfo.cpp \
+ MipsInstrInfo.cpp \
+ MipsISelDAGToDAG.cpp \
+ MipsISelLowering.cpp \
+ MipsFrameLowering.cpp \
+ MipsMCInstLower.cpp \
+ MipsRegisterInfo.cpp \
+ MipsSubtarget.cpp \
+ MipsTargetMachine.cpp \
+ MipsTargetObjectFile.cpp \
+ MipsSelectionDAGInfo.cpp
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libLLVMMipsCodeGen
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(mips_codegen_SRC_FILES)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/MCTargetDesc
+
+TBLGEN_TABLES := $(mips_codegen_TBLGEN_TABLES)
+
+include $(LLVM_HOST_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(LLVM_GEN_INTRINSICS_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device only
+# =====================================================
+ifeq ($(TARGET_ARCH),mips)
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libLLVMMipsCodeGen
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(mips_codegen_SRC_FILES)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/MCTargetDesc
+
+TBLGEN_TABLES := $(mips_codegen_TBLGEN_TABLES)
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(LLVM_GEN_INTRINSICS_MK)
+include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/lib/Target/Mips/InstPrinter/Android.mk b/lib/Target/Mips/InstPrinter/Android.mk
new file mode 100644
index 0000000..6e9a537
--- /dev/null
+++ b/lib/Target/Mips/InstPrinter/Android.mk
@@ -0,0 +1,43 @@
+LOCAL_PATH := $(call my-dir)
+
+mips_asm_printer_TBLGEN_TABLES := \
+ MipsGenAsmWriter.inc
+
+mips_asm_printer_SRC_FILES := \
+ MipsInstPrinter.cpp
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libLLVMMipsAsmPrinter
+LOCAL_MODULE_TAGS := optional
+
+TBLGEN_TABLES := $(mips_asm_printer_TBLGEN_TABLES)
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES := $(mips_asm_printer_SRC_FILES)
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
+
+include $(LLVM_HOST_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libLLVMMipsAsmPrinter
+LOCAL_MODULE_TAGS := optional
+
+TBLGEN_TABLES := $(mips_asm_printer_TBLGEN_TABLES)
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES := $(mips_asm_printer_SRC_FILES)
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Target/Mips/MCTargetDesc/Android.mk b/lib/Target/Mips/MCTargetDesc/Android.mk
new file mode 100644
index 0000000..a728a80
--- /dev/null
+++ b/lib/Target/Mips/MCTargetDesc/Android.mk
@@ -0,0 +1,53 @@
+LOCAL_PATH := $(call my-dir)
+
+mips_mc_desc_TBLGEN_TABLES := \
+ MipsGenRegisterInfo.inc \
+ MipsGenInstrInfo.inc \
+ MipsGenMCCodeEmitter.inc \
+ MipsGenSubtargetInfo.inc
+
+mips_mc_desc_SRC_FILES := \
+ MipsAsmBackend.cpp \
+ MipsMCAsmInfo.cpp \
+ MipsMCCodeEmitter.cpp \
+ MipsMCTargetDesc.cpp
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libLLVMMipsDesc
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(mips_mc_desc_SRC_FILES)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+TBLGEN_TABLES := $(mips_mc_desc_TBLGEN_TABLES)
+
+include $(LLVM_HOST_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(LLVM_GEN_INTRINSICS_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device only
+# =====================================================
+ifeq ($(TARGET_ARCH),mips)
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libLLVMMipsDesc
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(mips_mc_desc_SRC_FILES)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+TBLGEN_TABLES := $(mips_mc_desc_TBLGEN_TABLES)
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(LLVM_GEN_INTRINSICS_MK)
+include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/lib/Target/Mips/TargetInfo/Android.mk b/lib/Target/Mips/TargetInfo/Android.mk
new file mode 100644
index 0000000..e3f41bc
--- /dev/null
+++ b/lib/Target/Mips/TargetInfo/Android.mk
@@ -0,0 +1,47 @@
+LOCAL_PATH := $(call my-dir)
+
+mips_target_info_TBLGEN_TABLES := \
+ MipsGenInstrInfo.inc \
+ MipsGenRegisterInfo.inc \
+ MipsGenSubtargetInfo.inc
+
+mips_target_info_SRC_FILES := \
+ MipsTargetInfo.cpp
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libLLVMMipsInfo
+LOCAL_MODULE_TAGS := optional
+
+TBLGEN_TABLES := $(mips_target_info_TBLGEN_TABLES)
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES := $(mips_target_info_SRC_FILES)
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
+
+include $(LLVM_HOST_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device
+# =====================================================
+ifeq ($(TARGET_ARCH),mips)
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+LOCAL_MODULE:= libLLVMMipsInfo
+LOCAL_MODULE_TAGS := optional
+
+TBLGEN_TABLES := $(mips_target_info_TBLGEN_TABLES)
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES := $(mips_target_info_SRC_FILES)
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/tools/llc/Android.mk b/tools/llc/Android.mk
index f9c76cc..86b79be 100644
--- a/tools/llc/Android.mk
+++ b/tools/llc/Android.mk
@@ -10,12 +10,29 @@ LLVM_ROOT_PATH := $(LOCAL_PATH)/../..
llvm_llc_SRC_FILES := \
llc.cpp
-llvm_llc_STATIC_LIBRARIES := \
+llvm_llc_mips_STATIC_LIBRARIES := \
+ libLLVMMipsInfo \
+ libLLVMMipsCodeGen \
+ libLLVMMipsDesc \
+ libLLVMMipsAsmPrinter \
+
+llvm_llc_x86_STATIC_LIBRARIES := \
+ libLLVMX86Info \
+ libLLVMX86AsmParser \
+ libLLVMX86CodeGen \
+ libLLVMX86Disassembler \
+ libLLVMX86Desc \
+ libLLVMX86AsmPrinter \
+ libLLVMX86Utils
+
+llvm_llc_arm_STATIC_LIBRARIES := \
libLLVMARMCodeGen \
libLLVMARMDisassembler \
libLLVMARMAsmParser \
libLLVMARMDesc \
- libLLVMARMInfo \
+ libLLVMARMInfo
+
+llvm_llc_STATIC_LIBRARIES := \
libLLVMAsmPrinter \
libLLVMAsmParser \
libLLVMBitReader \
@@ -32,9 +49,9 @@ llvm_llc_STATIC_LIBRARIES := \
libLLVMScalarOpts \
libLLVMTransformUtils \
libLLVMAnalysis \
+ libLLVMTarget \
libLLVMCore \
- libLLVMSupport \
- libLLVMTarget
+ libLLVMSupport
#===---------------------------------------------------------------===
@@ -49,15 +66,13 @@ LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true
LOCAL_SRC_FILES := $(llvm_llc_SRC_FILES)
+
LOCAL_STATIC_LIBRARIES := \
- libLLVMX86Info \
- libLLVMX86AsmParser \
- libLLVMX86CodeGen \
- libLLVMX86Disassembler \
- libLLVMX86Desc \
- libLLVMX86AsmPrinter \
- libLLVMX86Utils \
+ $(llvm_llc_arm_STATIC_LIBRARIES) \
+ $(llvm_llc_mips_STATIC_LIBRARIES) \
+ $(llvm_llc_x86_STATIC_LIBRARIES) \
$(llvm_llc_STATIC_LIBRARIES)
+
LOCAL_LDLIBS += -lpthread -lm -ldl
LOCAL_C_INCLUDES += external/llvm/include
@@ -79,12 +94,27 @@ LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES := $(llvm_llc_SRC_FILES)
LOCAL_C_INCLUDES += external/llvm/include
-LOCAL_STATIC_LIBRARIES := $(llvm_llc_STATIC_LIBRARIES)
+
+ifeq ($(TARGET_ARCH),arm)
+ LOCAL_STATIC_LIBRARIES := $(llvm_llc_arm_STATIC_LIBRARIES)
+else
+ ifeq ($(TARGET_ARCH),mips)
+ LOCAL_STATIC_LIBRARIES := $(llvm_llc_mips_STATIC_LIBRARIES)
+ else
+ ifeq ($(TARGET_ARCH),x86)
+ LOCAL_STATIC_LIBRARIES := $(llvm_llc__STATIC_LIBRARIES)
+ else
+ $(error "Unsupport llc target $(TARGET_ARCH)")
+ endif
+ endif
+endif
+
+LOCAL_STATIC_LIBRARIES += $(llvm_llc_STATIC_LIBRARIES)
+
LOCAL_SHARED_LIBRARIES := \
libdl \
libstlport
-
include $(LLVM_ROOT_PATH)/llvm.mk
include $(LLVM_DEVICE_BUILD_MK)
include $(LLVM_GEN_INTRINSICS_MK)