Initial pass at adding X86 target support
Add some Makefile support for using X86 as a target as in "full_x86-eng"
However, this is not enough. More changes will be coming in future
changelists.
Change-Id: Id2765c9ba15404ebce09168738cebf5d00a2e15d
diff --git a/lib/Target/ARM/Android.mk b/lib/Target/ARM/Android.mk
index 4292a12..b8dba43 100644
--- a/lib/Target/ARM/Android.mk
+++ b/lib/Target/ARM/Android.mk
@@ -63,6 +63,7 @@
# For the device only
# =====================================================
+ifeq ($(TARGET_ARCH),arm)
include $(CLEAR_VARS)
include $(CLEAR_TBLGEN_VARS)
@@ -78,3 +79,4 @@
include $(LLVM_TBLGEN_RULES_MK)
include $(LLVM_GEN_INTRINSICS_MK)
include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/lib/Target/ARM/AsmPrinter/Android.mk b/lib/Target/ARM/AsmPrinter/Android.mk
index 8b9f617..cf7c038 100644
--- a/lib/Target/ARM/AsmPrinter/Android.mk
+++ b/lib/Target/ARM/AsmPrinter/Android.mk
@@ -34,6 +34,7 @@
# For the device
# =====================================================
+ifeq ($(TARGET_ARCH),arm)
include $(CLEAR_VARS)
include $(CLEAR_TBLGEN_VARS)
@@ -53,3 +54,4 @@
include $(LLVM_DEVICE_BUILD_MK)
include $(LLVM_TBLGEN_RULES_MK)
include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/lib/Target/ARM/Disassembler/Android.mk b/lib/Target/ARM/Disassembler/Android.mk
index 9024748..0e3c32c 100644
--- a/lib/Target/ARM/Disassembler/Android.mk
+++ b/lib/Target/ARM/Disassembler/Android.mk
@@ -14,6 +14,7 @@
# For the device
# =====================================================
+ifeq ($(TARGET_ARCH),arm)
include $(CLEAR_VARS)
include $(CLEAR_TBLGEN_VARS)
@@ -32,6 +33,7 @@
include $(LLVM_DEVICE_BUILD_MK)
include $(LLVM_TBLGEN_RULES_MK)
include $(BUILD_STATIC_LIBRARY)
+endif
# For the host
# =====================================================
diff --git a/lib/Target/ARM/TargetInfo/Android.mk b/lib/Target/ARM/TargetInfo/Android.mk
index 071657f..e07da39 100644
--- a/lib/Target/ARM/TargetInfo/Android.mk
+++ b/lib/Target/ARM/TargetInfo/Android.mk
@@ -31,6 +31,7 @@
# For the device
# =====================================================
+ifeq ($(TARGET_ARCH),arm)
include $(CLEAR_VARS)
include $(CLEAR_TBLGEN_VARS)
@@ -50,3 +51,4 @@
include $(LLVM_DEVICE_BUILD_MK)
include $(LLVM_TBLGEN_RULES_MK)
include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/lib/Target/X86/Android.mk b/lib/Target/X86/Android.mk
index f2604cd..8dbca01 100644
--- a/lib/Target/X86/Android.mk
+++ b/lib/Target/X86/Android.mk
@@ -1,44 +1,45 @@
LOCAL_PATH := $(call my-dir)
-# For the host only
+x86_codegen_TBLGEN_TABLES := \
+ X86GenRegisterInfo.h.inc \
+ X86GenRegisterNames.inc \
+ X86GenRegisterInfo.inc \
+ X86GenInstrNames.inc \
+ X86GenInstrInfo.inc \
+ X86GenDAGISel.inc \
+ X86GenFastISel.inc \
+ X86GenSubtarget.inc \
+ X86GenCallingConv.inc
+
+x86_codegen_SRC_FILES := \
+ SSEDomainFix.cpp \
+ X86AsmBackend.cpp \
+ X86COFFMachineModuleInfo.cpp \
+ X86CodeEmitter.cpp \
+ X86ELFWriterInfo.cpp \
+ X86FastISel.cpp \
+ X86FloatingPoint.cpp \
+ X86ISelDAGToDAG.cpp \
+ X86ISelLowering.cpp \
+ X86InstrInfo.cpp \
+ X86JITInfo.cpp \
+ X86MCAsmInfo.cpp \
+ X86MCCodeEmitter.cpp \
+ X86MCInstLower.cpp \
+ X86RegisterInfo.cpp \
+ X86SelectionDAGInfo.cpp \
+ X86Subtarget.cpp \
+ X86TargetMachine.cpp \
+ X86TargetObjectFile.cpp
+
+# For the host
# =====================================================
include $(CLEAR_VARS)
include $(CLEAR_TBLGEN_VARS)
-TBLGEN_TABLES := \
- X86GenRegisterInfo.h.inc \
- X86GenRegisterNames.inc \
- X86GenRegisterInfo.inc \
- X86GenInstrNames.inc \
- X86GenInstrInfo.inc \
- X86GenAsmMatcher.inc \
- X86GenDAGISel.inc \
- X86GenDisassemblerTables.inc \
- X86GenFastISel.inc \
- X86GenCallingConv.inc \
- X86GenSubtarget.inc \
- X86GenEDInfo.inc
+TBLGEN_TABLES := $(x86_codegen_TBLGEN_TABLES)
-LOCAL_SRC_FILES := \
- SSEDomainFix.cpp \
- X86AsmBackend.cpp \
- X86COFFMachineModuleInfo.cpp \
- X86CodeEmitter.cpp \
- X86ELFWriterInfo.cpp \
- X86FastISel.cpp \
- X86FloatingPoint.cpp \
- X86ISelDAGToDAG.cpp \
- X86ISelLowering.cpp \
- X86InstrInfo.cpp \
- X86JITInfo.cpp \
- X86MCAsmInfo.cpp \
- X86MCCodeEmitter.cpp \
- X86MCInstLower.cpp \
- X86RegisterInfo.cpp \
- X86SelectionDAGInfo.cpp \
- X86Subtarget.cpp \
- X86TargetMachine.cpp \
- X86TargetObjectFile.cpp
+LOCAL_SRC_FILES := $(x86_codegen_SRC_FILES)
LOCAL_MODULE:= libLLVMX86CodeGen
@@ -48,3 +49,23 @@
include $(LLVM_TBLGEN_RULES_MK)
include $(LLVM_GEN_INTRINSICS_MK)
include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device only
+# =====================================================
+ifeq ($(TARGET_ARCH),x86)
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(x86_codegen_TBLGEN_TABLES)
+
+LOCAL_SRC_FILES := $(x86_codegen_SRC_FILES)
+
+LOCAL_MODULE:= libLLVMX86CodeGen
+
+LOCAL_MODULE_TAGS := optional
+
+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/X86/AsmPrinter/Android.mk b/lib/Target/X86/AsmPrinter/Android.mk
index ce29e18..54ca734 100644
--- a/lib/Target/X86/AsmPrinter/Android.mk
+++ b/lib/Target/X86/AsmPrinter/Android.mk
@@ -1,23 +1,27 @@
LOCAL_PATH := $(call my-dir)
-# For the device only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
+x86_asm_printer_TBLGEN_TABLES := \
X86GenAsmWriter.inc \
X86GenAsmWriter1.inc \
X86GenInstrNames.inc \
X86GenRegisterNames.inc \
X86GenRegisterInfo.h.inc
-TBLGEN_TD_DIR := $(LOCAL_PATH)/..
-
-LOCAL_SRC_FILES := \
+x86_asm_printer_SRC_FILES := \
X86ATTInstPrinter.cpp \
X86AsmPrinter.cpp \
- X86IntelInstPrinter.cpp
+ X86IntelInstPrinter.cpp
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(x86_asm_printer_TBLGEN_TABLES)
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES := $(x86_asm_printer_SRC_FILES)
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/..
@@ -29,3 +33,27 @@
include $(LLVM_HOST_BUILD_MK)
include $(LLVM_TBLGEN_RULES_MK)
include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device
+# =====================================================
+ifeq ($(TARGET_ARCH),x86)
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(x86_asm_printer_TBLGEN_TABLES)
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES := $(x86_asm_printer_SRC_FILES)
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMX86AsmPrinter
+
+LOCAL_MODULE_TAGS := optional
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_STATIC_LIBRARY)
+endif
diff --git a/lib/Target/X86/Disassembler/Android.mk b/lib/Target/X86/Disassembler/Android.mk
index 32cdaec..0c65722 100644
--- a/lib/Target/X86/Disassembler/Android.mk
+++ b/lib/Target/X86/Disassembler/Android.mk
@@ -1,21 +1,47 @@
LOCAL_PATH := $(call my-dir)
-# For the host only
-# =====================================================
-include $(CLEAR_VARS)
-include $(CLEAR_TBLGEN_VARS)
-
-TBLGEN_TABLES := \
+x86_disassembler_TBLGEN_TABLES := \
X86GenDisassemblerTables.inc \
X86GenEDInfo.inc \
X86GenRegisterNames.inc
+x86_disassembler_SRC_FILES := \
+ X86Disassembler.cpp \
+ X86DisassemblerDecoder.c
+
+# For the device
+# =====================================================
+ifeq ($(TARGET_ARCH),x86)
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(x86_disassembler_TBLGEN_TABLES)
TBLGEN_TD_DIR := $(LOCAL_PATH)/..
-LOCAL_SRC_FILES := \
- X86Disassembler.cpp \
- X86DisassemblerDecoder.c
+LOCAL_SRC_FILES := $(x86_disassembler_SRC_FILES)
+
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMX86Disassembler
+
+LOCAL_MODULE_TAGS := optional
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_STATIC_LIBRARY)
+endif
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(x86_disassembler_TBLGEN_TABLES)
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES := $(x86_disassembler_SRC_FILES)
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/..
diff --git a/lib/Target/X86/TargetInfo/Android.mk b/lib/Target/X86/TargetInfo/Android.mk
index 60b64f9..fcbb4e7 100644
--- a/lib/Target/X86/TargetInfo/Android.mk
+++ b/lib/Target/X86/TargetInfo/Android.mk
@@ -1,18 +1,22 @@
LOCAL_PATH := $(call my-dir)
-# For the device only
+x86_target_info_TBLGEN_TABLES := \
+ X86GenRegisterNames.inc \
+ X86GenInstrNames.inc
+
+x86_target_info_SRC_FILES := \
+ X86TargetInfo.cpp
+
+# For the host
# =====================================================
include $(CLEAR_VARS)
include $(CLEAR_TBLGEN_VARS)
-TBLGEN_TABLES := \
- X86GenRegisterNames.inc \
- X86GenInstrNames.inc
+TBLGEN_TABLES := $(x86_target_info_TBLGEN_TABLES)
TBLGEN_TD_DIR := $(LOCAL_PATH)/..
-LOCAL_SRC_FILES := \
- X86TargetInfo.cpp
+LOCAL_SRC_FILES := $(x86_target_info_SRC_FILES)
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/..
@@ -24,3 +28,27 @@
include $(LLVM_HOST_BUILD_MK)
include $(LLVM_TBLGEN_RULES_MK)
include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device
+# =====================================================
+ifeq ($(TARGET_ARCH),x86)
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES := $(x86_target_info_TBLGEN_TABLES)
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES := $(x86_target_info_SRC_FILES)
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMARMInfo
+
+LOCAL_MODULE_TAGS := optional
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_STATIC_LIBRARY)
+endif