i am writing a compiler for a 64bit cpu, which only operates on 64bit. In order to clang and llc to take this into account I have set the datalayout to:
I have tried different combinations, but char, short and float data types are always set to i8, i16 and float.
Is there any other way to tell clang, that all data types are 64bit wide?
I understand your question in the way that you want the C data types bool, char, short, … to be all 64 bit wide. This is not controlled by the data layout. The data layout defined in clang must match the data layout used by the backend. See last paragraph in LLVM Language Reference Manual — LLVM 13 documentation.
Just looking at the clang source, my suggestion is to have a look at clang/include/clang/Basic/TargetInfo.h. There is a couple of methods getXXXWidth(), which you may want to override for your target.
thanks for your reply. I am working with version 12.0.0. I have set the data layout string in both, clang and llvm. I also saw that char and short width are hard coded in TargetInfo.h. I have changed this too and made it configurable.
Unfortunately clang and llvm are using 8 bit for stack calculations. I have found a document from embecosm talking about ‘Non 8 bit byte support…’(2017) and a longer discussion from am ericsson person about ’ Non-8-bit addressable units’ (⚙ D61725 Non-8-bit addressable units showcase).
It looks like I have to take the same route.
Does some one have done this already and has patch set available?