diff options
| author | 2012-07-27 06:46:50 -0700 | |
|---|---|---|
| committer | 2012-07-27 06:46:50 -0700 | |
| commit | 8772f7d8b066887340e39bcb99a0009dd168b4d2 (patch) | |
| tree | 10c43fd229bd9d74ee624ee219c874454253544c /src/compiler/codegen/MethodBitcode.cc | |
| parent | f1ea6b072b8b473eabf91d1d582fb5966ffea4ba (diff) | |
| parent | 9a2487f94efeb88016a695af823bf26799ef0f06 (diff) | |
am 9a2487f9: Quick compiler - NOT_LONG and verification fixes
* commit '9a2487f94efeb88016a695af823bf26799ef0f06':
Quick compiler - NOT_LONG and verification fixes
Diffstat (limited to 'src/compiler/codegen/MethodBitcode.cc')
| -rw-r--r-- | src/compiler/codegen/MethodBitcode.cc | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/compiler/codegen/MethodBitcode.cc b/src/compiler/codegen/MethodBitcode.cc index 6c9f1463fe..864372a544 100644 --- a/src/compiler/codegen/MethodBitcode.cc +++ b/src/compiler/codegen/MethodBitcode.cc @@ -49,7 +49,11 @@ llvm::Value* getLLVMValue(CompilationUnit* cUnit, int sReg) void defineValue(CompilationUnit* cUnit, llvm::Value* val, int sReg) { llvm::Value* placeholder = getLLVMValue(cUnit, sReg); - CHECK(placeholder != NULL) << "Null placeholder - shouldn't happen"; + if (placeholder == NULL) { + // This can happen on instruction rewrite on verification failure + LOG(WARNING) << "Null placeholder - invalid CFG"; + return; + } placeholder->replaceAllUsesWith(val); val->takeName(placeholder); cUnit->llvmValues.elemList[sReg] = (intptr_t)val; @@ -1298,7 +1302,13 @@ bool convertMIRNode(CompilationUnit* cUnit, MIR* mir, BasicBlock* bb, case Instruction::MOVE_RESULT: case Instruction::MOVE_RESULT_OBJECT: #if defined(TARGET_ARM) - CHECK(false) << "Unexpected MOVE_RESULT"; + /* + * Instruction rewriting on verification failure can eliminate + * the invoke that feeds this move0result. It won't ever be reached, + * so we can ignore it. + * TODO: verify that previous instruction if THROW_VERIFICATION_ERROR + */ + UNIMPLEMENTED(WARNING) << "Need to verify previous inst was rewritten"; #else UNIMPLEMENTED(WARNING) << "need x86 move-result fusing"; #endif @@ -2261,12 +2271,19 @@ void cvtBinOp(CompilationUnit* cUnit, OpKind op, llvm::Instruction* inst) DCHECK(lhsImm == NULL); RegLocation rlSrc1 = getLoc(cUnit, inst->getOperand(0)); llvm::Value* rhs = inst->getOperand(1); - if (llvm::ConstantInt* src2 = llvm::dyn_cast<llvm::ConstantInt>(rhs)) { + llvm::ConstantInt* constRhs = llvm::dyn_cast<llvm::ConstantInt>(rhs); + if (!rlDest.wide && (constRhs != NULL)) { Instruction::Code dalvikOp = getDalvikOpcode(op, true, false); - genArithOpIntLit(cUnit, dalvikOp, rlDest, rlSrc1, src2->getSExtValue()); + genArithOpIntLit(cUnit, dalvikOp, rlDest, rlSrc1, constRhs->getSExtValue()); } else { Instruction::Code dalvikOp = getDalvikOpcode(op, false, rlDest.wide); - RegLocation rlSrc2 = getLoc(cUnit, rhs); + RegLocation rlSrc2; + if (constRhs != NULL) { + DCHECK_EQ(dalvikOp, Instruction::NOT_LONG); + rlSrc2 = rlSrc1; + } else { + rlSrc2 = getLoc(cUnit, rhs); + } if (rlDest.wide) { genArithOpLong(cUnit, dalvikOp, rlDest, rlSrc1, rlSrc2); } else { |