}
} break;
case Instruction::Alloca: {
- const AllocaInst *alloca_inst = dyn_cast<AllocaInst>(inst);
-
- if (!alloca_inst) {
- LLDB_LOGF(log, "getOpcode() returns Alloca, but instruction is not an "
- "AllocaInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const AllocaInst *alloca_inst = cast<AllocaInst>(inst);
if (alloca_inst->isArrayAllocation()) {
LLDB_LOGF(log,
} break;
case Instruction::BitCast:
case Instruction::ZExt: {
- const CastInst *cast_inst = dyn_cast<CastInst>(inst);
-
- if (!cast_inst) {
- LLDB_LOGF(
- log, "getOpcode() returns %s, but instruction is not a BitCastInst",
- cast_inst->getOpcodeName());
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const CastInst *cast_inst = cast<CastInst>(inst);
Value *source = cast_inst->getOperand(0);
frame.AssignValue(inst, S, module);
} break;
case Instruction::SExt: {
- const CastInst *cast_inst = dyn_cast<CastInst>(inst);
-
- if (!cast_inst) {
- LLDB_LOGF(
- log, "getOpcode() returns %s, but instruction is not a BitCastInst",
- cast_inst->getOpcodeName());
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const CastInst *cast_inst = cast<CastInst>(inst);
Value *source = cast_inst->getOperand(0);
frame.AssignValue(inst, S_signextend, module);
} break;
case Instruction::Br: {
- const BranchInst *br_inst = dyn_cast<BranchInst>(inst);
-
- if (!br_inst) {
- LLDB_LOGF(
- log, "getOpcode() returns Br, but instruction is not a BranchInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const BranchInst *br_inst = cast<BranchInst>(inst);
if (br_inst->isConditional()) {
Value *condition = br_inst->getCondition();
}
continue;
case Instruction::PHI: {
- const PHINode *phi_inst = dyn_cast<PHINode>(inst);
-
- if (!phi_inst) {
- LLDB_LOGF(log,
- "getOpcode() returns PHI, but instruction is not a PHINode");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const PHINode *phi_inst = cast<PHINode>(inst);
if (!frame.m_prev_bb) {
LLDB_LOGF(log,
"Encountered PHI node without having jumped from another "
}
} break;
case Instruction::GetElementPtr: {
- const GetElementPtrInst *gep_inst = dyn_cast<GetElementPtrInst>(inst);
-
- if (!gep_inst) {
- LLDB_LOGF(log, "getOpcode() returns GetElementPtr, but instruction is "
- "not a GetElementPtrInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const GetElementPtrInst *gep_inst = cast<GetElementPtrInst>(inst);
const Value *pointer_operand = gep_inst->getPointerOperand();
Type *src_elem_ty = gep_inst->getSourceElementType();
}
} break;
case Instruction::ICmp: {
- const ICmpInst *icmp_inst = dyn_cast<ICmpInst>(inst);
-
- if (!icmp_inst) {
- LLDB_LOGF(
- log,
- "getOpcode() returns ICmp, but instruction is not an ICmpInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const ICmpInst *icmp_inst = cast<ICmpInst>(inst);
CmpInst::Predicate predicate = icmp_inst->getPredicate();
}
} break;
case Instruction::IntToPtr: {
- const IntToPtrInst *int_to_ptr_inst = dyn_cast<IntToPtrInst>(inst);
-
- if (!int_to_ptr_inst) {
- LLDB_LOGF(log,
- "getOpcode() returns IntToPtr, but instruction is not an "
- "IntToPtrInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const IntToPtrInst *int_to_ptr_inst = cast<IntToPtrInst>(inst);
Value *src_operand = int_to_ptr_inst->getOperand(0);
}
} break;
case Instruction::PtrToInt: {
- const PtrToIntInst *ptr_to_int_inst = dyn_cast<PtrToIntInst>(inst);
-
- if (!ptr_to_int_inst) {
- LLDB_LOGF(log,
- "getOpcode() returns PtrToInt, but instruction is not an "
- "PtrToIntInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const PtrToIntInst *ptr_to_int_inst = cast<PtrToIntInst>(inst);
Value *src_operand = ptr_to_int_inst->getOperand(0);
}
} break;
case Instruction::Trunc: {
- const TruncInst *trunc_inst = dyn_cast<TruncInst>(inst);
-
- if (!trunc_inst) {
- LLDB_LOGF(
- log,
- "getOpcode() returns Trunc, but instruction is not a TruncInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const TruncInst *trunc_inst = cast<TruncInst>(inst);
Value *src_operand = trunc_inst->getOperand(0);
}
} break;
case Instruction::Load: {
- const LoadInst *load_inst = dyn_cast<LoadInst>(inst);
-
- if (!load_inst) {
- LLDB_LOGF(
- log, "getOpcode() returns Load, but instruction is not a LoadInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const LoadInst *load_inst = cast<LoadInst>(inst);
// The semantics of Load are:
// Create a region D that will contain the loaded data
return true;
}
case Instruction::Store: {
- const StoreInst *store_inst = dyn_cast<StoreInst>(inst);
-
- if (!store_inst) {
- LLDB_LOGF(
- log,
- "getOpcode() returns Store, but instruction is not a StoreInst");
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const StoreInst *store_inst = cast<StoreInst>(inst);
// The semantics of Store are:
// Resolve the region D containing the data to be stored
}
} break;
case Instruction::Call: {
- const CallInst *call_inst = dyn_cast<CallInst>(inst);
-
- if (!call_inst) {
- LLDB_LOGF(log,
- "getOpcode() returns %s, but instruction is not a CallInst",
- inst->getOpcodeName());
- error.SetErrorToGenericError();
- error.SetErrorString(interpreter_internal_error);
- return false;
- }
+ const CallInst *call_inst = cast<CallInst>(inst);
if (CanIgnoreCall(call_inst))
break;