| 235 | |
| 236 | |
| 237 | static ExprId ReadAddress(LowLevelILFunction& il, InstructionOperand& op, size_t addr) |
| 238 | { |
| 239 | //This should only be called by with cls or MEM_* or label |
| 240 | // <op.imm> |
| 241 | // <op.reg> +/- <op.imm> |
| 242 | // <op.reg> +/- (<op.offset> <shift> <op.imm>) |
| 243 | ExprId expr; |
| 244 | if (op.cls == LABEL) |
| 245 | return il.ConstPointer(4, op.imm); |
| 246 | |
| 247 | if (op.shift == SHIFT_NONE) |
| 248 | { |
| 249 | if (op.flags.offsetRegUsed == 1) |
| 250 | { |
| 251 | expr = il.Register(get_register_size(op.offset), op.offset); |
| 252 | } |
| 253 | else |
| 254 | { |
| 255 | expr = il.Const(4, op.imm); |
| 256 | } |
| 257 | } |
| 258 | else |
| 259 | { |
| 260 | if (op.flags.offsetRegUsed == 1) |
| 261 | expr = GetShiftedOffset(il, op); |
| 262 | else |
| 263 | return GetShiftedRegister(il, op); |
| 264 | } |
| 265 | |
| 266 | if (op.flags.add == 1) |
| 267 | return il.Add(4, ReadRegisterOrPointer(il, op, addr), expr); |
| 268 | else |
| 269 | return il.Sub(4, ReadRegisterOrPointer(il, op, addr), expr); |
| 270 | } |
| 271 | |
| 272 | |
| 273 | static ExprId ReadILOperand(LowLevelILFunction& il, InstructionOperand& op, size_t addr, bool isPointer=false) |
no test coverage detected