[LLVMdev] Address calculation
eli.friedman at gmail.com
Mon Oct 6 18:41:15 CDT 2008
On Mon, Oct 6, 2008 at 9:03 AM, Villmow, Micah <Micah.Villmow at amd.com> wrote:
> I am attempting to get indexing code generation working with my backend.
> However, it seems that the addresses being calculated is being multiplied by
> the width of the data type.
That's how most normal architectures/address spaces work. Is there
something unusual about address space 11 in your architecture?
> The value 23 in the getelementptr is being multiplied by 4 bytes and the
> generated code is the value 96. However, I don't want this multiplication to
> occur and I cannot figure out how to divide the immediate by 4 when lowering
> the Add instruction that is linked to a load/store operation.
CodeGen doesn't have a gep instruction, so it has to convert the
implied arithmetic into explicit arithmetic. Is your address space 11
byte addressable? If it isn't, you have a very unusual case; you'll
have to hack SelectionDAGBuild.cpp to get the lowering right, and I
think some IL-level transformations assume byte addressing. If it is,
you really want to just fold the addition into the load; it's not
trivial to match, but it shouldn't be too hard.
More information about the LLVMdev