Revert "Prune away extraneous ART_USE_PORTABLE_COMPILER ifdefs."
This reverts commit 8ff2f3df63494250b1679fcce2924379871d2b47
Change-Id: I5a191b8f0d89b39220fbf561f3d6515bfe1de98a
diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc
index 64d50b5..42a87a3 100644
--- a/src/compiler_llvm/gbc_expander.cc
+++ b/src/compiler_llvm/gbc_expander.cc
@@ -369,6 +369,7 @@
func_ = &func;
changed_ = false; // Assume unchanged
+#if defined(ART_USE_PORTABLE_COMPILER)
basic_blocks_.resize(code_item_->insns_size_in_code_units_);
basic_block_landing_pads_.resize(code_item_->tries_size_, NULL);
basic_block_unwind_ = NULL;
@@ -381,6 +382,7 @@
uint32_t dex_pc = LV2UInt(bb_iter->begin()->getMetadata("DexOff")->getOperand(0));
basic_blocks_[dex_pc] = bb_iter;
}
+#endif
// Insert stack overflow check
InsertStackOverflowCheck(func); // TODO: Use intrinsic.
@@ -1049,8 +1051,10 @@
bool is_div, JType op_jty) {
llvm::Value* dividend = call_inst.getArgOperand(0);
llvm::Value* divisor = call_inst.getArgOperand(1);
+#if defined(ART_USE_PORTABLE_COMPILER)
uint32_t dex_pc = LV2UInt(call_inst.getMetadata("DexOff")->getOperand(0));
EmitGuard_DivZeroException(dex_pc, divisor, op_jty);
+#endif
// Most of the codes refer to MethodCompiler::EmitIntDivRemResultComputation
// Check the special case: MININT / -1 = MININT
@@ -1156,9 +1160,11 @@
}
void GBCExpanderPass::Expand_PopShadowFrame() {
+#if defined(ART_USE_PORTABLE_COMPILER)
if (old_shadow_frame_ == NULL) {
return;
}
+#endif
rtb_.EmitPopShadowFrame(irb_.CreateLoad(old_shadow_frame_, kTBAARegister));
return;
}
@@ -1190,6 +1196,10 @@
// alloca instructions)
EmitStackOverflowCheck(&*first_non_alloca);
+#if defined(ART_USE_PORTABLE_COMPILER)
+ irb_.Runtime().EmitTestSuspend();
+#endif
+
llvm::BasicBlock* next_basic_block = irb_.GetInsertBlock();
if (next_basic_block != first_basic_block) {
// Splice the rest of the instruction to the continuing basic block
@@ -2382,9 +2392,11 @@
}
void GBCExpanderPass::EmitUpdateDexPC(uint32_t dex_pc) {
+#if defined(ART_USE_PORTABLE_COMPILER)
if (shadow_frame_ == NULL) {
return;
}
+#endif
irb_.StoreToObjectOffset(shadow_frame_,
art::ShadowFrame::DexPCOffset(),
irb_.getInt32(dex_pc),
@@ -2472,7 +2484,9 @@
// Get return type
char ret_shorty = shorty[0];
+#if defined(ART_USE_PORTABLE_COMPILER)
ret_shorty = art::RemapShorty(ret_shorty);
+#endif
llvm::Type* ret_type = irb_.getJType(ret_shorty, kAccurate);
// Get argument type
@@ -2485,8 +2499,12 @@
}
for (uint32_t i = 1; i < shorty_size; ++i) {
+#if defined(ART_USE_PORTABLE_COMPILER)
char shorty_type = art::RemapShorty(shorty[i]);
args_type.push_back(irb_.getJType(shorty_type, kAccurate));
+#else
+ args_type.push_back(irb_.getJType(shorty[i], kAccurate));
+#endif
}
return llvm::FunctionType::get(ret_type, args_type, false);
@@ -2616,7 +2634,9 @@
// Emit the code to return default value (zero) for the given return type.
char ret_shorty = oat_compilation_unit_->GetShorty()[0];
+#if defined(ART_USE_PORTABLE_COMPILER)
ret_shorty = art::RemapShorty(ret_shorty);
+#endif
if (ret_shorty == 'V') {
irb_.CreateRetVoid();
} else {