OSDN Git Service

For disassembler
authorShih-wei Liao <sliao@google.com>
Thu, 29 Apr 2010 07:24:07 +0000 (00:24 -0700)
committerShih-wei Liao <sliao@google.com>
Thu, 29 Apr 2010 07:24:07 +0000 (00:24 -0700)
Change-Id: I14e64ec4640cbeb57ac87473775e8ba8a7320b3f

15 files changed:
Android.mk
device/include/llvm/Config/Disassemblers.def
lib/CodeGen/AsmPrinter/Android.mk
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
lib/MC/MCParser/Android.mk [new file with mode: 0644]
lib/MC/MCParser/AsmLexer.cpp
lib/Target/ARM/AsmParser/Android.mk [new file with mode: 0644]
lib/Target/ARM/AsmPrinter/Android.mk [new file with mode: 0644]
lib/Target/ARM/Disassembler/ARMDisassembler.cpp
lib/Target/ARM/Disassembler/Android.mk [new file with mode: 0644]
lib/Target/X86/AsmParser/Android.mk [new file with mode: 0644]
lib/Target/X86/AsmPrinter/Android.mk [new file with mode: 0644]
lib/Target/X86/Disassembler/Android.mk [new file with mode: 0644]
tblgen-rules.mk

index 3b35cf7..1d7e18f 100644 (file)
@@ -24,11 +24,16 @@ subdirs := $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
                lib/CodeGen/AsmPrinter  \
                lib/Target      \
                lib/Target/ARM  \
+               lib/Target/ARM/AsmPrinter       \
+               lib/Target/ARM/Disassembler     \
                lib/Target/ARM/TargetInfo       \
                lib/Target/X86  \
+               lib/Target/X86/AsmPrinter       \
+               lib/Target/X86/Disassembler     \
                lib/Target/X86/TargetInfo       \
                lib/ExecutionEngine/JIT \
                lib/MC  \
+               lib/MC/MCParser \
        ))
 
 TBLGEN := $(HOST_OUT_EXECUTABLES)/tblgen$(HOST_EXECUTABLE_SUFFIX)
index 7221c15..d663c61 100644 (file)
@@ -24,4 +24,6 @@
 #  error Please define the macro LLVM_DISASSEMBLER(TargetName)
 #endif
 
+LLVM_DISASSEMBLER(ARM)
+
 #undef LLVM_DISASSEMBLER
index dcad0a9..0063f43 100644 (file)
@@ -1,17 +1,21 @@
 LOCAL_PATH := $(call my-dir)
 
 codegen_asmprinter_SRC_FILES :=        \
-       AsmPrinter.cpp  \
-       DIE.cpp \
-       DwarfDebug.cpp  \
-       DwarfException.cpp      \
-       OcamlGCPrinter.cpp
+       AsmPrinter.cpp
 
 # For the host
 # =====================================================
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := $(codegen_asmprinter_SRC_FILES)
+LOCAL_SRC_FILES :=     \
+       AsmPrinter.cpp  \
+       AsmPrinterDwarf.cpp     \
+       AsmPrinterInlineAsm.cpp \
+       DIE.cpp \
+       DwarfDebug.cpp  \
+       DwarfException.cpp      \
+       OcamlGCPrinter.cpp  
+
 LOCAL_MODULE:= libLLVMAsmPrinter
 
 include $(LLVM_HOST_BUILD_MK)
@@ -21,7 +25,10 @@ include $(BUILD_HOST_STATIC_LIBRARY)
 # =====================================================
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := $(codegen_asmprinter_SRC_FILES)
+LOCAL_SRC_FILES :=     \
+       AsmPrinter.cpp  \
+       AsmPrinterInlineAsm.cpp
+
 LOCAL_MODULE:= libLLVMAsmPrinter
 
 include $(LLVM_DEVICE_BUILD_MK)
index e907f07..f7c9d84 100644 (file)
 
 #define DEBUG_TYPE "asm-printer"
 #include "llvm/CodeGen/AsmPrinter.h"
-#include "DwarfDebug.h"
-#include "DwarfException.h"
+#ifndef ANDROID_TARGET_BUILD
+#   include "DwarfDebug.h"
+#   include "DwarfException.h"
+#endif // ANDROID_TARGET_BUILD
 #include "llvm/Module.h"
 #include "llvm/CodeGen/GCMetadataPrinter.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
@@ -155,11 +157,13 @@ bool AsmPrinter::doInitialization(Module &M) {
     OutStreamer.AddBlankLine();
   }
 
+#ifndef ANDROID_TARGET_BUILD
   if (MAI->doesSupportDebugInformation())
     DD = new DwarfDebug(this, &M);
     
   if (MAI->doesSupportExceptionHandling())
     DE = new DwarfException(this);
+#endif // ANDROID_TARGET_BUILD
 
   return false;
 }
@@ -361,6 +365,7 @@ void AsmPrinter::EmitFunctionHeader() {
   }
   
   // Emit pre-function debug and/or EH information.
+#ifndef ANDROID_TARGET_BUILD
   if (DE) {
     if (TimePassesIsEnabled) {
       NamedRegionTimer T(EHTimerName, DWARFGroupName);
@@ -377,6 +382,7 @@ void AsmPrinter::EmitFunctionHeader() {
       DD->beginFunction(MF);
     }
   }
+#endif // ANDROID_TARGET_BUILD
 }
 
 /// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
@@ -535,6 +541,7 @@ void AsmPrinter::EmitFunctionBody() {
       
       ++EmittedInsts;
       
+#ifndef ANDROID_TARGET_BUILD
       if (ShouldPrintDebugScopes) {
        if (TimePassesIsEnabled) {
          NamedRegionTimer T(DbgTimerName, DWARFGroupName);
@@ -543,6 +550,7 @@ void AsmPrinter::EmitFunctionBody() {
          DD->beginScope(II);
        }
       }
+#endif // ANDROID_TARGET_BUILD
       
       if (isVerbose())
         EmitComments(*II, OutStreamer.GetCommentOS());
@@ -573,6 +581,7 @@ void AsmPrinter::EmitFunctionBody() {
         break;
       }
       
+#ifndef ANDROID_TARGET_BUILD
       if (ShouldPrintDebugScopes) {
        if (TimePassesIsEnabled) {
          NamedRegionTimer T(DbgTimerName, DWARFGroupName);
@@ -581,6 +590,7 @@ void AsmPrinter::EmitFunctionBody() {
          DD->endScope(II);
        }
       }
+#endif // ANDROID_TARGET_BUILD
     }
   }
   
@@ -616,6 +626,7 @@ void AsmPrinter::EmitFunctionBody() {
   }
   
   // Emit post-function debug information.
+#ifndef ANDROID_TARGET_BUILD
   if (DD) {
     if (TimePassesIsEnabled) {
       NamedRegionTimer T(DbgTimerName, DWARFGroupName);
@@ -632,6 +643,7 @@ void AsmPrinter::EmitFunctionBody() {
       DE->EndFunction();
     }
   }
+#endif // ANDROID_TARGET_BUILD
   MMI->EndFunction();
   
   // Print out jump tables referenced by the function.
@@ -648,6 +660,7 @@ bool AsmPrinter::doFinalization(Module &M) {
     EmitGlobalVariable(I);
   
   // Finalize debug and EH information.
+#ifndef ANDROID_TARGET_BUILD
   if (DE) {
     if (TimePassesIsEnabled) {
       NamedRegionTimer T(EHTimerName, DWARFGroupName);
@@ -666,6 +679,7 @@ bool AsmPrinter::doFinalization(Module &M) {
     }
     delete DD; DD = 0;
   }
+#endif // ANDROID_TARGET_BUILD
   
   // If the target wants to know about weak references, print them all.
   if (MAI->getWeakRefDirective()) {
index 37d10e5..35e4d1b 100644 (file)
@@ -37,6 +37,7 @@ using namespace llvm;
 
 /// EmitInlineAsm - Emit a blob of inline asm to the output streamer.
 void AsmPrinter::EmitInlineAsm(StringRef Str, unsigned LocCookie) const {
+#ifndef ANDROID_TARGET_BUILD
   assert(!Str.empty() && "Can't emit empty inline asm block");
   
   // Remember if the buffer is nul terminated or not so we can avoid a copy.
@@ -84,12 +85,14 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, unsigned LocCookie) const {
                        /*NoFinalize*/ true);
   if (Res && !HasDiagHandler)
     report_fatal_error("Error parsing inline asm\n");
+#endif // ANDROID_TARGET_BUILD
 }
 
 
 /// EmitInlineAsm - This method formats and emits the specified machine
 /// instruction that is an inline asm.
 void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
+#ifndef ANDROID_TARGET_BUILD
   assert(MI->isInlineAsm() && "printInlineAsm only works on inline asms");
   
   unsigned NumOperands = MI->getNumOperands();
@@ -316,6 +319,7 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {
   if (OutStreamer.hasRawTextSupport())
     OutStreamer.EmitRawText(Twine("\t")+MAI->getCommentString()+
                             MAI->getInlineAsmEnd());
+#endif // ANDROID_TARGET_BUILD
 }
 
 
diff --git a/lib/MC/MCParser/Android.mk b/lib/MC/MCParser/Android.mk
new file mode 100644 (file)
index 0000000..1335362
--- /dev/null
@@ -0,0 +1,30 @@
+LOCAL_PATH:= $(call my-dir)
+
+mc_parser_SRC_FILES := \
+       AsmLexer.cpp    \
+       AsmParser.cpp   \
+       MCAsmLexer.cpp  \
+       MCAsmParser.cpp \
+       TargetAsmParser.cpp
+
+# For the host
+# =====================================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(mc_parser_SRC_FILES)
+
+LOCAL_MODULE:= libLLVMMCParser
+
+include $(LLVM_HOST_BUILD_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+# For the device
+# =====================================================
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(mc_parser_SRC_FILES)
+
+LOCAL_MODULE:= libLLVMMCParser
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(BUILD_STATIC_LIBRARY)
index 1183312..7f9fe8a 100644 (file)
@@ -15,6 +15,7 @@
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/MC/MCAsmInfo.h"
+#include <ctype.h>
 #include <cerrno>
 #include <cstdio>
 #include <cstdlib>
diff --git a/lib/Target/ARM/AsmParser/Android.mk b/lib/Target/ARM/AsmParser/Android.mk
new file mode 100644 (file)
index 0000000..6303fd0
--- /dev/null
@@ -0,0 +1,27 @@
+LOCAL_PATH := $(call my-dir)
+
+# For the device only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=       \
+       ARMGenInstrNames.inc    \
+       ARMGenRegisterNames.inc \
+       ARMGenRegisterInfo.h.inc
+   
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES :=     \
+       ARMAsmLexer.cpp \
+       ARMAsmParser.cpp
+       
+LOCAL_C_INCLUDES +=    \
+       $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMARMAsmParser
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Target/ARM/AsmPrinter/Android.mk b/lib/Target/ARM/AsmPrinter/Android.mk
new file mode 100644 (file)
index 0000000..b906904
--- /dev/null
@@ -0,0 +1,28 @@
+LOCAL_PATH := $(call my-dir)
+
+# For the device only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=       \
+       ARMGenAsmWriter.inc     \
+       ARMGenInstrNames.inc    \
+       ARMGenRegisterNames.inc \
+       ARMGenRegisterInfo.h.inc
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES :=     \
+       ARMAsmPrinter.cpp       \
+       ARMInstPrinter.cpp      \
+       ARMMCInstLower.cpp
+       
+LOCAL_C_INCLUDES +=    \
+       $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMARMAsmPrinter
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_STATIC_LIBRARY)
index 4de697e..aeb999d 100644 (file)
@@ -37,9 +37,9 @@
 /// o static uint16_t decodeThumbInstruction(field_t insn) - the decoding
 /// function for a Thumb instruction.
 ///
-#include "../ARMGenDecoderTables.inc"
+#include "ARMGenDecoderTables.inc"
 
-#include "../ARMGenEDInfo.inc"
+#include "ARMGenEDInfo.inc"
 
 using namespace llvm;
 
diff --git a/lib/Target/ARM/Disassembler/Android.mk b/lib/Target/ARM/Disassembler/Android.mk
new file mode 100644 (file)
index 0000000..6aead82
--- /dev/null
@@ -0,0 +1,29 @@
+LOCAL_PATH := $(call my-dir)
+
+# For the device only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=       \
+       ARMGenDecoderTables.inc \
+       ARMGenEDInfo.inc        \
+       ARMGenInstrNames.inc    \
+       ARMGenInstrInfo.inc     \
+       ARMGenRegisterNames.inc \
+       ARMGenRegisterInfo.h.inc
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES :=     \
+       ARMDisassembler.cpp     \
+       ARMDisassemblerCore.cpp
+       
+LOCAL_C_INCLUDES +=    \
+       $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMARMDisassembler
+
+include $(LLVM_DEVICE_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/lib/Target/X86/AsmParser/Android.mk b/lib/Target/X86/AsmParser/Android.mk
new file mode 100644 (file)
index 0000000..c94af7f
--- /dev/null
@@ -0,0 +1,27 @@
+LOCAL_PATH := $(call my-dir)
+
+# For the device only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=       \
+       X86GenAsmMatcher.inc    \
+       X86GenInstrNames.inc    \
+       X86GenRegisterNames.inc
+       
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES :=     \
+       X86AsmLexer.cpp \
+       X86AsmParser.cpp
+       
+LOCAL_C_INCLUDES +=    \
+       $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMX86AsmParser
+
+include $(LLVM_HOST_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Target/X86/AsmPrinter/Android.mk b/lib/Target/X86/AsmPrinter/Android.mk
new file mode 100644 (file)
index 0000000..9e4c5e2
--- /dev/null
@@ -0,0 +1,30 @@
+LOCAL_PATH := $(call my-dir)
+
+# For the device only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=       \
+       X86GenAsmWriter.inc     \
+       X86GenAsmWriter1.inc    \
+       X86GenInstrNames.inc    \
+       X86GenRegisterNames.inc \
+       X86GenRegisterInfo.h.inc
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES :=     \
+       X86ATTInstPrinter.cpp   \
+       X86AsmPrinter.cpp       \
+       X86IntelInstPrinter.cpp \
+       X86MCInstLower.cpp
+       
+LOCAL_C_INCLUDES +=    \
+       $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMX86AsmPrinter
+
+include $(LLVM_HOST_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/lib/Target/X86/Disassembler/Android.mk b/lib/Target/X86/Disassembler/Android.mk
new file mode 100644 (file)
index 0000000..548360b
--- /dev/null
@@ -0,0 +1,27 @@
+LOCAL_PATH := $(call my-dir)
+
+# For the device only
+# =====================================================
+include $(CLEAR_VARS)
+include $(CLEAR_TBLGEN_VARS)
+
+TBLGEN_TABLES :=       \
+       X86GenDisassemblerTables.inc    \
+       X86GenEDInfo.inc        \
+       X86GenRegisterNames.inc
+       
+
+TBLGEN_TD_DIR := $(LOCAL_PATH)/..
+
+LOCAL_SRC_FILES :=     \
+       X86Disassembler.cpp     \
+       X86DisassemblerDecoder.c
+       
+LOCAL_C_INCLUDES +=    \
+       $(LOCAL_PATH)/..
+
+LOCAL_MODULE:= libLLVMX86Disassembler
+
+include $(LLVM_HOST_BUILD_MK)
+include $(LLVM_TBLGEN_RULES_MK)
+include $(BUILD_HOST_STATIC_LIBRARY)
index 435bc42..6e7bcf1 100644 (file)
@@ -105,4 +105,9 @@ $(intermediates)/%GenIntrinsics.inc: $(tblgen_source_dir)/%.td $(TBLGEN)
        $(call transform-td-to-out,tgt_intrinsics)
 endif
 
+ifneq ($(findstring ARMGenDecoderTables.inc,$(tblgen_gen_tables)),)
+$(intermediates)/ARMGenDecoderTables.inc: $(tblgen_source_dir)/ARM.td $(TBLGEN)
+       $(call transform-td-to-out,arm-decoder)
+endif
+
 endif