For disassembler

Change-Id: I14e64ec4640cbeb57ac87473775e8ba8a7320b3f
diff --git a/lib/CodeGen/AsmPrinter/Android.mk b/lib/CodeGen/AsmPrinter/Android.mk
index dcad0a9..0063f43 100644
--- a/lib/CodeGen/AsmPrinter/Android.mk
+++ b/lib/CodeGen/AsmPrinter/Android.mk
@@ -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 $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := $(codegen_asmprinter_SRC_FILES)
+LOCAL_SRC_FILES :=	\
+  	AsmPrinter.cpp	\
+   	AsmPrinterInlineAsm.cpp
+
 LOCAL_MODULE:= libLLVMAsmPrinter
 
 include $(LLVM_DEVICE_BUILD_MK)
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index e907f07..f7c9d84 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -13,8 +13,10 @@
 
 #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 @@
     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 @@
   }
   
   // Emit pre-function debug and/or EH information.
+#ifndef ANDROID_TARGET_BUILD
   if (DE) {
     if (TimePassesIsEnabled) {
       NamedRegionTimer T(EHTimerName, DWARFGroupName);
@@ -377,6 +382,7 @@
       DD->beginFunction(MF);
     }
   }
+#endif // ANDROID_TARGET_BUILD
 }
 
 /// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
@@ -535,6 +541,7 @@
       
       ++EmittedInsts;
       
+#ifndef ANDROID_TARGET_BUILD
       if (ShouldPrintDebugScopes) {
 	if (TimePassesIsEnabled) {
 	  NamedRegionTimer T(DbgTimerName, DWARFGroupName);
@@ -543,6 +550,7 @@
 	  DD->beginScope(II);
 	}
       }
+#endif // ANDROID_TARGET_BUILD
       
       if (isVerbose())
         EmitComments(*II, OutStreamer.GetCommentOS());
@@ -573,6 +581,7 @@
         break;
       }
       
+#ifndef ANDROID_TARGET_BUILD
       if (ShouldPrintDebugScopes) {
 	if (TimePassesIsEnabled) {
 	  NamedRegionTimer T(DbgTimerName, DWARFGroupName);
@@ -581,6 +590,7 @@
 	  DD->endScope(II);
 	}
       }
+#endif // ANDROID_TARGET_BUILD
     }
   }
   
@@ -616,6 +626,7 @@
   }
   
   // Emit post-function debug information.
+#ifndef ANDROID_TARGET_BUILD
   if (DD) {
     if (TimePassesIsEnabled) {
       NamedRegionTimer T(DbgTimerName, DWARFGroupName);
@@ -632,6 +643,7 @@
       DE->EndFunction();
     }
   }
+#endif // ANDROID_TARGET_BUILD
   MMI->EndFunction();
   
   // Print out jump tables referenced by the function.
@@ -648,6 +660,7 @@
     EmitGlobalVariable(I);
   
   // Finalize debug and EH information.
+#ifndef ANDROID_TARGET_BUILD
   if (DE) {
     if (TimePassesIsEnabled) {
       NamedRegionTimer T(EHTimerName, DWARFGroupName);
@@ -666,6 +679,7 @@
     }
     delete DD; DD = 0;
   }
+#endif // ANDROID_TARGET_BUILD
   
   // If the target wants to know about weak references, print them all.
   if (MAI->getWeakRefDirective()) {
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index 37d10e5..35e4d1b 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -37,6 +37,7 @@
 
 /// 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 @@
                        /*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 @@
   if (OutStreamer.hasRawTextSupport())
     OutStreamer.EmitRawText(Twine("\t")+MAI->getCommentString()+
                             MAI->getInlineAsmEnd());
+#endif // ANDROID_TARGET_BUILD
 }