LLVM : generating a "ir" file for specifically z80 processor using llvm - llvm

I am working on LLVM, and want to generate the files according to specific target architecure e.g-z80. I have downloaded z80 source code and clang. I used --target in clang command to specify z80 but it is not working. can anybody help me out in this problem? Thanks in advance.

LLVM has no official z80 backend/target. There appear to be some third-party projects attempting to implement one, like llvm-z80, so you can try to check them out. The alternative would be writing a new backend.

Related

Cannot cross-compile Xojo for ARM

When I attempt to compile a Xojo application, I get this:
Linking Executable
Fatal: can not read symbol[58719] in file C:\Users\jprov\AppData\Local\Temp\xojo scratch 28260\MyApplication [80364BB8]\Linux_ARM/#userplugins0.o
Does anyone have any ideas ? I can cross-compile Xojo apps for the ARM, but when the Chilkat Xojo plugin is involved, I get this error.
Earlier this year, in June, another user had a somewhat similar problem w/ compiling and linking a Xojo app on Linux/ARM. The solution was to build Chilkat with llvm vs gcc.
It solved the user's problem, so maybe you just need the latest Chilkat build?
Please try this one: https://chilkatdownload.com/prerelease/chilkat-1200.xojo_plugin
I don't understand what is different, other than I am now using Xojo R4, but the issue has resolved itself. I can now use the LLVM version of the plugin on an ARM processor. Thank you for your help, Matt.

using an llvm backend (Mips, Sparc etc)

I am trying to find some code examples which allow me to hook up a llvm backend for code generation. For example, hooking up the IR to either the Mips or Sparc backend. However, I haven't been able to find any such examples. The only closest thing I could find is the use of the AMD IL & GPU backend, currently in the mesa tree but not yet merged into the llvm backend. I have read the Writing an LLVM Backend tutorial but its not really obvious to me as to how to hook up the backend. I am sure I am missing something from the examples so could someone point me to some examples for this ? I already have code to generate the IR.
Thanks
You might want to look at the LLVM llc command. It reads a bitcode IR file and calls any of the backends on it.
The llc command would compile LLVM IR to target machine assembly.
With argument "march=[your target]", you can get assembly for different targets,
"march=mips" for Mips, for example.

Possible to auto-generate llvm c++ api code from LLVM-IR?

The clang 3.0 online demo page http://llvm.org/demo/index.cgi provides an option to output LLVM C++ API code" representing the LLVM-IR for the input program.
Is "produce LLVM C++ API code" output a clang option (and if so, what is it)?
Or is it an llvm tool option (which one)?
Is it possible to do the same thing but from LLVM-IR input? Basically I'd like to see the proper llvm c++ api calls needed to produce a particular given llvm-ir sequence. I'd like to learn backwards by example rather than forwards from the documentation.
Manual pages and --help and --help-hidden for clang, llvm-as and llvm-dis don't show anything obvious.
edit: OK now I see in the output on that web page, "generated by llvm2cpp". But I can't find that tool in recent llvm releases, only old releases, has a new tool in 2.9 and 3.0 taken over for llvm2cpp?
Yes. C++ backend is the tool which does this. Try "llc -march=cpp foo.bc"
I ran into exactly the same problem and saw the CPPBuilder mentioned a couple of times. This approach unfortunately no longer works on recent LLVM versions as the CPPBackend was removed between 3.8 and 3.9.
If you want the CPP backend you (i) have to configure llvm and add cppbackend to -DLLVM_TARGETS_TO_BUILD during the initial configure and (ii) run an llvm <= 3.8.
The feature was removed because it did not use IRBuilder and almost nobody used it. My solution was to rely on the old version to get inspired, then implement it myself.

C++ compiler which I can bundle with my application

I'm working on developing my own programming language, and to generate executables I wished to convert the source to C++ and the run it through a C++ compiler.
Does anybody know of a C++ compiler which I can simply include with my application and then invoke from the command line without installation?
I'm using Windows.
Thanks in advance, Tom.
Edit:
It seems gcc is the way to go and it would be a pain to set up, would people recommend bundling the installation file instead and then installing the compiler as part of the installation of my program?
Have you tried gcc (the windows port)?

Where can I find the binaries for arm-wince-pe-gcc?

I am looking for a version of the gcc (C++) compiler targeting the ARM uP and WindowsCE operating system. Thus far I have only been able to locate compilers which either target the ARM uP but produce ELF executables (GNUARM etc) or they do target windows CE but have not been updated since 2003. I believe the exact name of the compiler I am looking for is arm-wince-pe-gcc as mentioned In the GCC documentation but I have no clue how to get hold of a binary. Any/all help will be greatly appreciated.
I'm using CEGCC from SourceForce: http://cegcc.sourceforge.net/, and so far it works OK. I've managed to build a Windows API application, zlib and libpng, and everything runs just fine on Windows CE 5.0, and the C code you write is the same one you'd write in Visual Studio.
Use the mingw32ce toolchain from there. Build the toolchain yourself, from the latest SVN sources.
I use this under Linux, but it should work under Cygwin as well I'm guessing.
Build one yourself. GCC is well set up to produce cross-compilers, see the build instructions.
I found a binary version of the required compiler here: http://sourceforge.net/project/showfiles.php?group_id=173455&package_id=198682 choose
0.51.0/cygwin-cegcc-cegcc-0.51.0-1.tar.gz file for download.