morganstanley / hobbes

A language and an embedded JIT compiler
http://hobbes.readthedocs.io/
Apache License 2.0
1.16k stars 105 forks source link

Support for LLVM-6/8/9/10/11 #382

Closed smunix closed 3 years ago

smunix commented 3 years ago

All supported versions:

└───packages
    ├───x86_64-darwin
    │   ├───"hobbesPackages/llvm-10/hobbes": package 'hobbes-llvm-10-20210111.c20a31f'
    │   ├───"hobbesPackages/llvm-11/hobbes": package 'hobbes-llvm-11-20210111.c20a31f'
    │   ├───"hobbesPackages/llvm-6/hobbes": package 'hobbes-llvm-6-20210111.c20a31f'
    │   ├───"hobbesPackages/llvm-8/hobbes": package 'hobbes-llvm-8-20210111.c20a31f'
    │   └───"hobbesPackages/llvm-9/hobbes": package 'hobbes-llvm-9-20210111.c20a31f'
    └───x86_64-linux
        ├───"hobbesPackages/llvm-10/hobbes": package 'hobbes-llvm-10-20210111.c20a31f'
        ├───"hobbesPackages/llvm-11/hobbes": package 'hobbes-llvm-11-20210111.c20a31f'
        ├───"hobbesPackages/llvm-6/hobbes": package 'hobbes-llvm-6-20210111.c20a31f'
        ├───"hobbesPackages/llvm-8/hobbes": package 'hobbes-llvm-8-20210111.c20a31f'
        └───"hobbesPackages/llvm-9/hobbes": package 'hobbes-llvm-9-20210111.c20a31f'

fixes #381 , #380

Built with,

~/P/h/l/hobbes.git (fix.llvm-11) ∫ for v in 11 10 9 8 6                                                                                                                                                        
                                    echo "llvm-$v"
                                       nix shell .#hobbesPackages/llvm-$v/hobbes -c hi -s -x -e "show($v)"
                                   end

@Chaz6 - can you help test this on your host?

Chaz6 commented 3 years ago

Sorry for the delay. The current master is not compiling for me.

[1/186] Building CXX object CMakeFiles/hobbes-test.dir/test/Convert.C.o
FAILED: CMakeFiles/hobbes-test.dir/test/Convert.C.o
/home/chaz/.local/local/clang+llvm/bin/clang++  -I/home/chaz/.local/local/clang+llvm/include -I../include -Werror=old-style-cast -Werror -Wall -Wextra -Winit-self -Wreturn-type -Wunused-variable -Wsign-compare
-Warray-bounds -Wunknown-pragmas -Wuninitialized -Wstrict-aliasing -Wunused-value -Wunused-label -Wswitch -Wcast-align -Wctor-dtor-privacy -Wmissing-noreturn -Wunused-parameter -Wreorder -O2   -D_GNU_SOURCE -D_
_STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPYTHON_EXECUTABLE="/home/chaz/.local/bin/python" -DSCRIPT_DIR="/home/chaz/git/github.com_Morgan-Stanley_hobbes/scripts/" -std=gnu++14 -MD -MT
 CMakeFiles/hobbes-test.dir/test/Convert.C.o -MF CMakeFiles/hobbes-test.dir/test/Convert.C.o.d -o CMakeFiles/hobbes-test.dir/test/Convert.C.o -c ../test/Convert.C
In file included from ../test/Convert.C:20:
../include/hobbes/fregion.H:115:77: error: function 'raiseSysError' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
inline void raiseSysError(const std::string& msg, const std::string& fname) {
                                                                            ^
../include/hobbes/fregion.H:1685:27: error: unused parameter 'n' [-Werror,-Wunused-parameter]
    void ctor(const char* n, int id) {
                          ^
../include/hobbes/fregion.H:1685:34: error: unused parameter 'id' [-Werror,-Wunused-parameter]
    void ctor(const char* n, int id) {
                                 ^
../include/hobbes/fregion.H:1904:95: error: unused parameter 'wss' [-Werror,-Wunused-parameter]
    static void setWriteCBs(uint32_t, const std::function<void(uint32_t,uint64_t)>&, Wss& ... wss) { }
                                                                                              ^
4 errors generated.
[2/186] Building CXX object CMakeFiles/hobbes-test.dir/test/Definitions.C.o
FAILED: CMakeFiles/hobbes-test.dir/test/Definitions.C.o
/home/chaz/.local/local/clang+llvm/bin/clang++  -I/home/chaz/.local/local/clang+llvm/include -I../include -Werror=old-style-cast -Werror -Wall -Wextra -Winit-self -Wreturn-type -Wunused-variable -Wsign-compare
-Warray-bounds -Wunknown-pragmas -Wuninitialized -Wstrict-aliasing -Wunused-value -Wunused-label -Wswitch -Wcast-align -Wctor-dtor-privacy -Wmissing-noreturn -Wunused-parameter -Wreorder -O2   -D_GNU_SOURCE -D_
_STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DPYTHON_EXECUTABLE="/home/chaz/.local/bin/python" -DSCRIPT_DIR="/home/chaz/git/github.com_Morgan-Stanley_hobbes/scripts/" -std=gnu++14 -MD -MT
 CMakeFiles/hobbes-test.dir/test/Definitions.C.o -MF CMakeFiles/hobbes-test.dir/test/Definitions.C.o.d -o CMakeFiles/hobbes-test.dir/test/Definitions.C.o -c ../test/Definitions.C
In file included from ../test/Definitions.C:2:
In file included from ../include/hobbes/hobbes.H:6:
In file included from ../include/hobbes/eval/cc.H:7:
../include/hobbes/lang/tylift.H:429:37: error: unused parameter 'tenv' [-Werror,-Wunused-parameter]
    static MonoTypePtr type(typedb& tenv) { return Prim::make("unit"); }
                                    ^
In file included from ../test/Definitions.C:2:
In file included from ../include/hobbes/hobbes.H:6:
In file included from ../include/hobbes/eval/cc.H:13:
In file included from ../include/hobbes/eval/jitcc.H:9:
In file included from ../include/hobbes/util/llvm.H:18:
In file included from /home/chaz/.local/local/clang+llvm/include/llvm/IR/DerivedTypes.h:23:
In file included from /home/chaz/.local/local/clang+llvm/include/llvm/IR/Type.h:17:
/home/chaz/.local/local/clang+llvm/include/llvm/ADT/APFloat.h:842:31: error: function 'APFloat' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  APFloat() : U(IEEEdouble()) {
                              ^
In file included from ../test/Definitions.C:2:
In file included from ../include/hobbes/hobbes.H:6:
In file included from ../include/hobbes/eval/cc.H:13:
In file included from ../include/hobbes/eval/jitcc.H:9:
In file included from ../include/hobbes/util/llvm.H:19:
In file included from /home/chaz/.local/local/clang+llvm/include/llvm/IR/IRBuilder.h:22:
In file included from /home/chaz/.local/local/clang+llvm/include/llvm/IR/BasicBlock.h:22:
In file included from /home/chaz/.local/local/clang+llvm/include/llvm/IR/Instruction.h:22:
In file included from /home/chaz/.local/local/clang+llvm/include/llvm/IR/DebugLoc.h:17:
In file included from /home/chaz/.local/local/clang+llvm/include/llvm/IR/TrackingMDRef.h:16:
/home/chaz/.local/local/clang+llvm/include/llvm/IR/Metadata.h:95:49: error: function 'handleChangedOperand' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  void handleChangedOperand(void *, Metadata *) {
                                                ^
/home/chaz/.local/local/clang+llvm/include/llvm/IR/Metadata.h:888:42: error: function 'operator delete' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  void operator delete(void *, unsigned) {
                                         ^
/home/chaz/.local/local/clang+llvm/include/llvm/IR/Metadata.h:893:48: error: function 'operator delete' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  void operator delete(void *, unsigned, bool) {
                                               ^
In file included from ../test/Definitions.C:2:
In file included from ../include/hobbes/hobbes.H:6:
In file included from ../include/hobbes/eval/cc.H:13:
In file included from ../include/hobbes/eval/jitcc.H:9:
In file included from ../include/hobbes/util/llvm.H:19:
In file included from /home/chaz/.local/local/clang+llvm/include/llvm/IR/IRBuilder.h:33:
/home/chaz/.local/local/clang+llvm/include/llvm/IR/Instructions.h:2941:50: error: function 'setSuccessor' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  void setSuccessor(unsigned idx, BasicBlock *B) {
                                                 ^
/home/chaz/.local/local/clang+llvm/include/llvm/IR/Instructions.h:4132:56: error: function 'setSuccessor' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
                                                       ^
/home/chaz/.local/local/clang+llvm/include/llvm/IR/Instructions.h:4635:50: error: function 'setSuccessor' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  void setSuccessor(unsigned idx, BasicBlock *B) {
                                                 ^
In file included from ../test/Definitions.C:2:
In file included from ../include/hobbes/hobbes.H:6:
../include/hobbes/eval/cc.H:329:26: error: unused parameter 'c' [-Werror,-Wunused-parameter]
    static T compile(cc* c, const str::seq& vns, const std::string& expr) {
                         ^
../include/hobbes/eval/cc.H:329:45: error: unused parameter 'vns' [-Werror,-Wunused-parameter]
    static T compile(cc* c, const str::seq& vns, const std::string& expr) {
                                            ^
../include/hobbes/eval/cc.H:329:69: error: unused parameter 'expr' [-Werror,-Wunused-parameter]
    static T compile(cc* c, const str::seq& vns, const std::string& expr) {
                                                                    ^
11 errors generated.
...
smunix commented 3 years ago

Sorry for the delay. The current master is not compiling for me.

It looks like you're using clang on Linux, let's request support for it (see #384)

smunix commented 3 years ago

Sorry for the delay. The current master is not compiling for me.

It looks like you're using clang on Linux, let's request support for it (see #384)

@Chaz6 This should work now, as the fix is in master