[cfe-dev] Re-targeting clang to a new architecture

Ken Dyck Ken.Dyck at onsemi.com
Tue May 4 10:47:45 PDT 2010


> On Thursday, April 29, 2010 10:51 AM, Paulo J. Matos wrote:
> 
> "Ken Dyck" <Ken.Dyck at onsemi.com> writes:
> 
> > In the meantime, I could
> > make a patch available here or the llvm-dev
> list if anybody is
> > interested in seeing this work in progress
> (but probably not until next
> > week when I update to the 2.7 release).
> >
> 
> Yes, it would be great it you could do that.

Okay. Attached is a patch to LLVM and Clang (based on rev 102726) that
allows them to target processors with word-addressable memory and
non-power-of-2-sized integer types. 

I am NOT requesting that this patch be code-reviewed for inclusion in
LLVM/Clang. I am posting it here on the off chance that somebody working
on similar machines will find it helpful. Comments are of course
welcome, but not expected. 

The support for word-addressable memory is quite limited. It expects
that the Clang char type is 8 bits wide and that i8 is aligned on the
word boundaries of the machine. Word addressing, then, only affects a
few parts of LLVM where it generates offsets for getelementptr. These
parts are located in SelectionDAGBuilder.cpp and ConstantFolding.cpp.
They make use of a new target data attribute in TargetData called
storage unit size (specified with a -u field in the descriptor string)
to convert sizes in byte units to word units. 

The rest of the changes are for supporting non-power-of-2 integer types
and alignments. As these topics haven't been part of this discussion so
far, I won't bore you with details here. If you have questions, though,
I'd be happy to answer them.

-Ken


-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm-clang.r102726.diff
Type: application/octet-stream
Size: 140607 bytes
Desc: llvm-clang.r102726.diff
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100504/76a68b1f/attachment.obj>


More information about the cfe-dev mailing list