Hi, Im trying to generate C source from C++ source file, using C backend. llvm-g++ -O3 -emit-llvm valen.cpp -c -o valen.bc llc -march=c valen.bc -f -o valen.c But C backend generate a lot of operation with "long long" type. My C compiler does not support "long long" type. Is there any option to disable generate "long long" ? -- Thanks, Valen
On Mon, 2008-08-11 at 16:09 +0300, Valen wrote:> Hi, > Im trying to generate C source from C++ source file, > using C backend. > > llvm-g++ -O3 -emit-llvm valen.cpp -c -o valen.bc > llc -march=c valen.bc -f -o valen.c > > > But C backend generate a lot of operation with "long long" type. > My C compiler does not support "long long" type. > Is there any option to disable generate "long long" ?If your compiler does not support long long, there are a whole bunch of *other* parts of the C standard that it does not satisfy, and you will probably find that you will fight other unnecessary battles. One possibility would be to compile CLANG+LLVM for your target. If that is not possible, perhaps GCC? shap
On Aug 11, 2008, at 6:09 AM, Valen wrote:> Hi, > Im trying to generate C source from C++ source file, > using C backend. > > llvm-g++ -O3 -emit-llvm valen.cpp -c -o valen.bc > llc -march=c valen.bc -f -o valen.c > > > But C backend generate a lot of operation with "long long" type. > My C compiler does not support "long long" type. > Is there any option to disable generate "long long" ?The C backend generates long long for 64-bit integer types. If you're C compiler doesn't support a 64-bit integer type, you'll have problems. If it does, but spells it differently, you could hack the CBE to produce the right name. -Chris
On Mon, 11 Aug 2008 09:48:31 -0400 "Jonathan S. Shapiro" <shap at eros-os.com> wrote:> One possibility would be to compile CLANG+LLVM for your target. If > that is not possible, perhaps GCC?Thanks, i will take a look. -- Valen
Delayed reaction. Chris's response that the emitted code relies on long long to be a 64-bit type just sunk in. Chris: is there some reason why the backend does not #include <stdint.h> and then emit [u]int64_t (and the other sized types as well) and also [u]intptr_t? I'm thinking that this would make it a bit easier to re-target things, and possibly also preserve more documentation of intent in the emitted code. shap
On Aug 11, 2008, at 1:13 PM, Jonathan S. Shapiro wrote:> Delayed reaction. Chris's response that the emitted code relies on > long > long to be a 64-bit type just sunk in. > > Chris: is there some reason why the backend does not #include > <stdint.h> > and then emit [u]int64_t (and the other sized types as well) and also > [u]intptr_t?The CBE output can't #include standard headers, the macros and types that are defined in the headers will conflict. -Chris