summaryrefslogtreecommitdiff
path: root/src/compiler/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/codegen')
-rw-r--r--src/compiler/codegen/gen_loadstore.cc19
-rw-r--r--src/compiler/codegen/mir_to_gbc.cc9
2 files changed, 17 insertions, 11 deletions
diff --git a/src/compiler/codegen/gen_loadstore.cc b/src/compiler/codegen/gen_loadstore.cc
index eec74af2da..6c16d40849 100644
--- a/src/compiler/codegen/gen_loadstore.cc
+++ b/src/compiler/codegen/gen_loadstore.cc
@@ -46,15 +46,18 @@ void Codegen::Workaround7250540(CompilationUnit* cu, RegLocation rl_dest, int ze
int pmap_index = SRegToPMap(cu, rl_dest.s_reg_low);
if (cu->promotion_map[pmap_index].fp_location == kLocPhysReg) {
// Now, determine if this vreg is ever used as a reference. If not, we're done.
- bool used_as_reference = false;
- int base_vreg = SRegToVReg(cu, rl_dest.s_reg_low);
- for (int i = 0; !used_as_reference && (i < cu->num_ssa_regs); i++) {
- if (SRegToVReg(cu, cu->reg_location[i].s_reg_low) == base_vreg) {
- used_as_reference |= cu->reg_location[i].ref;
+ if (!cu->gen_bitcode) {
+ // TUNING: We no longer have this info for QuickGBC - assume the worst
+ bool used_as_reference = false;
+ int base_vreg = SRegToVReg(cu, rl_dest.s_reg_low);
+ for (int i = 0; !used_as_reference && (i < cu->num_ssa_regs); i++) {
+ if (SRegToVReg(cu, cu->reg_location[i].s_reg_low) == base_vreg) {
+ used_as_reference |= cu->reg_location[i].ref;
+ }
+ }
+ if (!used_as_reference) {
+ return;
}
- }
- if (!used_as_reference) {
- return;
}
if (cu->promotion_map[pmap_index].core_location == kLocPhysReg) {
// Promoted - just copy in a zero
diff --git a/src/compiler/codegen/mir_to_gbc.cc b/src/compiler/codegen/mir_to_gbc.cc
index 6758bb9f69..e1e1fb16a5 100644
--- a/src/compiler/codegen/mir_to_gbc.cc
+++ b/src/compiler/codegen/mir_to_gbc.cc
@@ -1643,6 +1643,9 @@ static void ConvertExtendedMIR(CompilationUnit* cu, BasicBlock* bb, MIR* mir,
if (rl_dest.high_word) {
return; // No Phi node - handled via low word
}
+ // LLVM requires that all Phi nodes are at the beginning of the block
+ llvm::IRBuilderBase::InsertPoint ip = cu->irb->saveAndClearIP();
+ cu->irb->SetInsertPoint(llvm_bb);
int* incoming = reinterpret_cast<int*>(mir->dalvikInsn.vB);
llvm::Type* phi_type =
LlvmTypeFromLocRec(cu, rl_dest);
@@ -1662,6 +1665,8 @@ static void ConvertExtendedMIR(CompilationUnit* cu, BasicBlock* bb, MIR* mir,
phi->addIncoming(GetLLVMValue(cu, loc.orig_sreg),
GetLLVMBlock(cu, it->second));
}
+ // Now that Phi node is emitted, add definition at old insert point
+ cu->irb->restoreIP(ip);
DefineValue(cu, phi, rl_dest.orig_sreg);
break;
}
@@ -1789,9 +1794,7 @@ static bool BlockBitcodeConversion(CompilationUnit* cu, BasicBlock* bb)
greenland::IntrinsicHelper::AllocaShadowFrame;
llvm::Function* func = cu->intrinsic_helper->GetIntrinsicFunction(id);
llvm::Value* entries = cu->irb->getInt32(cu->num_shadow_frame_entries);
- llvm::Value* dalvik_regs = cu->irb->getInt32(cu->num_dalvik_registers);
- llvm::Value* args[] = { entries, dalvik_regs };
- cu->irb->CreateCall(func, args);
+ cu->irb->CreateCall(func, entries);
} else if (bb->block_type == kExitBlock) {
/*
* Because of the differences between how MIR/LIR and llvm handle exit