aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2013-10-08 12:08:39 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2013-10-10 14:09:22 +0800
commit389d41257b1168af1668f48126ac98abf54af26a (patch)
treebc3ae753ef19d5003a85c4dc9f9f3e1c0b76d7c0
parent39f27d8767f14b35577bf9c5eaa59db24e1985db (diff)
downloadndk-389d41257b1168af1668f48126ac98abf54af26a.tar.gz
Fix llvm-3.3 mac build; abcc VERBOSE adds llc timer
Change-Id: I7e7d6e461b53012856c4fea213ae8bce7ff248e8
-rwxr-xr-xbuild/tools/build-llvm.sh14
-rw-r--r--tests/abcc/jni/Abcc.cpp7
-rw-r--r--tests/abcc/jni/Abcc.h8
-rw-r--r--tests/abcc/jni/device/Abcc_device.h3
-rw-r--r--tests/abcc/jni/device/main.cpp9
-rw-r--r--toolchains/llvm-3.3/setup-common.mk2
6 files changed, 30 insertions, 13 deletions
diff --git a/build/tools/build-llvm.sh b/build/tools/build-llvm.sh
index e679371f8..423a645bd 100755
--- a/build/tools/build-llvm.sh
+++ b/build/tools/build-llvm.sh
@@ -245,17 +245,17 @@ LLVM_VERSION="`echo $TOOLCHAIN | tr '-' '\n' | tail -n 1`"
LLVM_VERSION_MAJOR=`echo $LLVM_VERSION | tr '.' '\n' | head -n 1`
LLVM_VERSION_MINOR=`echo $LLVM_VERSION | tr '.' '\n' | tail -n 1`
if [ $LLVM_VERSION_MAJOR -lt 3 ]; then
- USE_PYTHON=yes
+ USE_PYTHON=yes
elif [ $LLVM_VERSION_MAJOR -eq 3 ] && [ $LLVM_VERSION_MINOR -lt 3 ]; then
- USE_PYTHON=yes
+ USE_PYTHON=yes
fi
if [ "$USE_PYTHON" != "yes" ]; then
- run cp -a $NDK_DIR/tests/abcc/jni/*.cpp $SRC_DIR/$TOOLCHAIN/llvm/tools/ndk-bc2native
- run cp -a $NDK_DIR/tests/abcc/jni/*.h $SRC_DIR/$TOOLCHAIN/llvm/tools/ndk-bc2native
- run cp -a $NDK_DIR/tests/abcc/jni/host/*.cpp $SRC_DIR/$TOOLCHAIN/llvm/tools/ndk-bc2native
- run cp -a $NDK_DIR/tests/abcc/jni/host/*.h $SRC_DIR/$TOOLCHAIN/llvm/tools/ndk-bc2native
- export LLVM_TOOLS_FILTER="PARALLEL_DIRS:=\$\$(PARALLEL_DIRS:%=% ndk-bc2native)"
+ run cp -a $NDK_DIR/tests/abcc/jni/*.cpp $SRC_DIR/$TOOLCHAIN/llvm/tools/ndk-bc2native
+ run cp -a $NDK_DIR/tests/abcc/jni/*.h $SRC_DIR/$TOOLCHAIN/llvm/tools/ndk-bc2native
+ run cp -a $NDK_DIR/tests/abcc/jni/host/*.cpp $SRC_DIR/$TOOLCHAIN/llvm/tools/ndk-bc2native
+ run cp -a $NDK_DIR/tests/abcc/jni/host/*.h $SRC_DIR/$TOOLCHAIN/llvm/tools/ndk-bc2native
+ export LLVM_TOOLS_FILTER="PARALLEL_DIRS:=\$\$(PARALLEL_DIRS:%=% ndk-bc2native)"
fi
run $SRC_DIR/$TOOLCHAIN/llvm/configure \
diff --git a/tests/abcc/jni/Abcc.cpp b/tests/abcc/jni/Abcc.cpp
index e597e712b..ed2df3c44 100644
--- a/tests/abcc/jni/Abcc.cpp
+++ b/tests/abcc/jni/Abcc.cpp
@@ -185,7 +185,14 @@ void BitcodeCompiler::compile() {
std::string cmd = mExecutableToolsPath[(unsigned)CMD_COMPILE];
cmd += " " + mGlobalCFlags;
cmd += " " + bc.mTargetBCPath + " -o " + bc.mObjPath;
+#if ON_DEVICE && VERBOSE
+ Timer t_llc;
+ t_llc.start();
+#endif
runCmd(cmd, /*dump=*/true);
+#if ON_DEVICE && VERBOSE
+ llc_usec += t_llc.stop();
+#endif
if (returnCode() != RET_OK) {
mRet = RET_FAIL_COMPILE;
return;
diff --git a/tests/abcc/jni/Abcc.h b/tests/abcc/jni/Abcc.h
index 6b6d1ba01..0d9655a84 100644
--- a/tests/abcc/jni/Abcc.h
+++ b/tests/abcc/jni/Abcc.h
@@ -33,14 +33,14 @@ enum ReturnCode {
RET_FAIL_CLEANUP,
RET_FAIL_TRANSLATE,
RET_FAIL_COMPILE,
- RET_FAIL_LINK,
+ RET_FAIL_LINK
};
enum Command {
CMD_TRANSLATE = 0,
CMD_COMPILE,
CMD_LINK,
- CMD_LINK_RUNTIME,
+ CMD_LINK_RUNTIME
};
class TargetAbi {
@@ -49,7 +49,7 @@ public:
ARMEABI = 0,
ARMEABI_V7A,
X86,
- MIPS,
+ MIPS
};
private:
@@ -185,7 +185,7 @@ protected:
} // namespace abcc
// FIXME: We use LOGV, LOGE in Abcc.cpp, how to prevent this anti dependency?
-#ifdef ON_DEVICE
+#if ON_DEVICE
#include "Abcc_device.h"
#else
#include "Abcc_host.h"
diff --git a/tests/abcc/jni/device/Abcc_device.h b/tests/abcc/jni/device/Abcc_device.h
index 50eda83c4..69129afb8 100644
--- a/tests/abcc/jni/device/Abcc_device.h
+++ b/tests/abcc/jni/device/Abcc_device.h
@@ -53,6 +53,9 @@ public:
return l - l0;
}
};
+
+extern long long llc_usec;
+
#endif // VERBOSE
diff --git a/tests/abcc/jni/device/main.cpp b/tests/abcc/jni/device/main.cpp
index ced2fc744..7124d2802 100644
--- a/tests/abcc/jni/device/main.cpp
+++ b/tests/abcc/jni/device/main.cpp
@@ -19,6 +19,10 @@
#include "Abcc_device.h"
using namespace abcc;
+#if VERBOSE
+long long abcc::llc_usec;
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -49,13 +53,16 @@ Java_compiler_abcc_AbccService_genLibs(JNIEnv *env, jobject thiz,
#if VERBOSE
Timer t;
t.start();
+ llc_usec = 0;
#endif
compiler->execute();
#if VERBOSE
long long elapsed_msec = (t.stop() + 500) / 1000;
- LOGV("Elapsed time: %lld.%03ds", elapsed_msec/1000, (int)elapsed_msec%1000);
+ long long llc_msec = (llc_usec + 500) / 1000;
+ LOGV("Elapsed time: %lld.%03ds (llc = %lld.%03ds)", elapsed_msec/1000, (int)elapsed_msec%1000,
+ llc_msec/1000, (int)llc_msec%1000);
#endif
compiler->cleanupPost();
diff --git a/toolchains/llvm-3.3/setup-common.mk b/toolchains/llvm-3.3/setup-common.mk
index 07cddd6dd..1e92b73e7 100644
--- a/toolchains/llvm-3.3/setup-common.mk
+++ b/toolchains/llvm-3.3/setup-common.mk
@@ -29,7 +29,7 @@ TARGET_STRIP := $(TOOLCHAIN_PREFIX)$(LLVM_TRIPLE)-strip$(HOST_EXEEXT)
TARGET_LIBGCC :=
# Only use integrated binary if existed. Otherwise, use python version
-ifeq (,$(wildcard $(TOOLCHAIN_PREBUILT_ROOT)/bin/ndk-bc2native))
+ifeq (,$(wildcard $(TOOLCHAIN_PREBUILT_ROOT)/bin/ndk-bc2native$(HOST_EXEEXT)))
BC2NATIVE := $(HOST_PYTHON) $(TOOLCHAIN_PREBUILT_ROOT)/bin/ndk-bc2native.py
else
BC2NATIVE := $(TOOLCHAIN_PREBUILT_ROOT)/bin/ndk-bc2native$(HOST_EXEEXT)