From 9a129457c233b653c7a8f65c963509267252b0a7 Mon Sep 17 00:00:00 2001 From: TDYa127 Date: Thu, 19 Jul 2012 03:10:08 -0700 Subject: Cleanup runtime support. Inline via IR builder. Change-Id: Ia2d1a5c7273d71e3267ce4631cc5a56ad7f3af7a --- src/compiler_llvm/gbc_expander.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/compiler_llvm/gbc_expander.cc') diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc index 77c1bf5aa1..dd16ef7c7b 100644 --- a/src/compiler_llvm/gbc_expander.cc +++ b/src/compiler_llvm/gbc_expander.cc @@ -106,6 +106,8 @@ class GBCExpanderPass : public llvm::FunctionPass { //---------------------------------------------------------------------------- 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 @@ void GBCExpanderPass::Expand_TestSuspend(llvm::CallInst& call_inst) { 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 @@ GBCExpanderPass::ExpandIntrinsic(IntrinsicHelper::IntrinsicId intr_id, return NULL; } case IntrinsicHelper::MarkGCCard: { - return ExpandToRuntime(runtime_support::MarkGCCard, call_inst); + Expand_MarkGCCard(call_inst); + return NULL; } //==- Exception --------------------------------------------------------==// case IntrinsicHelper::ThrowException: { -- cgit v1.2.3-59-g8ed1b