Hello!
I am currently trying to make EH (exception handling) possible to be integrated in C++. This means that C++ code can throw exceptions and llvm code can catch such exception and llvm can throw exceptions that C++ can catch (or pass through). There are quite some difficulties with approach:
* I must write ABI specific backends for EH. Since we support Visual Studio and GCC, two different backends should be written. I am not sure, however, that EH is the same on all platforms ... so drivers for EH should probably be platform and ABI specific ...
* I do not know how to write code in such way, that C++ compiler nad llvm will be able to have the same type information for the same types (or to enable casts, e.g. if you throw type X extends Y and Y is known to C++, how will this be handled).
Further, there is also a problem with calling conversions with C++. C++ compilers can emit different return type conversions for struct or class types (as well as I am aware GCC uses pass-by-pointer, which is usually not used for structs with only 2 integers etc) and also different push strategies (this especially applies for member funcion call, where this pointer is passed through ECX register or as first argument).
I think with all these problems (and more are likely to arise), I don't know if it still makes sense to apply such fixes, they are too target/ABI specific. This leaves me with option to try the build tho whole engine (which is 300+k lines) with llvm-gcc. If I understand right, all such problems should disappear. So, if I compile, for example for x86 statically or with JIT, will the code be compatible (always!) at the end?
The problem in the engine is that the basecode will be generated statically for each platform while all scripts (that should be compiled) will be JIT-ed. I would still need to make special care so that scripts will actually compile to the same thing (since they are not C++) but will the llvm be compatible on all targets for JIT and anything else?
I am also asking how stables are llvm and llvm-gcc under cygwin (since our engine is windows based)? Do you think that we can compile such thing without really big problems (and hacks)?
Regards,
®iga