summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/gbc_expander.cc
diff options
context:
space:
mode:
author TDYa127 <tdy@google.com> 2012-07-19 03:10:08 -0700
committer Shih-wei Liao <sliao@google.com> 2012-09-15 04:15:17 -0700
commit9a129457c233b653c7a8f65c963509267252b0a7 (patch)
tree813e803d3d96397199924717ce0a8e4489d867ce /src/compiler_llvm/gbc_expander.cc
parentb672d1e48b6e02bb69c7cd9bcfa7509c81514c07 (diff)
Cleanup runtime support. Inline via IR builder.
Change-Id: Ia2d1a5c7273d71e3267ce4631cc5a56ad7f3af7a
Diffstat (limited to 'src/compiler_llvm/gbc_expander.cc')
-rw-r--r--src/compiler_llvm/gbc_expander.cc19
1 files changed, 18 insertions, 1 deletions
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: {