C ++前端只有编译器(将C ++转换成C) [英] C++ frontend only compiler (convert C++ to C)
问题描述
工具平台
- --------- ------------
______ Visual C ++ _____ WIN32
/
/ _______ MBED(ARM)_______ MBED(ARM开发板)。
/
/ _________ GCC(x86)________ Linux
/
源____ / ___________ GCC(ARM)________ GBA / DS
\
\ __________ SDA______________Verifone Verix CC终端
\
\ ________ ARM SDT__________Verifine VerixV CC终端
\
\ ______ ???? _____________ Renases M8 / 16/32。
\
\ ____ ???? _____________ Z8家庭。
最后两个平台我有很好的C编译器,但没有C ++。
正如你所看到的,我支持各种各样的平台,我分享了大量的库代码(和一些应用程序代码)。
如果您使用 LLVM , llvm-g ++
将编译您的C ++代码LLVM位代码和 llc
具有将位代码转换为C的后端。
您可以这样写命令:
llvm-g ++ -emit-llvm -c foo.cpp -o foo.o
llc -march = c< foo.o> foo.c
I'm currently managing some C++ code that runs on multiple platforms from a single source tree (Win32, Linux, Verifone CC terminals, MBED and even the Nintendo GBA/DS). However I need to build an app targetted at an embedded platform for which there is no C++ compiler (C only). I remmber that many of the early C++ compilers were only front-ends stitting on existing C compilers (Glockenspiel for example used MSC). Are there any such 'frontend' C++ compilers in use today that will generate C code.
Tools Platform
----------- ------------
______Visual C++ _____ WIN32
/
/_______MBED (ARM)_______MBED (ARM dev board).
/
/_________GCC (x86)________Linux
/
Source____/___________GCC (ARM)________GBA/DS
\
\__________SDA______________Verifone Verix CC Terminals
\
\________ARM SDT__________Verifine VerixV CC terminals
\
\______????_____________Renases M8/16/32.
\
\____????_____________Z8 family.
The last two platforms I have good C compilers for but no C++.
As you can see I'm supporting a large variety of platforms and I share a large body of library code (and some app code).
If you use LLVM, llvm-g++
will compile your C++ code to LLVM bitcode, and llc
has a backend which converts bitcode to C.
You could write commands like this:
llvm-g++ -emit-llvm -c foo.cpp -o foo.o
llc -march=c <foo.o >foo.c
这篇关于C ++前端只有编译器(将C ++转换成C)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!