Initialize AsmPrinter for compiler.
It is required to initialize AsmPrinter for compiler
in order to generate machine code. Without this commit,
libbcc will not work if we set USE_DISASSEMBLER to 0.
Change-Id: If6a18c82df5c8cab84fb26afd163152ed1307aa8
diff --git a/lib/Disassembler/Disassembler.cpp b/lib/Disassembler/Disassembler.cpp
index 7ef39cf..8a2cf2c 100644
--- a/lib/Disassembler/Disassembler.cpp
+++ b/lib/Disassembler/Disassembler.cpp
@@ -69,17 +69,11 @@
void InitializeDisassembler() {
#if defined(DEFAULT_ARM_CODEGEN) || defined(PROVIDE_ARM_CODEGEN)
LLVMInitializeARMDisassembler();
- LLVMInitializeARMAsmPrinter();
#endif
-#if defined(DEFAULT_X86_CODEGEN) || defined(PROVIDE_X86_CODEGEN)
+#if defined(DEFAULT_X86_CODEGEN) || defined(PROVIDE_X86_CODEGEN) || \
+ defined(DEFAULT_X64_CODEGEN) || defined(PROVIDE_X64_CODEGEN)
LLVMInitializeX86Disassembler();
- LLVMInitializeX86AsmPrinter();
-#endif
-
-#if defined(DEFAULT_X64_CODEGEN) || defined(PROVIDE_X64_CODEGEN)
- LLVMInitializeX86Disassembler();
- LLVMInitializeX86AsmPrinter();
#endif
}
diff --git a/lib/ExecutionEngine/Compiler.cpp b/lib/ExecutionEngine/Compiler.cpp
index 5b03144..4faa411 100644
--- a/lib/ExecutionEngine/Compiler.cpp
+++ b/lib/ExecutionEngine/Compiler.cpp
@@ -142,17 +142,15 @@
#if defined(DEFAULT_ARM_CODEGEN) || defined(PROVIDE_ARM_CODEGEN)
LLVMInitializeARMMCAsmInfo();
+ LLVMInitializeARMAsmPrinter();
LLVMInitializeARMTargetInfo();
LLVMInitializeARMTarget();
#endif
-#if defined(DEFAULT_X86_CODEGEN) || defined(PROVIDE_X86_CODEGEN)
+#if defined(DEFAULT_X86_CODEGEN) || defined(PROVIDE_X86_CODEGEN) || \
+ defined(DEFAULT_X64_CODEGEN) || defined(PROVIDE_X64_CODEGEN)
LLVMInitializeX86MCAsmInfo();
- LLVMInitializeX86TargetInfo();
- LLVMInitializeX86Target();
-#endif
-
-#if defined(DEFAULT_X64_CODEGEN) || defined(PROVIDE_X64_CODEGEN)
+ LLVMInitializeX86AsmPrinter();
LLVMInitializeX86TargetInfo();
LLVMInitializeX86Target();
#endif