Cleanup runtime support. Inline via IR builder.
Change-Id: Ia2d1a5c7273d71e3267ce4631cc5a56ad7f3af7a
diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc
index 77c1bf5..dd16ef7 100644
--- a/src/compiler_llvm/gbc_expander.cc
+++ b/src/compiler_llvm/gbc_expander.cc
@@ -106,6 +106,8 @@
//----------------------------------------------------------------------------
void Expand_TestSuspend(llvm::CallInst& call_inst);
+ void Expand_MarkGCCard(llvm::CallInst& call_inst);
+
llvm::Value* Expand_GetException();
llvm::Value* Expand_LoadStringFromDexCache(llvm::Value* string_idx_value);
@@ -515,6 +517,20 @@
return;
}
+void GBCExpanderPass::Expand_MarkGCCard(llvm::CallInst& call_inst) {
+ llvm::Function* parent_func = irb_.GetInsertBlock()->getParent();
+ llvm::BasicBlock* begin_bb =
+ llvm::BasicBlock::Create(context_, "mark_gc_card", parent_func);
+
+ irb_.SetInsertPoint(begin_bb);
+ irb_.Runtime().EmitMarkGCCard(call_inst.getArgOperand(0), call_inst.getArgOperand(1));
+
+ llvm::BasicBlock* end_bb = irb_.GetInsertBlock();
+
+ SplitAndInsertBasicBlocksAfter(call_inst, begin_bb, end_bb);
+ return;
+}
+
llvm::Value* GBCExpanderPass::Expand_GetException() {
// Get thread-local exception field address
llvm::Value* exception_object_addr =
@@ -974,7 +990,8 @@
return NULL;
}
case IntrinsicHelper::MarkGCCard: {
- return ExpandToRuntime(runtime_support::MarkGCCard, call_inst);
+ Expand_MarkGCCard(call_inst);
+ return NULL;
}
//==- Exception --------------------------------------------------------==//
case IntrinsicHelper::ThrowException: {