Updates for LLVM merge to r171906 on 20130108.

Change-Id: I096cb90103b19e3110ea562d60e5eb8ad48d9b67
diff --git a/lib/Renderscript/RSCompiler.cpp b/lib/Renderscript/RSCompiler.cpp
index ce43e8b..618c1c3 100644
--- a/lib/Renderscript/RSCompiler.cpp
+++ b/lib/Renderscript/RSCompiler.cpp
@@ -16,7 +16,7 @@
 
 #include "bcc/Renderscript/RSCompiler.h"
 
-#include <llvm/Module.h>
+#include <llvm/IR/Module.h>
 #include <llvm/PassManager.h>
 #include <llvm/Transforms/IPO.h>
 
diff --git a/lib/Renderscript/RSEmbedInfo.cpp b/lib/Renderscript/RSEmbedInfo.cpp
index faa71bf..6f6e9db 100644
--- a/lib/Renderscript/RSEmbedInfo.cpp
+++ b/lib/Renderscript/RSEmbedInfo.cpp
@@ -20,15 +20,14 @@
 #include <cstdlib>
 #include <vector>
 
-#include <llvm/DerivedTypes.h>
-#include <llvm/Function.h>
-#include <llvm/Instructions.h>
-#include <llvm/IRBuilder.h>
-#include <llvm/Module.h>
+#include <llvm/IR/DerivedTypes.h>
+#include <llvm/IR/Function.h>
+#include <llvm/IR/Instructions.h>
+#include <llvm/IR/IRBuilder.h>
+#include <llvm/IR/Module.h>
 #include <llvm/Pass.h>
 #include <llvm/Support/raw_ostream.h>
-#include <llvm/Target/TargetData.h>
-#include <llvm/Type.h>
+#include <llvm/IR/Type.h>
 
 #include "bcc/Config/Config.h"
 #include "bcc/Renderscript/RSInfo.h"
diff --git a/lib/Renderscript/RSForEachExpand.cpp b/lib/Renderscript/RSForEachExpand.cpp
index 443f0af..bf1a199 100644
--- a/lib/Renderscript/RSForEachExpand.cpp
+++ b/lib/Renderscript/RSForEachExpand.cpp
@@ -19,15 +19,15 @@
 
 #include <cstdlib>
 
-#include <llvm/DerivedTypes.h>
-#include <llvm/Function.h>
-#include <llvm/Instructions.h>
-#include <llvm/IRBuilder.h>
-#include <llvm/Module.h>
+#include <llvm/IR/DerivedTypes.h>
+#include <llvm/IR/Function.h>
+#include <llvm/IR/Instructions.h>
+#include <llvm/IR/IRBuilder.h>
+#include <llvm/IR/Module.h>
 #include <llvm/Pass.h>
 #include <llvm/Support/raw_ostream.h>
-#include <llvm/Target/TargetData.h>
-#include <llvm/Type.h>
+#include <llvm/IR/DataLayout.h>
+#include <llvm/IR/Type.h>
 
 #include "bcc/Config/Config.h"
 #include "bcc/Renderscript/RSInfo.h"
@@ -103,19 +103,19 @@
   }
 
   // Get the actual value we should use to step through an allocation.
-  // TD - Target Data size/layout information.
+  // DL - Target Data size/layout information.
   // T - Type of allocation (should be a pointer).
   // OrigStep - Original step increment (root.expand() input from driver).
-  llvm::Value *getStepValue(llvm::TargetData *TD, llvm::Type *T,
+  llvm::Value *getStepValue(llvm::DataLayout *DL, llvm::Type *T,
                             llvm::Value *OrigStep) {
-    bccAssert(TD);
+    bccAssert(DL);
     bccAssert(T);
     bccAssert(OrigStep);
     llvm::PointerType *PT = llvm::dyn_cast<llvm::PointerType>(T);
     llvm::Type *VoidPtrTy = llvm::Type::getInt8PtrTy(*C);
     if (mEnableStepOpt && T != VoidPtrTy && PT) {
       llvm::Type *ET = PT->getElementType();
-      uint64_t ETSize = TD->getTypeAllocSize(ET);
+      uint64_t ETSize = DL->getTypeAllocSize(ET);
       llvm::Type *Int32Ty = llvm::Type::getInt32Ty(*C);
       return llvm::ConstantInt::get(Int32Ty, ETSize);
     } else {
@@ -171,7 +171,7 @@
       }
     }
 
-    llvm::TargetData TD(M);
+    llvm::DataLayout DL(M);
 
     llvm::Type *VoidPtrTy = llvm::Type::getInt8PtrTy(*C);
     llvm::Type *Int32Ty = llvm::Type::getInt32Ty(*C);
@@ -272,7 +272,7 @@
     if (hasIn(Signature)) {
       InTy = Args->getType();
       AIn = Builder.CreateAlloca(InTy, 0, "AIn");
-      InStep = getStepValue(&TD, InTy, Arg_instep);
+      InStep = getStepValue(&DL, InTy, Arg_instep);
       InStep->setName("instep");
       Builder.CreateStore(Builder.CreatePointerCast(Builder.CreateLoad(
           Builder.CreateStructGEP(Arg_p, 0)), InTy), AIn);
@@ -284,7 +284,7 @@
     if (hasOut(Signature)) {
       OutTy = Args->getType();
       AOut = Builder.CreateAlloca(OutTy, 0, "AOut");
-      OutStep = getStepValue(&TD, OutTy, Arg_outstep);
+      OutStep = getStepValue(&DL, OutTy, Arg_outstep);
       OutStep->setName("outstep");
       Builder.CreateStore(Builder.CreatePointerCast(Builder.CreateLoad(
           Builder.CreateStructGEP(Arg_p, 1)), OutTy), AOut);
@@ -391,7 +391,7 @@
     ALOGV("Expanding kernel Function %s", F->getName().str().c_str());
 
     // TODO: Refactor this to share functionality with ExpandFunction.
-    llvm::TargetData TD(M);
+    llvm::DataLayout DL(M);
 
     llvm::Type *VoidPtrTy = llvm::Type::getInt8PtrTy(*C);
     llvm::Type *Int32Ty = llvm::Type::getInt32Ty(*C);
@@ -501,7 +501,7 @@
         // We don't increment Args, since we are using the actual return type.
       }
       AOut = Builder.CreateAlloca(OutTy, 0, "AOut");
-      OutStep = getStepValue(&TD, OutTy, Arg_outstep);
+      OutStep = getStepValue(&DL, OutTy, Arg_outstep);
       OutStep->setName("outstep");
       Builder.CreateStore(Builder.CreatePointerCast(Builder.CreateLoad(
           Builder.CreateStructGEP(Arg_p, 1)), OutTy), AOut);
@@ -514,7 +514,7 @@
       InBaseTy = Args->getType();
       InTy =InBaseTy->getPointerTo();
       AIn = Builder.CreateAlloca(InTy, 0, "AIn");
-      InStep = getStepValue(&TD, InTy, Arg_instep);
+      InStep = getStepValue(&DL, InTy, Arg_instep);
       InStep->setName("instep");
       Builder.CreateStore(Builder.CreatePointerCast(Builder.CreateLoad(
           Builder.CreateStructGEP(Arg_p, 0)), InTy), AIn);
diff --git a/lib/Renderscript/RSInfoExtractor.cpp b/lib/Renderscript/RSInfoExtractor.cpp
index c0775b5..09e707b 100644
--- a/lib/Renderscript/RSInfoExtractor.cpp
+++ b/lib/Renderscript/RSInfoExtractor.cpp
@@ -19,9 +19,9 @@
 //===----------------------------------------------------------------------===//
 #include "bcc/Renderscript/RSInfo.h"
 
-#include <llvm/Constants.h>
-#include <llvm/Metadata.h>
-#include <llvm/Module.h>
+#include <llvm/IR/Constants.h>
+#include <llvm/IR/Metadata.h>
+#include <llvm/IR/Module.h>
 
 #include "bcc/Source.h"
 #include "bcc/Support/Log.h"
diff --git a/lib/Renderscript/runtime/build_bc_lib.mk b/lib/Renderscript/runtime/build_bc_lib.mk
index 58f5f6e..d003f5b 100644
--- a/lib/Renderscript/runtime/build_bc_lib.mk
+++ b/lib/Renderscript/runtime/build_bc_lib.mk
@@ -29,7 +29,7 @@
              -O3 \
              -fno-builtin \
              -emit-llvm \
-             -ccc-host-triple armv7-none-linux-gnueabi \
+             -target armv7-none-linux-gnueabi \
              -fsigned-char \
 	     $(bc_translated_clang_cc1_cflags)
 
diff --git a/lib/Renderscript/runtime/build_clcore.sh b/lib/Renderscript/runtime/build_clcore.sh
index 329831f..842245c 100755
--- a/lib/Renderscript/runtime/build_clcore.sh
+++ b/lib/Renderscript/runtime/build_clcore.sh
@@ -9,12 +9,12 @@
 scriptc_path=../../../../base/libs/rs/scriptc
 clang_header_path=../../../../../external/clang/lib/Headers
 
-clang -ccc-host-triple armv7-none-linux-gnueabi -I${scriptc_path} -I${clang_header_path} -c -std=c99 -O3 rs_cl.c -emit-llvm -o rs_cl.bc
+clang -target armv7-none-linux-gnueabi -I${scriptc_path} -I${clang_header_path} -c -std=c99 -O3 rs_cl.c -emit-llvm -o rs_cl.bc
 
 # Generate rs_core.bc
 # ===================
 
-clang -ccc-host-triple armv7-none-linux-gnueabi -I${scriptc_path} -I${clang_header_path} -c -std=c99 -O3 rs_core.c -emit-llvm -o rs_core.bc
+clang -target armv7-none-linux-gnueabi -I${scriptc_path} -I${clang_header_path} -c -std=c99 -O3 rs_core.c -emit-llvm -o rs_core.bc
 
 # Link everything together
 # ========================