[llvm-dev] What's the easisest way to tell clang about type sizes and alignment?
Philipp Klaus Krause via llvm-dev
llvm-dev at lists.llvm.org
Thu Sep 15 08:11:01 PDT 2016
To see the benefit of some optimization passes in LLVM for certain
architectures, I'd like to compile C or C++ code for a target where a C
compiler (SDCC) already exists.
I guess the easiest way would be to use clang -S -emit-llvm then the
optimization passes then the C backend (probably much easier than
writing code to translate LLVM IR to SDCC iCode).
There is a version of the C backend on GitHub for LLVM 3.7. I have
looked at the output from that, and guess that with a few small fixes to
make the C backend emit something more like proper C (instead of
GCC/MSVC-isms) it should be useable with SDCC.
But clang needs to know about the sizes and alignment of the C types
(after all I don't want my int to become an expensive 32-bit wide 32-bit
aligned thing inside clang). Is there an easy way to do so?
More information about the llvm-dev