Compiling an LLVM pass for Android

Hey. I’m doing research around compiler optimizations in embedded systems. My research brought me to LLVM passes. Based on this email (, it looks like one can build an LLVM function pass and add it to Android’s CMake compilation phase.

First off, I’ll have to compile the pass using the Android toolchain (So, this maybe toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android29-clang++). I can have [Android’s CMake toolchain](


take care of this, but how would one compile an LLVM pass out-of-tree using Android’s toolchain?

Second, if anyone had experience with this or an example of running the pass itself, it’ll be greatly appreciated.

Many thanks guys