[LLVMdev] Backend for Harvard Architecture

Eli Friedman eli.friedman at gmail.com
Mon May 17 04:23:27 PDT 2010


On Mon, May 17, 2010 at 3:09 AM, Paulo J. Matos <pocmatos at gmail.com> wrote:
> Hello,
>
> On a recent discussion on the cfe-dev mailing list[1] it was asked how
> easy it was to create a backend to an Harvard Arch chip: different
> data/function pointer sizes and 16 bit chars (main issues of the
> targeted arch). Ken Dyck has posted a patch (which solved at least the
> second problem of 16bit char) on which I have been working on and
> Douglas Gregor said that different pointer sizes are already supported
> by Clang, but what about llvm? When creating a backend, I have created
> the DataLayout string but this string only allows me (as far as the
> docs I found are concerned) to specify a pointer size (not several
> pointer sizes). Is this something that Clang already supports but has
> not yet managed to get into llvm or am I missing some configuration?

Not supported at the moment in LLVM.  Probably the easiest way to deal
with it would be to make pointers the larger of data/function
pointers, make the in-memory representation of the smaller an int of
the appropriate width, and do some casting to "fix" the pointers.
Properly supporting different data/function pointer sizes would
require messing with the current system of casts; currently LLVM
assumes casting between function and data pointers is lossless (using
the "bitcast" instruction).

-Eli



More information about the llvm-dev mailing list