Add art runtime support declaration.

Change-Id: I909ac29ef4ffbcbe93c7809e2d396ed4672f5892
diff --git a/src/compiler_llvm/art_module.cc b/src/compiler_llvm/art_module.cc
new file mode 100644
index 0000000..f4ee9f5
--- /dev/null
+++ b/src/compiler_llvm/art_module.cc
@@ -0,0 +1,658 @@
+// Generated with ./tools/gen_art_module_cc.sh
+
+// Generated by llvm2cpp - DO NOT MODIFY!
+
+
+Module* makeLLVMModuleContents(Module *mod) {
+
+mod->setModuleIdentifier("art_module.ll");
+
+// Type Definitions
+std::vector<Type*>FuncTy_0_args;
+StructType *StructTy_JavaObject = mod->getTypeByName("JavaObject");
+if (!StructTy_JavaObject) {
+StructTy_JavaObject = StructType::create(mod->getContext(), "JavaObject");
+}
+std::vector<Type*>StructTy_JavaObject_fields;
+if (StructTy_JavaObject->isOpaque()) {
+StructTy_JavaObject->setBody(StructTy_JavaObject_fields, /*isPacked=*/false);
+}
+
+PointerType* PointerTy_1 = PointerType::get(StructTy_JavaObject, 0);
+
+FuncTy_0_args.push_back(PointerTy_1);
+FunctionType* FuncTy_0 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_0_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_2_args;
+FunctionType* FuncTy_2 = FunctionType::get(
+ /*Result=*/PointerTy_1,
+ /*Params=*/FuncTy_2_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_3_args;
+FunctionType* FuncTy_3 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_3_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_4_args;
+FunctionType* FuncTy_4 = FunctionType::get(
+ /*Result=*/IntegerType::get(mod->getContext(), 1),
+ /*Params=*/FuncTy_4_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_5_args;
+FuncTy_5_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_5_args.push_back(IntegerType::get(mod->getContext(), 32));
+FunctionType* FuncTy_5 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_5_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_6_args;
+FuncTy_6_args.push_back(IntegerType::get(mod->getContext(), 32));
+FunctionType* FuncTy_6 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_6_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_7_args;
+FuncTy_7_args.push_back(PointerTy_1);
+FuncTy_7_args.push_back(IntegerType::get(mod->getContext(), 32));
+FunctionType* FuncTy_7 = FunctionType::get(
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Params=*/FuncTy_7_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_8_args;
+FuncTy_8_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_8_args.push_back(PointerTy_1);
+FunctionType* FuncTy_8 = FunctionType::get(
+ /*Result=*/PointerTy_1,
+ /*Params=*/FuncTy_8_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_9_args;
+FuncTy_9_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_9_args.push_back(PointerTy_1);
+FuncTy_9_args.push_back(IntegerType::get(mod->getContext(), 32));
+FunctionType* FuncTy_9 = FunctionType::get(
+ /*Result=*/PointerTy_1,
+ /*Params=*/FuncTy_9_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_10_args;
+FuncTy_10_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_10_args.push_back(PointerTy_1);
+FunctionType* FuncTy_10 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_10_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_11_args;
+FuncTy_11_args.push_back(PointerTy_1);
+FuncTy_11_args.push_back(IntegerType::get(mod->getContext(), 32));
+FunctionType* FuncTy_11 = FunctionType::get(
+ /*Result=*/PointerTy_1,
+ /*Params=*/FuncTy_11_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_12_args;
+FuncTy_12_args.push_back(PointerTy_1);
+FuncTy_12_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_12_args.push_back(IntegerType::get(mod->getContext(), 1));
+FunctionType* FuncTy_12 = FunctionType::get(
+ /*Result=*/PointerTy_1,
+ /*Params=*/FuncTy_12_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_13_args;
+FuncTy_13_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_13_args.push_back(PointerTy_1);
+FuncTy_13_args.push_back(IntegerType::get(mod->getContext(), 32));
+FunctionType* FuncTy_13 = FunctionType::get(
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Params=*/FuncTy_13_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_14_args;
+FuncTy_14_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_14_args.push_back(PointerTy_1);
+FuncTy_14_args.push_back(IntegerType::get(mod->getContext(), 64));
+FunctionType* FuncTy_14 = FunctionType::get(
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Params=*/FuncTy_14_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_15_args;
+FuncTy_15_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_15_args.push_back(PointerTy_1);
+FuncTy_15_args.push_back(PointerTy_1);
+FunctionType* FuncTy_15 = FunctionType::get(
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Params=*/FuncTy_15_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_16_args;
+FuncTy_16_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_16_args.push_back(PointerTy_1);
+FunctionType* FuncTy_16 = FunctionType::get(
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Params=*/FuncTy_16_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_17_args;
+FuncTy_17_args.push_back(IntegerType::get(mod->getContext(), 32));
+FuncTy_17_args.push_back(PointerTy_1);
+FunctionType* FuncTy_17 = FunctionType::get(
+ /*Result=*/IntegerType::get(mod->getContext(), 64),
+ /*Params=*/FuncTy_17_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_18_args;
+FuncTy_18_args.push_back(PointerTy_1);
+FuncTy_18_args.push_back(PointerTy_1);
+FunctionType* FuncTy_18 = FunctionType::get(
+ /*Result=*/IntegerType::get(mod->getContext(), 32),
+ /*Params=*/FuncTy_18_args,
+ /*isVarArg=*/false);
+
+std::vector<Type*>FuncTy_19_args;
+FuncTy_19_args.push_back(PointerTy_1);
+FuncTy_19_args.push_back(PointerTy_1);
+FunctionType* FuncTy_19 = FunctionType::get(
+ /*Result=*/Type::getVoidTy(mod->getContext()),
+ /*Params=*/FuncTy_19_args,
+ /*isVarArg=*/false);
+
+
+// Function Declarations
+
+Function* func___art_type_list = mod->getFunction("__art_type_list");
+if (!func___art_type_list) {
+func___art_type_list = Function::Create(
+ /*Type=*/FuncTy_0,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"__art_type_list", mod); // (external, no body)
+func___art_type_list->setCallingConv(CallingConv::C);
+}
+AttrListPtr func___art_type_list_PAL;
+func___art_type_list->setAttributes(func___art_type_list_PAL);
+
+Function* func_art_get_current_thread_from_code = mod->getFunction("art_get_current_thread_from_code");
+if (!func_art_get_current_thread_from_code) {
+func_art_get_current_thread_from_code = Function::Create(
+ /*Type=*/FuncTy_2,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_get_current_thread_from_code", mod); // (external, no body)
+func_art_get_current_thread_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_get_current_thread_from_code_PAL;
+func_art_get_current_thread_from_code->setAttributes(func_art_get_current_thread_from_code_PAL);
+
+Function* func_art_set_current_thread_from_code = mod->getFunction("art_set_current_thread_from_code");
+if (!func_art_set_current_thread_from_code) {
+func_art_set_current_thread_from_code = Function::Create(
+ /*Type=*/FuncTy_0,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_set_current_thread_from_code", mod); // (external, no body)
+func_art_set_current_thread_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_set_current_thread_from_code_PAL;
+func_art_set_current_thread_from_code->setAttributes(func_art_set_current_thread_from_code_PAL);
+
+Function* func_art_lock_object_from_code = mod->getFunction("art_lock_object_from_code");
+if (!func_art_lock_object_from_code) {
+func_art_lock_object_from_code = Function::Create(
+ /*Type=*/FuncTy_0,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_lock_object_from_code", mod); // (external, no body)
+func_art_lock_object_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_lock_object_from_code_PAL;
+func_art_lock_object_from_code->setAttributes(func_art_lock_object_from_code_PAL);
+
+Function* func_art_unlock_object_from_code = mod->getFunction("art_unlock_object_from_code");
+if (!func_art_unlock_object_from_code) {
+func_art_unlock_object_from_code = Function::Create(
+ /*Type=*/FuncTy_0,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_unlock_object_from_code", mod); // (external, no body)
+func_art_unlock_object_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_unlock_object_from_code_PAL;
+func_art_unlock_object_from_code->setAttributes(func_art_unlock_object_from_code_PAL);
+
+Function* func_art_test_suspend_from_code = mod->getFunction("art_test_suspend_from_code");
+if (!func_art_test_suspend_from_code) {
+func_art_test_suspend_from_code = Function::Create(
+ /*Type=*/FuncTy_3,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_test_suspend_from_code", mod); // (external, no body)
+func_art_test_suspend_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_test_suspend_from_code_PAL;
+func_art_test_suspend_from_code->setAttributes(func_art_test_suspend_from_code_PAL);
+
+Function* func_art_is_exception_pending_from_code = mod->getFunction("art_is_exception_pending_from_code");
+if (!func_art_is_exception_pending_from_code) {
+func_art_is_exception_pending_from_code = Function::Create(
+ /*Type=*/FuncTy_4,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_is_exception_pending_from_code", mod); // (external, no body)
+func_art_is_exception_pending_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_is_exception_pending_from_code_PAL;
+func_art_is_exception_pending_from_code->setAttributes(func_art_is_exception_pending_from_code_PAL);
+
+Function* func_art_throw_div_zero_from_code = mod->getFunction("art_throw_div_zero_from_code");
+if (!func_art_throw_div_zero_from_code) {
+func_art_throw_div_zero_from_code = Function::Create(
+ /*Type=*/FuncTy_3,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_throw_div_zero_from_code", mod); // (external, no body)
+func_art_throw_div_zero_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_throw_div_zero_from_code_PAL;
+func_art_throw_div_zero_from_code->setAttributes(func_art_throw_div_zero_from_code_PAL);
+
+Function* func_art_throw_array_bounds_from_code = mod->getFunction("art_throw_array_bounds_from_code");
+if (!func_art_throw_array_bounds_from_code) {
+func_art_throw_array_bounds_from_code = Function::Create(
+ /*Type=*/FuncTy_5,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_throw_array_bounds_from_code", mod); // (external, no body)
+func_art_throw_array_bounds_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_throw_array_bounds_from_code_PAL;
+func_art_throw_array_bounds_from_code->setAttributes(func_art_throw_array_bounds_from_code_PAL);
+
+Function* func_art_throw_no_such_method_from_code = mod->getFunction("art_throw_no_such_method_from_code");
+if (!func_art_throw_no_such_method_from_code) {
+func_art_throw_no_such_method_from_code = Function::Create(
+ /*Type=*/FuncTy_6,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_throw_no_such_method_from_code", mod); // (external, no body)
+func_art_throw_no_such_method_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_throw_no_such_method_from_code_PAL;
+func_art_throw_no_such_method_from_code->setAttributes(func_art_throw_no_such_method_from_code_PAL);
+
+Function* func_art_throw_null_pointer_exception_from_code = mod->getFunction("art_throw_null_pointer_exception_from_code");
+if (!func_art_throw_null_pointer_exception_from_code) {
+func_art_throw_null_pointer_exception_from_code = Function::Create(
+ /*Type=*/FuncTy_3,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_throw_null_pointer_exception_from_code", mod); // (external, no body)
+func_art_throw_null_pointer_exception_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_throw_null_pointer_exception_from_code_PAL;
+func_art_throw_null_pointer_exception_from_code->setAttributes(func_art_throw_null_pointer_exception_from_code_PAL);
+
+Function* func_art_throw_stack_overflow_from_code = mod->getFunction("art_throw_stack_overflow_from_code");
+if (!func_art_throw_stack_overflow_from_code) {
+func_art_throw_stack_overflow_from_code = Function::Create(
+ /*Type=*/FuncTy_0,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_throw_stack_overflow_from_code", mod); // (external, no body)
+func_art_throw_stack_overflow_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_throw_stack_overflow_from_code_PAL;
+func_art_throw_stack_overflow_from_code->setAttributes(func_art_throw_stack_overflow_from_code_PAL);
+
+Function* func_art_throw_exception_from_code = mod->getFunction("art_throw_exception_from_code");
+if (!func_art_throw_exception_from_code) {
+func_art_throw_exception_from_code = Function::Create(
+ /*Type=*/FuncTy_0,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_throw_exception_from_code", mod); // (external, no body)
+func_art_throw_exception_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_throw_exception_from_code_PAL;
+func_art_throw_exception_from_code->setAttributes(func_art_throw_exception_from_code_PAL);
+
+Function* func_art_find_catch_block_from_code = mod->getFunction("art_find_catch_block_from_code");
+if (!func_art_find_catch_block_from_code) {
+func_art_find_catch_block_from_code = Function::Create(
+ /*Type=*/FuncTy_7,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_find_catch_block_from_code", mod); // (external, no body)
+func_art_find_catch_block_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_find_catch_block_from_code_PAL;
+func_art_find_catch_block_from_code->setAttributes(func_art_find_catch_block_from_code_PAL);
+
+Function* func_art_alloc_object_from_code = mod->getFunction("art_alloc_object_from_code");
+if (!func_art_alloc_object_from_code) {
+func_art_alloc_object_from_code = Function::Create(
+ /*Type=*/FuncTy_8,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_alloc_object_from_code", mod); // (external, no body)
+func_art_alloc_object_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_alloc_object_from_code_PAL;
+func_art_alloc_object_from_code->setAttributes(func_art_alloc_object_from_code_PAL);
+
+Function* func_art_alloc_object_from_code_with_access_check = mod->getFunction("art_alloc_object_from_code_with_access_check");
+if (!func_art_alloc_object_from_code_with_access_check) {
+func_art_alloc_object_from_code_with_access_check = Function::Create(
+ /*Type=*/FuncTy_8,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_alloc_object_from_code_with_access_check", mod); // (external, no body)
+func_art_alloc_object_from_code_with_access_check->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_alloc_object_from_code_with_access_check_PAL;
+func_art_alloc_object_from_code_with_access_check->setAttributes(func_art_alloc_object_from_code_with_access_check_PAL);
+
+Function* func_art_alloc_array_from_code = mod->getFunction("art_alloc_array_from_code");
+if (!func_art_alloc_array_from_code) {
+func_art_alloc_array_from_code = Function::Create(
+ /*Type=*/FuncTy_9,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_alloc_array_from_code", mod); // (external, no body)
+func_art_alloc_array_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_alloc_array_from_code_PAL;
+func_art_alloc_array_from_code->setAttributes(func_art_alloc_array_from_code_PAL);
+
+Function* func_art_alloc_array_from_code_with_access_check = mod->getFunction("art_alloc_array_from_code_with_access_check");
+if (!func_art_alloc_array_from_code_with_access_check) {
+func_art_alloc_array_from_code_with_access_check = Function::Create(
+ /*Type=*/FuncTy_9,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_alloc_array_from_code_with_access_check", mod); // (external, no body)
+func_art_alloc_array_from_code_with_access_check->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_alloc_array_from_code_with_access_check_PAL;
+func_art_alloc_array_from_code_with_access_check->setAttributes(func_art_alloc_array_from_code_with_access_check_PAL);
+
+Function* func_art_check_and_alloc_array_from_code = mod->getFunction("art_check_and_alloc_array_from_code");
+if (!func_art_check_and_alloc_array_from_code) {
+func_art_check_and_alloc_array_from_code = Function::Create(
+ /*Type=*/FuncTy_9,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_check_and_alloc_array_from_code", mod); // (external, no body)
+func_art_check_and_alloc_array_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_check_and_alloc_array_from_code_PAL;
+func_art_check_and_alloc_array_from_code->setAttributes(func_art_check_and_alloc_array_from_code_PAL);
+
+Function* func_art_check_and_alloc_array_from_code_with_access_check = mod->getFunction("art_check_and_alloc_array_from_code_with_access_check");
+if (!func_art_check_and_alloc_array_from_code_with_access_check) {
+func_art_check_and_alloc_array_from_code_with_access_check = Function::Create(
+ /*Type=*/FuncTy_9,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_check_and_alloc_array_from_code_with_access_check", mod); // (external, no body)
+func_art_check_and_alloc_array_from_code_with_access_check->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_check_and_alloc_array_from_code_with_access_check_PAL;
+func_art_check_and_alloc_array_from_code_with_access_check->setAttributes(func_art_check_and_alloc_array_from_code_with_access_check_PAL);
+
+Function* func_art_object_init_from_code = mod->getFunction("art_object_init_from_code");
+if (!func_art_object_init_from_code) {
+func_art_object_init_from_code = Function::Create(
+ /*Type=*/FuncTy_0,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_object_init_from_code", mod); // (external, no body)
+func_art_object_init_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_object_init_from_code_PAL;
+func_art_object_init_from_code->setAttributes(func_art_object_init_from_code_PAL);
+
+Function* func_art_find_instance_field_from_code = mod->getFunction("art_find_instance_field_from_code");
+if (!func_art_find_instance_field_from_code) {
+func_art_find_instance_field_from_code = Function::Create(
+ /*Type=*/FuncTy_10,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_find_instance_field_from_code", mod); // (external, no body)
+func_art_find_instance_field_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_find_instance_field_from_code_PAL;
+func_art_find_instance_field_from_code->setAttributes(func_art_find_instance_field_from_code_PAL);
+
+Function* func_art_find_static_field_from_code = mod->getFunction("art_find_static_field_from_code");
+if (!func_art_find_static_field_from_code) {
+func_art_find_static_field_from_code = Function::Create(
+ /*Type=*/FuncTy_10,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_find_static_field_from_code", mod); // (external, no body)
+func_art_find_static_field_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_find_static_field_from_code_PAL;
+func_art_find_static_field_from_code->setAttributes(func_art_find_static_field_from_code_PAL);
+
+Function* func_art_find_interface_method_from_code = mod->getFunction("art_find_interface_method_from_code");
+if (!func_art_find_interface_method_from_code) {
+func_art_find_interface_method_from_code = Function::Create(
+ /*Type=*/FuncTy_8,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_find_interface_method_from_code", mod); // (external, no body)
+func_art_find_interface_method_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_find_interface_method_from_code_PAL;
+func_art_find_interface_method_from_code->setAttributes(func_art_find_interface_method_from_code_PAL);
+
+Function* func_art_initialize_static_storage_from_code = mod->getFunction("art_initialize_static_storage_from_code");
+if (!func_art_initialize_static_storage_from_code) {
+func_art_initialize_static_storage_from_code = Function::Create(
+ /*Type=*/FuncTy_8,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_initialize_static_storage_from_code", mod); // (external, no body)
+func_art_initialize_static_storage_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_initialize_static_storage_from_code_PAL;
+func_art_initialize_static_storage_from_code->setAttributes(func_art_initialize_static_storage_from_code_PAL);
+
+Function* func_art_initialize_type_from_code = mod->getFunction("art_initialize_type_from_code");
+if (!func_art_initialize_type_from_code) {
+func_art_initialize_type_from_code = Function::Create(
+ /*Type=*/FuncTy_8,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_initialize_type_from_code", mod); // (external, no body)
+func_art_initialize_type_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_initialize_type_from_code_PAL;
+func_art_initialize_type_from_code->setAttributes(func_art_initialize_type_from_code_PAL);
+
+Function* func_art_initialize_type_and_verify_access_from_code = mod->getFunction("art_initialize_type_and_verify_access_from_code");
+if (!func_art_initialize_type_and_verify_access_from_code) {
+func_art_initialize_type_and_verify_access_from_code = Function::Create(
+ /*Type=*/FuncTy_8,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_initialize_type_and_verify_access_from_code", mod); // (external, no body)
+func_art_initialize_type_and_verify_access_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_initialize_type_and_verify_access_from_code_PAL;
+func_art_initialize_type_and_verify_access_from_code->setAttributes(func_art_initialize_type_and_verify_access_from_code_PAL);
+
+Function* func_art_resolve_string_from_code = mod->getFunction("art_resolve_string_from_code");
+if (!func_art_resolve_string_from_code) {
+func_art_resolve_string_from_code = Function::Create(
+ /*Type=*/FuncTy_11,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_resolve_string_from_code", mod); // (external, no body)
+func_art_resolve_string_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_resolve_string_from_code_PAL;
+func_art_resolve_string_from_code->setAttributes(func_art_resolve_string_from_code_PAL);
+
+Function* func_art_resolve_method_from_code = mod->getFunction("art_resolve_method_from_code");
+if (!func_art_resolve_method_from_code) {
+func_art_resolve_method_from_code = Function::Create(
+ /*Type=*/FuncTy_12,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_resolve_method_from_code", mod); // (external, no body)
+func_art_resolve_method_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_resolve_method_from_code_PAL;
+func_art_resolve_method_from_code->setAttributes(func_art_resolve_method_from_code_PAL);
+
+Function* func_art_set32_static_from_code = mod->getFunction("art_set32_static_from_code");
+if (!func_art_set32_static_from_code) {
+func_art_set32_static_from_code = Function::Create(
+ /*Type=*/FuncTy_13,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_set32_static_from_code", mod); // (external, no body)
+func_art_set32_static_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_set32_static_from_code_PAL;
+func_art_set32_static_from_code->setAttributes(func_art_set32_static_from_code_PAL);
+
+Function* func_art_set64_static_from_code = mod->getFunction("art_set64_static_from_code");
+if (!func_art_set64_static_from_code) {
+func_art_set64_static_from_code = Function::Create(
+ /*Type=*/FuncTy_14,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_set64_static_from_code", mod); // (external, no body)
+func_art_set64_static_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_set64_static_from_code_PAL;
+func_art_set64_static_from_code->setAttributes(func_art_set64_static_from_code_PAL);
+
+Function* func_art_set_obj_static_from_code = mod->getFunction("art_set_obj_static_from_code");
+if (!func_art_set_obj_static_from_code) {
+func_art_set_obj_static_from_code = Function::Create(
+ /*Type=*/FuncTy_15,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_set_obj_static_from_code", mod); // (external, no body)
+func_art_set_obj_static_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_set_obj_static_from_code_PAL;
+func_art_set_obj_static_from_code->setAttributes(func_art_set_obj_static_from_code_PAL);
+
+Function* func_art_get32_static_from_code = mod->getFunction("art_get32_static_from_code");
+if (!func_art_get32_static_from_code) {
+func_art_get32_static_from_code = Function::Create(
+ /*Type=*/FuncTy_16,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_get32_static_from_code", mod); // (external, no body)
+func_art_get32_static_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_get32_static_from_code_PAL;
+func_art_get32_static_from_code->setAttributes(func_art_get32_static_from_code_PAL);
+
+Function* func_art_get64_static_from_code = mod->getFunction("art_get64_static_from_code");
+if (!func_art_get64_static_from_code) {
+func_art_get64_static_from_code = Function::Create(
+ /*Type=*/FuncTy_17,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_get64_static_from_code", mod); // (external, no body)
+func_art_get64_static_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_get64_static_from_code_PAL;
+func_art_get64_static_from_code->setAttributes(func_art_get64_static_from_code_PAL);
+
+Function* func_art_get_obj_static_from_code = mod->getFunction("art_get_obj_static_from_code");
+if (!func_art_get_obj_static_from_code) {
+func_art_get_obj_static_from_code = Function::Create(
+ /*Type=*/FuncTy_8,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_get_obj_static_from_code", mod); // (external, no body)
+func_art_get_obj_static_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_get_obj_static_from_code_PAL;
+func_art_get_obj_static_from_code->setAttributes(func_art_get_obj_static_from_code_PAL);
+
+Function* func_art_set32_instance_from_code = mod->getFunction("art_set32_instance_from_code");
+if (!func_art_set32_instance_from_code) {
+func_art_set32_instance_from_code = Function::Create(
+ /*Type=*/FuncTy_13,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_set32_instance_from_code", mod); // (external, no body)
+func_art_set32_instance_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_set32_instance_from_code_PAL;
+func_art_set32_instance_from_code->setAttributes(func_art_set32_instance_from_code_PAL);
+
+Function* func_art_set64_instance_from_code = mod->getFunction("art_set64_instance_from_code");
+if (!func_art_set64_instance_from_code) {
+func_art_set64_instance_from_code = Function::Create(
+ /*Type=*/FuncTy_14,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_set64_instance_from_code", mod); // (external, no body)
+func_art_set64_instance_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_set64_instance_from_code_PAL;
+func_art_set64_instance_from_code->setAttributes(func_art_set64_instance_from_code_PAL);
+
+Function* func_art_set_obj_instance_from_code = mod->getFunction("art_set_obj_instance_from_code");
+if (!func_art_set_obj_instance_from_code) {
+func_art_set_obj_instance_from_code = Function::Create(
+ /*Type=*/FuncTy_15,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_set_obj_instance_from_code", mod); // (external, no body)
+func_art_set_obj_instance_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_set_obj_instance_from_code_PAL;
+func_art_set_obj_instance_from_code->setAttributes(func_art_set_obj_instance_from_code_PAL);
+
+Function* func_art_get32_instance_from_code = mod->getFunction("art_get32_instance_from_code");
+if (!func_art_get32_instance_from_code) {
+func_art_get32_instance_from_code = Function::Create(
+ /*Type=*/FuncTy_16,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_get32_instance_from_code", mod); // (external, no body)
+func_art_get32_instance_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_get32_instance_from_code_PAL;
+func_art_get32_instance_from_code->setAttributes(func_art_get32_instance_from_code_PAL);
+
+Function* func_art_get64_instance_from_code = mod->getFunction("art_get64_instance_from_code");
+if (!func_art_get64_instance_from_code) {
+func_art_get64_instance_from_code = Function::Create(
+ /*Type=*/FuncTy_17,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_get64_instance_from_code", mod); // (external, no body)
+func_art_get64_instance_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_get64_instance_from_code_PAL;
+func_art_get64_instance_from_code->setAttributes(func_art_get64_instance_from_code_PAL);
+
+Function* func_art_get_obj_instance_from_code = mod->getFunction("art_get_obj_instance_from_code");
+if (!func_art_get_obj_instance_from_code) {
+func_art_get_obj_instance_from_code = Function::Create(
+ /*Type=*/FuncTy_8,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_get_obj_instance_from_code", mod); // (external, no body)
+func_art_get_obj_instance_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_get_obj_instance_from_code_PAL;
+func_art_get_obj_instance_from_code->setAttributes(func_art_get_obj_instance_from_code_PAL);
+
+Function* func_art_is_assignable_from_code = mod->getFunction("art_is_assignable_from_code");
+if (!func_art_is_assignable_from_code) {
+func_art_is_assignable_from_code = Function::Create(
+ /*Type=*/FuncTy_18,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_is_assignable_from_code", mod); // (external, no body)
+func_art_is_assignable_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_is_assignable_from_code_PAL;
+func_art_is_assignable_from_code->setAttributes(func_art_is_assignable_from_code_PAL);
+
+Function* func_art_check_cast_from_code = mod->getFunction("art_check_cast_from_code");
+if (!func_art_check_cast_from_code) {
+func_art_check_cast_from_code = Function::Create(
+ /*Type=*/FuncTy_19,
+ /*Linkage=*/GlobalValue::ExternalLinkage,
+ /*Name=*/"art_check_cast_from_code", mod); // (external, no body)
+func_art_check_cast_from_code->setCallingConv(CallingConv::C);
+}
+AttrListPtr func_art_check_cast_from_code_PAL;
+func_art_check_cast_from_code->setAttributes(func_art_check_cast_from_code_PAL);
+
+// Global Variable Declarations
+
+
+// Constant Definitions
+
+// Global Variable Definitions
+
+// Function Definitions
+
+return mod;
+
+}
diff --git a/src/compiler_llvm/art_module.ll b/src/compiler_llvm/art_module.ll
new file mode 100644
index 0000000..a4be947
--- /dev/null
+++ b/src/compiler_llvm/art_module.ll
@@ -0,0 +1,111 @@
+;;
+;; Copyright (C) 2012 The Android Open Source Project
+;;
+;; Licensed under the Apache License, Version 2.0 (the "License");
+;; you may not use this file except in compliance with the License.
+;; You may obtain a copy of the License at
+;;
+;;      http://www.apache.org/licenses/LICENSE-2.0
+;;
+;; Unless required by applicable law or agreed to in writing, software
+;; distributed under the License is distributed on an "AS IS" BASIS,
+;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+;; See the License for the specific language governing permissions and
+;; limitations under the License.
+;;
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Type
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+%JavaObject = type opaque
+
+declare void @__art_type_list(%JavaObject*)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Thread
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+declare %JavaObject* @art_get_current_thread_from_code()
+declare void @art_set_current_thread_from_code(%JavaObject*)
+
+declare void @art_lock_object_from_code(%JavaObject*)
+declare void @art_unlock_object_from_code(%JavaObject*)
+
+declare void @art_test_suspend_from_code()
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Exception
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+declare i1 @art_is_exception_pending_from_code()
+
+declare void @art_throw_div_zero_from_code()
+declare void @art_throw_array_bounds_from_code(i32, i32)
+declare void @art_throw_no_such_method_from_code(i32)
+declare void @art_throw_null_pointer_exception_from_code()
+declare void @art_throw_stack_overflow_from_code(%JavaObject*)
+declare void @art_throw_exception_from_code(%JavaObject*)
+
+declare i32 @art_find_catch_block_from_code(%JavaObject*, i32)
+
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Object Space
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+declare %JavaObject* @art_alloc_object_from_code(i32, %JavaObject*)
+declare %JavaObject* @art_alloc_object_from_code_with_access_check(
+  i32, %JavaObject*)
+
+declare %JavaObject* @art_alloc_array_from_code(i32, %JavaObject*, i32)
+declare %JavaObject* @art_alloc_array_from_code_with_access_check(
+  i32, %JavaObject*, i32)
+declare %JavaObject* @art_check_and_alloc_array_from_code(
+  i32, %JavaObject*, i32)
+declare %JavaObject* @art_check_and_alloc_array_from_code_with_access_check(
+  i32, %JavaObject*, i32)
+
+declare void @art_object_init_from_code(%JavaObject*)
+
+declare void @art_find_instance_field_from_code(i32, %JavaObject*)
+declare void @art_find_static_field_from_code(i32, %JavaObject*)
+
+declare %JavaObject* @art_find_interface_method_from_code(i32, %JavaObject*)
+
+declare %JavaObject* @art_initialize_static_storage_from_code(i32, %JavaObject*)
+declare %JavaObject* @art_initialize_type_from_code(i32, %JavaObject*)
+declare %JavaObject* @art_initialize_type_and_verify_access_from_code(
+  i32, %JavaObject*)
+
+declare %JavaObject* @art_resolve_string_from_code(%JavaObject*, i32)
+declare %JavaObject* @art_resolve_method_from_code(%JavaObject*, i32, i1)
+
+declare i32 @art_set32_static_from_code(i32, %JavaObject*, i32)
+declare i32 @art_set64_static_from_code(i32, %JavaObject*, i64)
+declare i32 @art_set_obj_static_from_code(i32, %JavaObject*, %JavaObject*)
+
+declare i32 @art_get32_static_from_code(i32, %JavaObject*)
+declare i64 @art_get64_static_from_code(i32, %JavaObject*)
+declare %JavaObject* @art_get_obj_static_from_code(i32, %JavaObject*)
+
+declare i32 @art_set32_instance_from_code(i32, %JavaObject*, i32)
+declare i32 @art_set64_instance_from_code(i32, %JavaObject*, i64)
+declare i32 @art_set_obj_instance_from_code(i32, %JavaObject*, %JavaObject*)
+
+declare i32 @art_get32_instance_from_code(i32, %JavaObject*)
+declare i64 @art_get64_instance_from_code(i32, %JavaObject*)
+declare %JavaObject* @art_get_obj_instance_from_code(i32, %JavaObject*)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; RTTI
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+declare i32 @art_is_assignable_from_code(%JavaObject*, %JavaObject*)
+declare void @art_check_cast_from_code(%JavaObject*, %JavaObject*)
diff --git a/src/compiler_llvm/compiler_llvm.cc b/src/compiler_llvm/compiler_llvm.cc
index 10aaca4..8a9b362 100644
--- a/src/compiler_llvm/compiler_llvm.cc
+++ b/src/compiler_llvm/compiler_llvm.cc
@@ -31,12 +31,19 @@
 namespace compiler_llvm {
 
 
+namespace {
+using namespace llvm;
+#include "art_module.cc"
+}
+
+
 CompilerLLVM::CompilerLLVM(Compiler* compiler, InstructionSet insn_set)
 : compiler_(compiler), compiler_lock_("llvm_compiler_lock"),
   insn_set_(insn_set), context_(new llvm::LLVMContext()) {
 
   // Create the module and include the runtime function declaration
   module_ = new llvm::Module("art", *context_);
+  makeLLVMModuleContents(module_);
 
   // Create IRBuilder
   irb_.reset(new IRBuilder(*context_, *module_));
diff --git a/src/compiler_llvm/ir_builder.cc b/src/compiler_llvm/ir_builder.cc
index 24fac1a..b2c795b 100644
--- a/src/compiler_llvm/ir_builder.cc
+++ b/src/compiler_llvm/ir_builder.cc
@@ -15,6 +15,7 @@
  */
 
 #include "ir_builder.h"
+#include "runtime_support_func.h"
 
 #include <llvm/Module.h>
 
@@ -30,9 +31,45 @@
 : LLVMIRBuilder(context) {
 
   // Get java object type from module
-  llvm::Type* jobject_struct_type =
-    llvm::StructType::create(context, "JavaObject");
+  llvm::Type* jobject_struct_type = module.getTypeByName("JavaObject");
+  CHECK_NE(jobject_struct_type, static_cast<llvm::Type*>(NULL));
   jobject_type_ = jobject_struct_type->getPointerTo();
+
+  // Load the runtime support function declaration from module
+  InitRuntimeSupportFuncDecl(module);
+}
+
+
+//----------------------------------------------------------------------------
+// Runtime Helper Function
+//----------------------------------------------------------------------------
+
+void IRBuilder::InitRuntimeSupportFuncDecl(llvm::Module& module) {
+  using namespace runtime_support;
+
+#define GET_RUNTIME_SUPPORT_FUNC_DECL(ID, NAME) \
+  do { \
+    llvm::Function* fn = module.getFunction(NAME); \
+    DCHECK_NE(fn, (void*)NULL) << "Function not found: " << NAME; \
+    runtime_support_func_decls_[ID] = fn; \
+  } while (0);
+
+#include "runtime_support_func_list.h"
+  RUNTIME_SUPPORT_FUNC_LIST(GET_RUNTIME_SUPPORT_FUNC_DECL)
+#undef RUNTIME_SUPPORT_FUNC_LIST
+#undef GET_RUNTIME_SUPPORT_FUNC_DECL
+}
+
+
+llvm::Function* IRBuilder::GetRuntime(runtime_support::RuntimeId rt) const {
+  using namespace runtime_support;
+
+  if (rt >= 0 && rt < MAX_ID){
+    return runtime_support_func_decls_[rt];
+  } else {
+    LOG(ERROR) << "Unknown runtime function id: " << rt;
+    return NULL;
+  }
 }
 
 
diff --git a/src/compiler_llvm/ir_builder.h b/src/compiler_llvm/ir_builder.h
index a88b16d..617ed8d 100644
--- a/src/compiler_llvm/ir_builder.h
+++ b/src/compiler_llvm/ir_builder.h
@@ -18,6 +18,7 @@
 #define ART_SRC_COMPILER_LLVM_IR_BUILDER_H_
 
 #include "backend_types.h"
+#include "runtime_support_func.h"
 
 #include <llvm/Constants.h>
 #include <llvm/DerivedTypes.h>
@@ -90,6 +91,13 @@
 
 
   //--------------------------------------------------------------------------
+  // Runtime Helper Function
+  //--------------------------------------------------------------------------
+
+  llvm::Function* GetRuntime(runtime_support::RuntimeId rt) const;
+
+
+  //--------------------------------------------------------------------------
   // Type Helper Function
   //--------------------------------------------------------------------------
 
@@ -240,6 +248,13 @@
 
  private:
   //--------------------------------------------------------------------------
+  // Runtime Helper Function (Private)
+  //--------------------------------------------------------------------------
+
+  void InitRuntimeSupportFuncDecl(llvm::Module& module);
+
+
+  //--------------------------------------------------------------------------
   // Type Helper Function (Private)
   //--------------------------------------------------------------------------
 
@@ -251,6 +266,8 @@
  private:
   llvm::PointerType* jobject_type_;
 
+  llvm::Function* runtime_support_func_decls_[runtime_support::MAX_ID];
+
 };
 
 
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index f2505f4..65d6412 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -22,6 +22,7 @@
 #include "logging.h"
 #include "object.h"
 #include "object_utils.h"
+#include "runtime_support_func.h"
 #include "stl_util.h"
 #include "stringprintf.h"
 #include "utils_llvm.h"
@@ -35,6 +36,8 @@
 namespace art {
 namespace compiler_llvm {
 
+using namespace runtime_support;
+
 
 MethodCompiler::MethodCompiler(InstructionSet insn_set,
                                Compiler* compiler,
diff --git a/src/compiler_llvm/runtime_support_func.h b/src/compiler_llvm/runtime_support_func.h
new file mode 100644
index 0000000..480b054
--- /dev/null
+++ b/src/compiler_llvm/runtime_support_func.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_FUNC_H_
+#define ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_FUNC_H_
+
+namespace art {
+namespace compiler_llvm {
+
+namespace runtime_support {
+  enum RuntimeId {
+#define DEFINE_RUNTIME_SUPPORT_FUNC_ID(ID, NAME) ID,
+#include "runtime_support_func_list.h"
+    RUNTIME_SUPPORT_FUNC_LIST(DEFINE_RUNTIME_SUPPORT_FUNC_ID)
+#undef RUNTIME_SUPPORT_FUNC_LIST
+#undef DEFINE_RUNTIME_SUPPORT_FUNC_ID
+
+    MAX_ID
+  };
+}
+
+} // namespace compiler_llvm
+} // namespace art
+
+#endif // ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_FUNC_H_
diff --git a/src/compiler_llvm/runtime_support_func_list.h b/src/compiler_llvm/runtime_support_func_list.h
new file mode 100644
index 0000000..0a1907b
--- /dev/null
+++ b/src/compiler_llvm/runtime_support_func_list.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define RUNTIME_SUPPORT_FUNC_LIST(V) \
+  V(LockObject, "art_lock_object_from_code") \
+  V(UnlockObject, "art_unlock_object_from_code") \
+  V(GetCurrentThread, "art_get_current_thread_from_code") \
+  V(SetCurrentThread, "art_set_current_thread_from_code") \
+  V(TestSuspend, "art_test_suspend_from_code") \
+  V(ThrowException, "art_throw_exception_from_code") \
+  V(ThrowNullPointerException, "art_throw_null_pointer_exception_from_code") \
+  V(ThrowDivZeroException, "art_throw_div_zero_from_code") \
+  V(ThrowIndexOutOfBounds, "art_throw_array_bounds_from_code") \
+  V(InitializeTypeAndVerifyAccess, "art_initialize_type_and_verify_access_from_code") \
+  V(InitializeType, "art_initialize_type_from_code") \
+  V(IsAssignable, "art_is_assignable_from_code") \
+  V(CheckCast, "art_check_cast_from_code") \
+  V(AllocObject, "art_alloc_object_from_code") \
+  V(AllocObjectWithAccessCheck, "art_alloc_object_from_code_with_access_check") \
+  V(AllocArray, "art_alloc_array_from_code") \
+  V(AllocArrayWithAccessCheck, "art_alloc_array_from_code_with_access_check") \
+  V(CheckAndAllocArray, "art_check_and_alloc_array_from_code") \
+  V(CheckAndAllocArrayWithAccessCheck, "art_check_and_alloc_array_from_code_with_access_check") \
+  V(FindInstanceField, "art_find_instance_field_from_code") \
+  V(FindStaticField, "art_find_static_field_from_code") \
+  V(ResolveString, "art_resolve_string_from_code") \
+  V(ResolveMethod, "art_resolve_method_from_code") \
+  V(Set32Static, "art_set32_static_from_code") \
+  V(Set64Static, "art_set64_static_from_code") \
+  V(SetObjectStatic, "art_set_obj_static_from_code") \
+  V(Get32Static, "art_get32_static_from_code") \
+  V(Get64Static, "art_get64_static_from_code") \
+  V(GetObjectStatic, "art_get_obj_static_from_code") \
+  V(Set32Instance, "art_set32_instance_from_code") \
+  V(Set64Instance, "art_set64_instance_from_code") \
+  V(SetObjectInstance, "art_set_obj_instance_from_code") \
+  V(Get32Instance, "art_get32_instance_from_code") \
+  V(Get64Instance, "art_get64_instance_from_code") \
+  V(GetObjectInstance, "art_get_obj_instance_from_code") \
+  V(InitializeStaticStorage, "art_initialize_static_storage_from_code") \
+  V(IsExceptionPending, "art_is_exception_pending_from_code") \
+  V(FindCatchBlock, "art_find_catch_block_from_code") \
+  V(ObjectInit, "art_object_init_from_code") \
+  V(FindInterfaceMethod, "art_find_interface_method_from_code")
diff --git a/src/compiler_llvm/tools/gen_art_module_cc.sh b/src/compiler_llvm/tools/gen_art_module_cc.sh
new file mode 100755
index 0000000..bc203a4
--- /dev/null
+++ b/src/compiler_llvm/tools/gen_art_module_cc.sh
@@ -0,0 +1,25 @@
+#!/bin/bash -e
+
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+SCRIPTDIR=`dirname "$0"`
+cd "${SCRIPTDIR}/.."
+
+OUTPUT_FILE=art_module.cc
+
+echo "// Generated with ${0}" > ${OUTPUT_FILE}
+echo '' >> ${OUTPUT_FILE}
+
+llc -march=cpp -cppgen=contents art_module.ll -o - >> ${OUTPUT_FILE}