EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextPushRegisterOnStack;
- RegisterInfo reg_info;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
for (i = 0; i < 15; ++i) {
if (BitIsSet(registers, i)) {
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i, reg_info);
- context.SetRegisterToRegisterPlusOffset(reg_info, sp_reg, addr - sp);
+ llvm::Optional<RegisterInfo> reg_info =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
+ context.SetRegisterToRegisterPlusOffset(*reg_info, *sp_reg, addr - sp);
uint32_t reg_value = ReadCoreReg(i, &success);
if (!success)
return false;
}
if (BitIsSet(registers, 15)) {
- GetRegisterInfo(eRegisterKindDWARF, dwarf_pc, reg_info);
- context.SetRegisterToRegisterPlusOffset(reg_info, sp_reg, addr - sp);
+ llvm::Optional<RegisterInfo> reg_info =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
+ context.SetRegisterToRegisterPlusOffset(*reg_info, *sp_reg, addr - sp);
const uint32_t pc = ReadCoreReg(PC_REG, &success);
if (!success)
return false;
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextPopRegisterOffStack;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
for (i = 0; i < 15; ++i) {
if (BitIsSet(registers, i)) {
}
if (BitIsSet(registers, 15)) {
- context.SetRegisterPlusOffset(sp_reg, addr - sp);
+ context.SetRegisterPlusOffset(*sp_reg, addr - sp);
data = MemARead(context, addr, 4, 0, &success);
if (!success)
return false;
context.type = eContextSetFramePointer;
else
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
- context.SetRegisterPlusOffset(sp_reg, sp_offset);
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
+ context.SetRegisterPlusOffset(*sp_reg, sp_offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + Rd,
addr))
context.type = EmulateInstruction::eContextSetFramePointer;
else
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
- context.SetRegisterPlusOffset(sp_reg, 0);
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
+ context.SetRegisterPlusOffset(*sp_reg, 0);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + Rd, sp))
return false;
context.type = EmulateInstruction::eContextSetFramePointer;
else
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm, dwarf_reg);
- context.SetRegisterPlusOffset(dwarf_reg, 0);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
+ context.SetRegisterPlusOffset(*dwarf_reg, 0);
if (!WriteCoreRegOptionalFlags(context, result, Rd, setflags))
return false;
uint64_t result = operand1 * operand2;
// R[d] = result<31:0>;
- RegisterInfo op1_reg;
- RegisterInfo op2_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, op1_reg);
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, op2_reg);
+ llvm::Optional<RegisterInfo> op1_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> op2_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
EmulateInstruction::Context context;
context.type = eContextArithmetic;
- context.SetRegisterRegisterOperands(op1_reg, op2_reg);
+ context.SetRegisterRegisterOperands(*op1_reg, *op2_reg);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + d,
(0x0000ffff & result)))
// PC relative immediate load context
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo pc_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_pc, pc_reg);
- context.SetRegisterPlusOffset(pc_reg, 0);
+ llvm::Optional<RegisterInfo> pc_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
+ context.SetRegisterPlusOffset(*pc_reg, 0);
uint32_t Rt; // the destination register
uint32_t imm32; // immediate offset from the PC
else
address = base - imm32;
- context.SetRegisterPlusOffset(pc_reg, address - base);
+ context.SetRegisterPlusOffset(*pc_reg, address - base);
data = MemURead(context, address, 4, 0, &success);
if (!success)
return false;
else
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
- context.SetRegisterPlusOffset(sp_reg, res.result - sp);
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
+ context.SetRegisterPlusOffset(*sp_reg, res.result - sp);
if (d == 15) {
if (!ALUWritePC(context, res.result))
EmulateInstruction::Context context;
context.type = eContextArithmetic;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
-
- RegisterInfo other_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm, other_reg);
- context.SetRegisterRegisterOperands(sp_reg, other_reg);
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
+ llvm::Optional<RegisterInfo> other_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
+ context.SetRegisterRegisterOperands(*sp_reg, *other_reg);
if (!WriteRegisterUnsigned(context, eRegisterKindGeneric,
LLDB_REGNUM_GENERIC_SP, addr))
addr_t target = ReadCoreReg(Rm, &success);
if (!success)
return false;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm, dwarf_reg);
- context.SetRegister(dwarf_reg);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
+ context.SetRegister(*dwarf_reg);
if (!WriteRegisterUnsigned(context, eRegisterKindGeneric,
LLDB_REGNUM_GENERIC_RA, lr))
return false;
if (!success)
return false;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm, dwarf_reg);
- context.SetRegister(dwarf_reg);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
+ context.SetRegister(*dwarf_reg);
if (!BXWritePC(context, target))
return false;
}
if (!success)
return false;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm, dwarf_reg);
- context.SetRegister(dwarf_reg);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
+ context.SetRegister(*dwarf_reg);
if (!BXWritePC(context, target))
return false;
}
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r12, dwarf_reg);
- context.SetRegisterPlusOffset(dwarf_reg, -ip_offset);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r12);
+ context.SetRegisterPlusOffset(*dwarf_reg, -ip_offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r7, addr))
return false;
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, dwarf_reg);
- context.SetRegisterPlusOffset(dwarf_reg, -sp_offset);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
+ context.SetRegisterPlusOffset(*dwarf_reg, -sp_offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r12, addr))
return false;
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextPushRegisterOnStack;
- RegisterInfo sp_reg;
- RegisterInfo dwarf_reg;
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rt);
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rt, dwarf_reg);
- context.SetRegisterToRegisterPlusOffset(dwarf_reg, sp_reg, addr - sp);
+ context.SetRegisterToRegisterPlusOffset(*dwarf_reg, *sp_reg, addr - sp);
if (Rt != 15) {
uint32_t reg_value = ReadCoreReg(Rt, &success);
if (!success)
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextPushRegisterOnStack;
- RegisterInfo dwarf_reg;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
for (i = 0; i < regs; ++i) {
- GetRegisterInfo(eRegisterKindDWARF, start_reg + d + i, dwarf_reg);
- context.SetRegisterToRegisterPlusOffset(dwarf_reg, sp_reg, addr - sp);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, start_reg + d + i);
+ context.SetRegisterToRegisterPlusOffset(*dwarf_reg, *sp_reg, addr - sp);
// uint64_t to accommodate 64-bit registers.
- uint64_t reg_value = ReadRegisterUnsigned(&dwarf_reg, 0, &success);
+ uint64_t reg_value = ReadRegisterUnsigned(&(*dwarf_reg), 0, &success);
if (!success)
return false;
if (!MemAWrite(context, addr, reg_value, reg_byte_size))
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextPopRegisterOffStack;
- RegisterInfo dwarf_reg;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
for (i = 0; i < regs; ++i) {
- GetRegisterInfo(eRegisterKindDWARF, start_reg + d + i, dwarf_reg);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, start_reg + d + i);
context.SetAddress(addr);
data = MemARead(context, addr, reg_byte_size, 0, &success);
if (!success)
return false;
- if (!WriteRegisterUnsigned(context, &dwarf_reg, data))
+ if (!WriteRegisterUnsigned(context, &(*dwarf_reg), data))
return false;
addr += reg_byte_size;
}
//(result, carry, overflow) = AddWithCarry(R[n], imm32, '0');
AddWithCarryResult res = AddWithCarry(Rn, imm32, 0);
- RegisterInfo reg_n;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, reg_n);
-
+ llvm::Optional<RegisterInfo> reg_n =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
EmulateInstruction::Context context;
context.type = eContextArithmetic;
- context.SetRegisterPlusOffset(reg_n, imm32);
+ context.SetRegisterPlusOffset(*reg_n, imm32);
// R[d] = result;
// if setflags then
else
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, Rn, dwarf_reg);
- context.SetRegisterPlusOffset(dwarf_reg, imm32);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, Rn);
+ context.SetRegisterPlusOffset(*dwarf_reg, imm32);
if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags,
res.carry_out, res.overflow))
EmulateInstruction::Context context;
context.type = eContextArithmetic;
- RegisterInfo op1_reg;
- RegisterInfo op2_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rn, op1_reg);
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm, op2_reg);
- context.SetRegisterRegisterOperands(op1_reg, op2_reg);
+ llvm::Optional<RegisterInfo> op1_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rn);
+ llvm::Optional<RegisterInfo> op2_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rm);
+ context.SetRegisterRegisterOperands(*op1_reg, *op2_reg);
if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags,
res.carry_out, res.overflow))
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, dwarf_reg);
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
for (int i = 0; i < 14; ++i) {
if (BitIsSet(registers, i)) {
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
if (wback && (n == 13)) // Pop Instruction
{
context.type = EmulateInstruction::eContextPopRegisterOffStack;
if (BitIsSet(registers, 15)) {
// LoadWritePC (MemA [address, 4]);
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
uint32_t data =
MemARead(context, base_address + offset, addr_byte_size, 0, &success);
if (!success)
// R[n] = R[n] + 4 * BitCount (registers)
int32_t offset = addr_byte_size * BitCount(registers);
context.type = EmulateInstruction::eContextAdjustBaseRegister;
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + n,
base_address + offset))
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, dwarf_reg);
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
// for i = 0 to 14
for (int i = 0; i < 14; ++i) {
// if registers<i> == '1' then
if (BitIsSet(registers, i)) {
// R[i] = MemA[address,4]; address = address + 4;
- context.SetRegisterPlusOffset(dwarf_reg, Rn - (address + offset));
+ context.SetRegisterPlusOffset(*dwarf_reg, Rn - (address + offset));
uint32_t data =
MemARead(context, address + offset, addr_byte_size, 0, &success);
if (!success)
// if registers<15> == '1' then
// LoadWritePC(MemA[address,4]);
if (BitIsSet(registers, 15)) {
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
uint32_t data =
MemARead(context, address + offset, addr_byte_size, 0, &success);
if (!success)
addr_t address = Rn - (addr_byte_size * BitCount(registers));
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, dwarf_reg);
- context.SetRegisterPlusOffset(dwarf_reg, Rn - address);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ context.SetRegisterPlusOffset(*dwarf_reg, Rn - address);
for (int i = 0; i < 14; ++i) {
if (BitIsSet(registers, i)) {
// R[i] = MemA[address,4]; address = address + 4;
- context.SetRegisterPlusOffset(dwarf_reg, Rn - (address + offset));
+ context.SetRegisterPlusOffset(*dwarf_reg, Rn - (address + offset));
uint32_t data =
MemARead(context, address + offset, addr_byte_size, 0, &success);
if (!success)
// if registers<15> == '1' then
// LoadWritePC(MemA[address,4]);
if (BitIsSet(registers, 15)) {
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
uint32_t data =
MemARead(context, address + offset, addr_byte_size, 0, &success);
if (!success)
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, dwarf_reg);
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
for (int i = 0; i < 14; ++i) {
if (BitIsSet(registers, i)) {
// R[i] = MemA[address,4]; address = address + 4;
- context.SetRegisterPlusOffset(dwarf_reg, offset + addr_byte_size);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset + addr_byte_size);
uint32_t data =
MemARead(context, address + offset, addr_byte_size, 0, &success);
if (!success)
// if registers<15> == '1' then
// LoadWritePC(MemA[address,4]);
if (BitIsSet(registers, 15)) {
- context.SetRegisterPlusOffset(dwarf_reg, offset);
+ context.SetRegisterPlusOffset(*dwarf_reg, offset);
uint32_t data =
MemARead(context, address + offset, addr_byte_size, 0, &success);
if (!success)
address = (index ? offset_addr : base);
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rn, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + Rn);
if (wback) {
EmulateInstruction::Context ctx;
if (Rn == 13) {
ctx.SetImmediateSigned((int32_t)(offset_addr - base));
} else if (Rn == GetFramePointerRegisterNumber()) {
ctx.type = eContextSetFramePointer;
- ctx.SetRegisterPlusOffset(base_reg, (int32_t)(offset_addr - base));
+ ctx.SetRegisterPlusOffset(*base_reg, (int32_t)(offset_addr - base));
} else {
ctx.type = EmulateInstruction::eContextAdjustBaseRegister;
- ctx.SetRegisterPlusOffset(base_reg, (int32_t)(offset_addr - base));
+ ctx.SetRegisterPlusOffset(*base_reg, (int32_t)(offset_addr - base));
}
if (!WriteRegisterUnsigned(ctx, eRegisterKindDWARF, dwarf_r0 + Rn,
// Prepare to write to the Rt register.
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, (int32_t)(offset_addr - base));
+ context.SetRegisterPlusOffset(*base_reg, (int32_t)(offset_addr - base));
// Read memory from the address.
data = MemURead(context, address, 4, 0, &success);
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterStore;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
// for i = 0 to 14
uint32_t lowest_set_bit = 14;
if (!success)
return false;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i, data_reg);
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, offset);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, offset);
if (!MemAWrite(context, address + offset, data, addr_byte_size))
return false;
}
// if registers<15> == '1' then // Only possible for encoding A1
// MemA[address,4] = PCStoreValue();
if (BitIsSet(registers, 15)) {
- RegisterInfo pc_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_pc, pc_reg);
- context.SetRegisterPlusOffset(pc_reg, 8);
+ llvm::Optional<RegisterInfo> pc_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
+ context.SetRegisterPlusOffset(*pc_reg, 8);
const uint32_t pc = ReadCoreReg(PC_REG, &success);
if (!success)
return false;
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterStore;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
// for i = 0 to 14
uint32_t lowest_bit_set = 14;
if (!success)
return false;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i, data_reg);
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
Rn - (address + offset));
if (!MemAWrite(context, address + offset, data, addr_byte_size))
return false;
// if registers<15> == '1' then
// MemA[address,4] = PCStoreValue();
if (BitIsSet(registers, 15)) {
- RegisterInfo pc_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_pc, pc_reg);
- context.SetRegisterPlusOffset(pc_reg, 8);
+ llvm::Optional<RegisterInfo> pc_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
+ context.SetRegisterPlusOffset(*pc_reg, 8);
const uint32_t pc = ReadCoreReg(PC_REG, &success);
if (!success)
return false;
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterStore;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
// for i = 0 to 14
uint32_t lowest_set_bit = 14;
if (!success)
return false;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i, data_reg);
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
Rn - (address + offset));
if (!MemAWrite(context, address + offset, data, addr_byte_size))
return false;
// if registers<15> == '1' then // Only possible for encoding A1
// MemA[address,4] = PCStoreValue();
if (BitIsSet(registers, 15)) {
- RegisterInfo pc_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_pc, pc_reg);
- context.SetRegisterPlusOffset(pc_reg, 8);
+ llvm::Optional<RegisterInfo> pc_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
+ context.SetRegisterPlusOffset(*pc_reg, 8);
const uint32_t pc = ReadCoreReg(PC_REG, &success);
if (!success)
return false;
EmulateInstruction::Context context;
context.type = EmulateInstruction::eContextRegisterStore;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
uint32_t lowest_set_bit = 14;
// for i = 0 to 14
if (!success)
return false;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i, data_reg);
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + i);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
offset + addr_byte_size);
if (!MemAWrite(context, address + offset, data, addr_byte_size))
return false;
// if registers<15> == '1' then
// MemA[address,4] = PCStoreValue();
if (BitIsSet(registers, 15)) {
- RegisterInfo pc_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_pc, pc_reg);
- context.SetRegisterPlusOffset(pc_reg, 8);
+ llvm::Optional<RegisterInfo> pc_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_pc);
+ context.SetRegisterPlusOffset(*pc_reg, 8);
const uint32_t pc = ReadCoreReg(PC_REG, &success);
if (!success)
return false;
else
context.type = eContextRegisterStore;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
// if UnalignedSupport() || address<1:0> == '00' then
if (UnalignedSupport() ||
if (!success)
return false;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
int32_t offset = address - base_address;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, offset);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, offset);
if (!MemUWrite(context, address, data, addr_byte_size))
return false;
} else {
CurrentInstrSet() == eModeARM) {
// MemU[address,4] = data;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
-
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
address - base_address);
if (!MemUWrite(context, address, data, addr_byte_size))
return false;
address = base_address;
// MemU[address,1] = R[t]<7:0>
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
-
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
EmulateInstruction::Context context;
context.type = eContextRegisterStore;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
address - base_address);
uint32_t data =
EmulateInstruction::Context context;
context.type = eContextRegisterStore;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- RegisterInfo offset_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, offset_reg);
// if UnalignedSupport() || address<0> == '0' then
if (UnalignedSupport() || BitIsClear(address, 0)) {
EmulateInstruction::Context context;
context.type = eContextRegisterStore;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- RegisterInfo offset_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, offset_reg);
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
- context.SetRegisterToRegisterPlusIndirectOffset(base_reg, offset_reg,
- data_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> offset_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
+ context.SetRegisterToRegisterPlusIndirectOffset(*base_reg, *offset_reg,
+ *data_reg);
if (!MemUWrite(context, address, Bits32(Rt, 15, 0), 2))
return false;
// data = MemU[address,4];
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
-
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - base_address);
+ context.SetRegisterPlusOffset(*base_reg, address - base_address);
uint64_t data = MemURead(context, address, addr_byte_size, 0, &success);
if (!success)
if (BitIsClear(address, 1) && BitIsClear(address, 0)) {
// LoadWritePC (data);
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - base_address);
+ context.SetRegisterPlusOffset(*base_reg, address - base_address);
LoadWritePC(context, data);
} else
return false;
(BitIsClear(address, 1) && BitIsClear(address, 0))) {
// R[t] = data;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - base_address);
+ context.SetRegisterPlusOffset(*base_reg, address - base_address);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + t,
data))
return false;
address = Rn;
// data = MemU[address,4];
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
-
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint64_t data = MemURead(context, address, addr_byte_size, 0, &success);
if (!success)
// if address<1:0> == '00' then LoadWritePC(data); else UNPREDICTABLE;
if (BitIsClear(address, 1) && BitIsClear(address, 0)) {
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
LoadWritePC(context, data);
} else
return false;
(BitIsClear(address, 1) && BitIsClear(address, 0))) {
// R[t] = data;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + t,
data))
return false;
address = Rn;
// R[t] = ZeroExtend(MemU[address,1], 32);
- RegisterInfo base_reg;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, address - Rn);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, address - Rn);
uint64_t data = MemURead(context, address, 1, 0, &success);
if (!success)
address = Rn;
// R[t] = ZeroExtend(MemU[address,1],32);
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint64_t data = MemURead(context, address, 1, 0, &success);
if (!success)
address = Rn;
// data = MemU[address,2];
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint64_t data = MemURead(context, address, 2, 0, &success);
if (!success)
if (UnalignedSupport() || BitIsClear(address, 0)) {
// R[t] = ZeroExtend(data, 32);
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + t,
data))
return false;
address = base - imm32;
// data = MemU[address,2];
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - base);
+ context.SetRegisterPlusOffset(*base_reg, address - base);
uint64_t data = MemURead(context, address, 2, 0, &success);
if (!success)
if (UnalignedSupport() || BitIsClear(address, 0)) {
// R[t] = ZeroExtend(data, 32);
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - base);
+ context.SetRegisterPlusOffset(*base_reg, address - base);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + t,
data))
return false;
address = Rn;
// data = MemU[address,2];
- RegisterInfo base_reg;
- RegisterInfo offset_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, offset_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> offset_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusIndirectOffset(base_reg, offset_reg);
+ context.SetRegisterPlusIndirectOffset(*base_reg, *offset_reg);
uint64_t data = MemURead(context, address, 2, 0, &success);
if (!success)
return false;
if (UnalignedSupport() || BitIsClear(address, 0)) {
// R[t] = ZeroExtend(data, 32);
context.type = eContextRegisterLoad;
- context.SetRegisterPlusIndirectOffset(base_reg, offset_reg);
+ context.SetRegisterPlusIndirectOffset(*base_reg, *offset_reg);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + t,
data))
return false;
address = Rn;
// R[t] = SignExtend(MemU[address,1], 32);
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint64_t unsigned_data = MemURead(context, address, 1, 0, &success);
if (!success)
address = base - imm32;
// R[t] = SignExtend(MemU[address,1], 32);
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - base);
+ context.SetRegisterPlusOffset(*base_reg, address - base);
uint64_t unsigned_data = MemURead(context, address, 1, 0, &success);
if (!success)
address = Rn;
// R[t] = SignExtend(MemU[address,1], 32);
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- RegisterInfo offset_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, offset_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> offset_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusIndirectOffset(base_reg, offset_reg);
+ context.SetRegisterPlusIndirectOffset(*base_reg, *offset_reg);
uint64_t unsigned_data = MemURead(context, address, 1, 0, &success);
if (!success)
address = Rn;
// data = MemU[address,2];
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint64_t data = MemURead(context, address, 2, 0, &success);
if (!success)
// R[t] = SignExtend(data, 32);
int64_t signed_data = llvm::SignExtend64<16>(data);
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + t,
(uint64_t)signed_data))
return false;
address = base - imm32;
// data = MemU[address,2];
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, imm32);
+ context.SetRegisterPlusOffset(*base_reg, imm32);
uint64_t data = MemURead(context, address, 2, 0, &success);
if (!success)
address = Rn;
// data = MemU[address,2];
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
-
- RegisterInfo offset_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, offset_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> offset_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusIndirectOffset(base_reg, offset_reg);
+ context.SetRegisterPlusIndirectOffset(*base_reg, *offset_reg);
uint64_t data = MemURead(context, address, 2, 0, &success);
if (!success)
if (UnalignedSupport() || BitIsClear(address, 0)) {
// R[t] = SignExtend(data, 32);
context.type = eContextRegisterLoad;
- context.SetRegisterPlusIndirectOffset(base_reg, offset_reg);
+ context.SetRegisterPlusIndirectOffset(*base_reg, *offset_reg);
int64_t signed_data = llvm::SignExtend64<16>(data);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + t,
// R[d] = SignExtend(rotated<7:0>, 32);
int64_t data = llvm::SignExtend64<8>(rotated);
- RegisterInfo source_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, source_reg);
+ llvm::Optional<RegisterInfo> source_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegister(source_reg);
+ context.SetRegister(*source_reg);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + d,
(uint64_t)data))
return false;
// R[d] = SignExtend(rotated<15:0>, 32);
- RegisterInfo source_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, source_reg);
+ llvm::Optional<RegisterInfo> source_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegister(source_reg);
+ context.SetRegister(*source_reg);
int64_t data = llvm::SignExtend64<16>(rotated);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + d,
return false;
// R[d] = ZeroExtend(rotated<7:0>, 32);
- RegisterInfo source_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, source_reg);
+ llvm::Optional<RegisterInfo> source_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegister(source_reg);
+ context.SetRegister(*source_reg);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + d,
Bits32(rotated, 7, 0)))
return false;
// R[d] = ZeroExtend(rotated<15:0>, 32);
- RegisterInfo source_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, source_reg);
+ llvm::Optional<RegisterInfo> source_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegister(source_reg);
+ context.SetRegister(*source_reg);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + d,
Bits32(rotated, 15, 0)))
address = address + 4;
// CPSRWriteByInstr(MemA[address+4,4], '1111', TRUE);
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
EmulateInstruction::Context context;
context.type = eContextReturnFromException;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint64_t data = MemARead(context, address + 4, 4, 0, &success);
if (!success)
else
context.type = EmulateInstruction::eContextRegisterPlusOffset;
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, Rn, dwarf_reg);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, Rn);
int64_t imm32_signed = imm32;
- context.SetRegisterPlusOffset(dwarf_reg, -imm32_signed);
+ context.SetRegisterPlusOffset(*dwarf_reg, -imm32_signed);
if (!WriteCoreRegOptionalFlags(context, res.result, Rd, setflags,
res.carry_out, res.overflow))
EmulateInstruction::Context context;
context.type = eContextArithmetic;
- RegisterInfo sp_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_sp, sp_reg);
- RegisterInfo dwarf_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, dwarf_reg);
- context.SetRegisterRegisterOperands(sp_reg, dwarf_reg);
+ llvm::Optional<RegisterInfo> sp_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_sp);
+ llvm::Optional<RegisterInfo> dwarf_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
+ context.SetRegisterRegisterOperands(*sp_reg, *dwarf_reg);
if (!WriteCoreRegOptionalFlags(context, res.result, dwarf_r0 + d, setflags,
res.carry_out, res.overflow))
// R[d] = result;
EmulateInstruction::Context context;
context.type = eContextArithmetic;
- RegisterInfo reg_n;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, reg_n);
- RegisterInfo reg_m;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, reg_m);
+ llvm::Optional<RegisterInfo> reg_n =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> reg_m =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
- context.SetRegisterRegisterOperands(reg_n, reg_m);
+ context.SetRegisterRegisterOperands(*reg_n, *reg_m);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + d,
res.result))
EmulateInstruction::Context context;
context.type = eContextArithmetic;
- RegisterInfo reg_n;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, reg_n);
- RegisterInfo reg_m;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, reg_m);
- context.SetRegisterRegisterOperands(reg_n, reg_m);
+ llvm::Optional<RegisterInfo> reg_n =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> reg_m =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
+ context.SetRegisterRegisterOperands(*reg_n, *reg_m);
if (!WriteCoreRegOptionalFlags(context, res.result, dwarf_r0 + d, setflags,
res.carry_out, res.overflow))
addr_t address = Rn + imm32;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
EmulateInstruction::Context context;
context.type = eContextRegisterStore;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, imm32);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, imm32);
// if ExclusiveMonitorsPass(address,4) then if (ExclusiveMonitorsPass
// (address, addr_byte_size)) -- For now, for the sake of emulation, we
if (!success)
return false;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
EmulateInstruction::Context context;
context.type = eContextRegisterStore;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, address - Rn);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, address - Rn);
if (!MemUWrite(context, address, Bits32(Rt, 7, 0), 1))
return false;
else
address = Rn;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
EmulateInstruction::Context context;
context.type = eContextRegisterStore;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, address - Rn);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, address - Rn);
// MemU[address,4] = if t == 15 then PCStoreValue() else R[t];
uint32_t Rt = ReadCoreReg(t, &success);
address = Rn;
// R[t] = MemA[address,4];
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
EmulateInstruction::Context context;
if (n == 13)
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
return false;
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
uint32_t Rm = ReadCoreReg(m, &success);
if (!success)
return false;
- RegisterInfo offset_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, offset_reg);
// offset_addr = if add then (R[n] + R[m]) else (R[n] - R[m]);
addr_t offset_addr;
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
address = Rn;
// MemA[address,4] = R[t];
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
uint32_t data = ReadCoreReg(t, &success);
if (!success)
context.type = eContextPushRegisterOnStack;
else
context.type = eContextRegisterStore;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, address - Rn);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, address - Rn);
const uint32_t addr_byte_size = GetAddressByteSize();
return false;
// MemA[address+4,4] = R[t2];
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t2, data_reg);
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ data_reg = GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t2);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
(address + 4) - Rn);
data = ReadCoreReg(t2, &success);
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
- RegisterInfo offset_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m, offset_reg);
- RegisterInfo data_reg;
-
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
return false;
else
context.type = eContextRegisterStore;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t, data_reg);
- context.SetRegisterToRegisterPlusIndirectOffset(base_reg, offset_reg,
- data_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> offset_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + m);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t);
+ context.SetRegisterToRegisterPlusIndirectOffset(*base_reg, *offset_reg,
+ *data_reg);
const uint32_t addr_byte_size = GetAddressByteSize();
if (!success)
return false;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t2, data_reg);
+ data_reg = GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + t2);
- context.SetRegisterToRegisterPlusIndirectOffset(base_reg, offset_reg,
- data_reg);
+ context.SetRegisterToRegisterPlusIndirectOffset(*base_reg, *offset_reg,
+ *data_reg);
if (!MemAWrite(context, address + 4, Rt2, addr_byte_size))
return false;
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
-
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
return false;
context.type = eContextRegisterLoad;
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+
// for r = 0 to regs-1
for (uint32_t r = 0; r < regs; ++r) {
if (single_regs) {
// S[d+r] = MemA[address,4]; address = address+4;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint32_t data = MemARead(context, address, addr_byte_size, 0, &success);
if (!success)
} else {
// word1 = MemA[address,4]; word2 = MemA[address+4,4]; address =
// address+8;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint32_t word1 =
MemARead(context, address, addr_byte_size, 0, &success);
if (!success)
return false;
- context.SetRegisterPlusOffset(base_reg, (address + 4) - Rn);
+ context.SetRegisterPlusOffset(*base_reg, (address + 4) - Rn);
uint32_t word2 =
MemARead(context, address + 4, addr_byte_size, 0, &success);
if (!success)
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
value = Rn - imm32;
context.type = eContextAdjustBaseRegister;
- context.SetRegisterPlusOffset(base_reg, value - Rn);
+ context.SetRegisterPlusOffset(*base_reg, value - Rn);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + n,
value))
if (!success)
return false;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, start_reg + d + r, data_reg);
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, start_reg + d + r);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
address - Rn);
if (!MemAWrite(context, address, data, addr_byte_size))
return false;
if (!success)
return false;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, start_reg + d + r, data_reg);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, start_reg + d + r);
if (GetByteOrder() == eByteOrderBig) {
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
address - Rn);
if (!MemAWrite(context, address, Bits64(data, 63, 32),
addr_byte_size))
return false;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
(address + 4) - Rn);
if (!MemAWrite(context, address + 4, Bits64(data, 31, 0),
addr_byte_size))
return false;
} else {
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
address - Rn);
if (!MemAWrite(context, address, Bits64(data, 31, 0), addr_byte_size))
return false;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
(address + 4) - Rn);
if (!MemAWrite(context, address + 4, Bits64(data, 63, 32),
addr_byte_size))
default:
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
EmulateInstruction::Context context;
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - base);
+ context.SetRegisterPlusOffset(*base_reg, address - base);
if (single_reg) {
// S[d] = MemA[address,4];
if (!success)
return false;
- context.SetRegisterPlusOffset(base_reg, (address + 4) - base);
+ context.SetRegisterPlusOffset(*base_reg, (address + 4) - base);
uint32_t word2 =
MemARead(context, address + 4, addr_byte_size, 0, &success);
if (!success)
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
-
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
return false;
const uint32_t addr_byte_size = GetAddressByteSize();
uint32_t start_reg = single_reg ? dwarf_s0 : dwarf_d0;
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, start_reg + d, data_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, start_reg + d);
EmulateInstruction::Context context;
context.type = eContextRegisterStore;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, address - Rn);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, address - Rn);
if (single_reg) {
// MemA[address,4] = S[d];
if (!MemAWrite(context, address, Bits64(data, 63, 32), addr_byte_size))
return false;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
(address + 4) - Rn);
if (!MemAWrite(context, address + 4, Bits64(data, 31, 0),
addr_byte_size))
if (!MemAWrite(context, address, Bits64(data, 31, 0), addr_byte_size))
return false;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
(address + 4) - Rn);
if (!MemAWrite(context, address + 4, Bits64(data, 63, 32),
addr_byte_size))
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
uint32_t value = Rn + offset;
context.type = eContextAdjustBaseRegister;
- context.SetRegisterPlusOffset(base_reg, offset);
+ context.SetRegisterPlusOffset(*base_reg, offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + n,
value))
for (uint32_t e = 0; e < elements; ++e) {
// Elem[D[d+r],e,esize] = MemU[address,ebytes];
context.type = eContextRegisterLoad;
- context.SetRegisterPlusOffset(base_reg, address - Rn);
+ context.SetRegisterPlusOffset(*base_reg, address - Rn);
uint64_t data = MemURead(context, address, ebytes, 0, &success);
if (!success)
return false;
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
-
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
return false;
uint32_t value = Rn + offset;
context.type = eContextAdjustBaseRegister;
- context.SetRegisterPlusOffset(base_reg, offset);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ context.SetRegisterPlusOffset(*base_reg, offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + n,
value))
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
offset = 8 * regs;
context.type = eContextAdjustBaseRegister;
- context.SetRegisterPlusOffset(base_reg, offset);
+ context.SetRegisterPlusOffset(*base_reg, offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + n,
Rn + offset))
return false;
}
- RegisterInfo data_reg;
context.type = eContextRegisterStore;
// for r = 0 to regs-1
for (uint32_t r = 0; r < regs; ++r) {
- GetRegisterInfo(eRegisterKindDWARF, dwarf_d0 + d + r, data_reg);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_d0 + d + r);
uint64_t register_data = ReadRegisterUnsigned(
eRegisterKindDWARF, dwarf_d0 + d + r, 0, &success);
if (!success)
// MemU[address,ebytes] = Elem[D[d+r],e,esize];
uint64_t word = Bits64(register_data, ((e + 1) * esize) - 1, e * esize);
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg,
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg,
address - Rn);
if (!MemUWrite(context, address, word, ebytes))
return false;
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
offset = ebytes;
context.type = eContextAdjustBaseRegister;
- context.SetRegisterPlusOffset(base_reg, offset);
+ context.SetRegisterPlusOffset(*base_reg, offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + n,
Rn + offset))
uint64_t word =
Bits64(register_data, ((index + 1) * esize) - 1, index * esize);
- RegisterInfo data_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_d0 + d, data_reg);
+ llvm::Optional<RegisterInfo> data_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_d0 + d);
context.type = eContextRegisterStore;
- context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, address - Rn);
+ context.SetRegisterToRegisterPlusOffset(*data_reg, *base_reg, address - Rn);
if (!MemUWrite(context, address, word, ebytes))
return false;
return false;
}
- RegisterInfo base_reg;
- GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n, base_reg);
-
uint32_t Rn = ReadCoreReg(n, &success);
if (!success)
return false;
offset = ebytes;
context.type = eContextAdjustBaseRegister;
- context.SetRegisterPlusOffset(base_reg, offset);
+ llvm::Optional<RegisterInfo> base_reg =
+ GetRegisterInfo(eRegisterKindDWARF, dwarf_r0 + n);
+ context.SetRegisterPlusOffset(*base_reg, offset);
if (!WriteRegisterUnsigned(context, eRegisterKindDWARF, dwarf_r0 + n,
Rn + offset))