If you're debugging, the following trick works:
- Press Ctrl-R ("User-defined offset")
- Enter "
edi
" in the "Base address" field. - Press Enter
You'll get something like:
mov eax, [edi + (target_address - edi_value)]
This works because during debugging the IDC interpreter recognizes register names and evaluates them. And most numerical input fields in IDA accept IDC expressions.