add a new target in the Makefile to generate the llvm wrapper
Sylvestre Ledru [Thu, 26 Sep 2013 12:31:58 +0000 (14:31 +0200)]
Change-Id: Ie4c9be4bb888adc4215df5635c504f81a88ca986

scilab/modules/jit/Makefile.am
scilab/modules/jit/Makefile.in
scilab/modules/jit/src/cpp/llvm-wrapper-generated.cpp [new file with mode: 0644]
scilab/modules/jit/src/cpp/llvm-wrapper.cpp [new file with mode: 0644]

index d89b642..bd36f24 100644 (file)
 
 pkglib_LTLIBRARIES     = libscijit.la
 
+BUILT_SOURCES = src/cpp/llvm-wrapper-generated.cpp
+src/cpp/llvm-wrapper-generated.cpp: src/cpp/llvm-wrapper.cpp
+       clang++ -emit-llvm  -I$(top_srcdir)/modules/types/includes/ -I$(top_srcdir)/modules/operations/includes/ -I$(top_srcdir)/modules/core/includes/  -I$(top_srcdir)/modules/ast/includes/ -I$(top_srcdir)/modules/localization/includes/ $(EIGEN_CPPFLAGS) -c src/cpp/llvm-wrapper.cpp -o - |  llc -march=cpp -cppgen=contents -o src/cpp/llvm-wrapper-generated.cpp
+
 JIT_CPP_SOURCES = \
        src/cpp/jitter.cpp
 
index 23afc1b..becb7c2 100644 (file)
@@ -500,6 +500,7 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 yacc_present = @yacc_present@
 pkglib_LTLIBRARIES = libscijit.la
+BUILT_SOURCES = src/cpp/llvm-wrapper-generated.cpp
 JIT_CPP_SOURCES = \
        src/cpp/jitter.cpp
 
@@ -624,7 +625,8 @@ JARMASK = *.jar
 HELP_CHAPTERDIR = help/
 HELP_CHAPTERFILE = addchapter.sce
 HELP_CHAPTERLANG = en_US fr_FR pt_BR
-all: all-am
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .sci .bin .cpp .lo .o .obj
@@ -853,13 +855,15 @@ distdir: $(DISTFILES)
        done
 check-am: all-am
        $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-am
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES) $(HEADERS) all-local
 installdirs:
        for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(libscijit_la_includedir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-am
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -889,6 +893,7 @@ distclean-generic:
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-local \
@@ -962,7 +967,7 @@ ps-am:
 uninstall-am: uninstall-libscijit_la_includeHEADERS \
        uninstall-pkglibLTLIBRARIES
 
-.MAKE: check-am install-am install-strip
+.MAKE: all check check-am install install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am \
        check-local clean clean-generic clean-libtool clean-local \
@@ -982,6 +987,8 @@ uninstall-am: uninstall-libscijit_la_includeHEADERS \
        uninstall-am uninstall-libscijit_la_includeHEADERS \
        uninstall-pkglibLTLIBRARIES
 
+src/cpp/llvm-wrapper-generated.cpp: src/cpp/llvm-wrapper.cpp
+       clang++ -emit-llvm  -I$(top_srcdir)/modules/types/includes/ -I$(top_srcdir)/modules/operations/includes/ -I$(top_srcdir)/modules/core/includes/  -I$(top_srcdir)/modules/ast/includes/ -I$(top_srcdir)/modules/localization/includes/ $(EIGEN_CPPFLAGS) -c src/cpp/llvm-wrapper.cpp -o - |  llc -march=cpp -cppgen=contents -o src/cpp/llvm-wrapper-generated.cpp
 
 # This target enables tests for Scilab
 check-local: $(top_builddir)/scilab-bin test
diff --git a/scilab/modules/jit/src/cpp/llvm-wrapper-generated.cpp b/scilab/modules/jit/src/cpp/llvm-wrapper-generated.cpp
new file mode 100644 (file)
index 0000000..94067f1
--- /dev/null
@@ -0,0 +1,393 @@
+// Generated by llvm2cpp - DO NOT MODIFY!
+
+
+Module* makeLLVMModuleContents(Module *mod)
+{
+
+    mod->setModuleIdentifier("<stdin>");
+
+    // Type Definitions
+    StructType *StructTy_class_std__ios_base__Init = mod->getTypeByName("class.std::ios_base::Init");
+    if (!StructTy_class_std__ios_base__Init)
+    {
+        StructTy_class_std__ios_base__Init = StructType::create(mod->getContext(), "class.std::ios_base::Init");
+    }
+    std::vector<Type*>StructTy_class_std__ios_base__Init_fields;
+    StructTy_class_std__ios_base__Init_fields.push_back(IntegerType::get(mod->getContext(), 8));
+    if (StructTy_class_std__ios_base__Init->isOpaque())
+    {
+        StructTy_class_std__ios_base__Init->setBody(StructTy_class_std__ios_base__Init_fields, /*isPacked=*/false);
+    }
+
+    PointerType* PointerTy_0 = PointerType::get(StructTy_class_std__ios_base__Init, 0);
+
+    PointerType* PointerTy_1 = PointerType::get(IntegerType::get(mod->getContext(), 8), 0);
+
+    std::vector<Type*>StructTy_3_fields;
+    StructTy_3_fields.push_back(IntegerType::get(mod->getContext(), 32));
+    std::vector<Type*>FuncTy_5_args;
+    FunctionType* FuncTy_5 = FunctionType::get(
+                                 /*Result=*/Type::getVoidTy(mod->getContext()),
+                                 /*Params=*/FuncTy_5_args,
+                                 /*isVarArg=*/false);
+
+    PointerType* PointerTy_4 = PointerType::get(FuncTy_5, 0);
+
+    StructTy_3_fields.push_back(PointerTy_4);
+    StructType *StructTy_3 = StructType::get(mod->getContext(), StructTy_3_fields, /*isPacked=*/false);
+
+    ArrayType* ArrayTy_2 = ArrayType::get(StructTy_3, 1);
+
+    PointerType* PointerTy_6 = PointerType::get(ArrayTy_2, 0);
+
+    std::vector<Type*>FuncTy_8_args;
+    FuncTy_8_args.push_back(PointerTy_0);
+    FunctionType* FuncTy_8 = FunctionType::get(
+                                 /*Result=*/Type::getVoidTy(mod->getContext()),
+                                 /*Params=*/FuncTy_8_args,
+                                 /*isVarArg=*/false);
+
+    PointerType* PointerTy_7 = PointerType::get(FuncTy_8, 0);
+
+    std::vector<Type*>FuncTy_10_args;
+    FuncTy_10_args.push_back(PointerTy_1);
+    FunctionType* FuncTy_10 = FunctionType::get(
+                                  /*Result=*/Type::getVoidTy(mod->getContext()),
+                                  /*Params=*/FuncTy_10_args,
+                                  /*isVarArg=*/false);
+
+    PointerType* PointerTy_9 = PointerType::get(FuncTy_10, 0);
+
+    std::vector<Type*>FuncTy_12_args;
+    FuncTy_12_args.push_back(PointerTy_9);
+    FuncTy_12_args.push_back(PointerTy_1);
+    FuncTy_12_args.push_back(PointerTy_1);
+    FunctionType* FuncTy_12 = FunctionType::get(
+                                  /*Result=*/IntegerType::get(mod->getContext(), 32),
+                                  /*Params=*/FuncTy_12_args,
+                                  /*isVarArg=*/false);
+
+    PointerType* PointerTy_11 = PointerType::get(FuncTy_12, 0);
+
+    std::vector<Type*>FuncTy_13_args;
+    FunctionType* FuncTy_13 = FunctionType::get(
+                                  /*Result=*/IntegerType::get(mod->getContext(), 32),
+                                  /*Params=*/FuncTy_13_args,
+                                  /*isVarArg=*/false);
+
+    PointerType* PointerTy_14 = PointerType::get(IntegerType::get(mod->getContext(), 32), 0);
+
+    StructType *StructTy_class_types__Double = mod->getTypeByName("class.types::Double");
+    if (!StructTy_class_types__Double)
+    {
+        StructTy_class_types__Double = StructType::create(mod->getContext(), "class.types::Double");
+    }
+    std::vector<Type*>StructTy_class_types__Double_fields;
+    StructType *StructTy_class_types__ArrayOf = mod->getTypeByName("class.types::ArrayOf");
+    if (!StructTy_class_types__ArrayOf)
+    {
+        StructTy_class_types__ArrayOf = StructType::create(mod->getContext(), "class.types::ArrayOf");
+    }
+    std::vector<Type*>StructTy_class_types__ArrayOf_fields;
+    StructType *StructTy_class_types__GenericType = mod->getTypeByName("class.types::GenericType");
+    if (!StructTy_class_types__GenericType)
+    {
+        StructTy_class_types__GenericType = StructType::create(mod->getContext(), "class.types::GenericType");
+    }
+    std::vector<Type*>StructTy_class_types__GenericType_fields;
+    ArrayType* ArrayTy_17 = ArrayType::get(IntegerType::get(mod->getContext(), 8), 36);
+
+    StructTy_class_types__GenericType_fields.push_back(ArrayTy_17);
+    StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
+    StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
+    StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
+    StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
+    ArrayType* ArrayTy_18 = ArrayType::get(IntegerType::get(mod->getContext(), 32), 50);
+
+    StructTy_class_types__GenericType_fields.push_back(ArrayTy_18);
+    StructTy_class_types__GenericType_fields.push_back(IntegerType::get(mod->getContext(), 32));
+    if (StructTy_class_types__GenericType->isOpaque())
+    {
+        StructTy_class_types__GenericType->setBody(StructTy_class_types__GenericType_fields, /*isPacked=*/false);
+    }
+
+    StructTy_class_types__ArrayOf_fields.push_back(StructTy_class_types__GenericType);
+    StructTy_class_types__ArrayOf_fields.push_back(IntegerType::get(mod->getContext(), 8));
+    PointerType* PointerTy_19 = PointerType::get(Type::getDoubleTy(mod->getContext()), 0);
+
+    StructTy_class_types__ArrayOf_fields.push_back(PointerTy_19);
+    StructTy_class_types__ArrayOf_fields.push_back(PointerTy_19);
+    if (StructTy_class_types__ArrayOf->isOpaque())
+    {
+        StructTy_class_types__ArrayOf->setBody(StructTy_class_types__ArrayOf_fields, /*isPacked=*/false);
+    }
+
+    StructTy_class_types__Double_fields.push_back(StructTy_class_types__ArrayOf);
+    StructTy_class_types__Double_fields.push_back(IntegerType::get(mod->getContext(), 8));
+    StructTy_class_types__Double_fields.push_back(IntegerType::get(mod->getContext(), 8));
+    if (StructTy_class_types__Double->isOpaque())
+    {
+        StructTy_class_types__Double->setBody(StructTy_class_types__Double_fields, /*isPacked=*/false);
+    }
+
+    PointerType* PointerTy_16 = PointerType::get(StructTy_class_types__Double, 0);
+
+    PointerType* PointerTy_15 = PointerType::get(PointerTy_16, 0);
+
+    std::vector<Type*>FuncTy_21_args;
+    FunctionType* FuncTy_21 = FunctionType::get(
+                                  /*Result=*/PointerTy_16,
+                                  /*Params=*/FuncTy_21_args,
+                                  /*isVarArg=*/false);
+
+    PointerType* PointerTy_20 = PointerType::get(FuncTy_21, 0);
+
+    std::vector<Type*>FuncTy_23_args;
+    FuncTy_23_args.push_back(PointerTy_16);
+    FuncTy_23_args.push_back(PointerTy_16);
+    FuncTy_23_args.push_back(PointerTy_15);
+    FunctionType* FuncTy_23 = FunctionType::get(
+                                  /*Result=*/IntegerType::get(mod->getContext(), 32),
+                                  /*Params=*/FuncTy_23_args,
+                                  /*isVarArg=*/false);
+
+    PointerType* PointerTy_22 = PointerType::get(FuncTy_23, 0);
+
+
+    // Function Declarations
+
+    Function* func___cxx_global_var_init = mod->getFunction("__cxx_global_var_init");
+    if (!func___cxx_global_var_init)
+    {
+        func___cxx_global_var_init = Function::Create(
+                                         /*Type=*/FuncTy_5,
+                                         /*Linkage=*/GlobalValue::InternalLinkage,
+                                         /*Name=*/"__cxx_global_var_init", mod);
+        func___cxx_global_var_init->setCallingConv(CallingConv::C);
+        func___cxx_global_var_init->setSection(".text.startup");
+    }
+    AttrListPtr func___cxx_global_var_init_PAL;
+    func___cxx_global_var_init->setAttributes(func___cxx_global_var_init_PAL);
+
+    Function* func__ZNSt8ios_base4InitC1Ev = mod->getFunction("_ZNSt8ios_base4InitC1Ev");
+    if (!func__ZNSt8ios_base4InitC1Ev)
+    {
+        func__ZNSt8ios_base4InitC1Ev = Function::Create(
+                                           /*Type=*/FuncTy_8,
+                                           /*Linkage=*/GlobalValue::ExternalLinkage,
+                                           /*Name=*/"_ZNSt8ios_base4InitC1Ev", mod); // (external, no body)
+        func__ZNSt8ios_base4InitC1Ev->setCallingConv(CallingConv::C);
+    }
+    AttrListPtr func__ZNSt8ios_base4InitC1Ev_PAL;
+    func__ZNSt8ios_base4InitC1Ev->setAttributes(func__ZNSt8ios_base4InitC1Ev_PAL);
+
+    Function* func__ZNSt8ios_base4InitD1Ev = mod->getFunction("_ZNSt8ios_base4InitD1Ev");
+    if (!func__ZNSt8ios_base4InitD1Ev)
+    {
+        func__ZNSt8ios_base4InitD1Ev = Function::Create(
+                                           /*Type=*/FuncTy_8,
+                                           /*Linkage=*/GlobalValue::ExternalLinkage,
+                                           /*Name=*/"_ZNSt8ios_base4InitD1Ev", mod); // (external, no body)
+        func__ZNSt8ios_base4InitD1Ev->setCallingConv(CallingConv::C);
+    }
+    AttrListPtr func__ZNSt8ios_base4InitD1Ev_PAL;
+    func__ZNSt8ios_base4InitD1Ev->setAttributes(func__ZNSt8ios_base4InitD1Ev_PAL);
+
+    Function* func___cxa_atexit = mod->getFunction("__cxa_atexit");
+    if (!func___cxa_atexit)
+    {
+        func___cxa_atexit = Function::Create(
+                                /*Type=*/FuncTy_12,
+                                /*Linkage=*/GlobalValue::ExternalLinkage,
+                                /*Name=*/"__cxa_atexit", mod); // (external, no body)
+        func___cxa_atexit->setCallingConv(CallingConv::C);
+    }
+    AttrListPtr func___cxa_atexit_PAL;
+    func___cxa_atexit->setAttributes(func___cxa_atexit_PAL);
+
+    Function* func_main = mod->getFunction("main");
+    if (!func_main)
+    {
+        func_main = Function::Create(
+                        /*Type=*/FuncTy_13,
+                        /*Linkage=*/GlobalValue::ExternalLinkage,
+                        /*Name=*/"main", mod);
+        func_main->setCallingConv(CallingConv::C);
+    }
+    AttrListPtr func_main_PAL;
+    func_main->setAttributes(func_main_PAL);
+
+    Function* func__ZN5types6Double5EmptyEv = mod->getFunction("_ZN5types6Double5EmptyEv");
+    if (!func__ZN5types6Double5EmptyEv)
+    {
+        func__ZN5types6Double5EmptyEv = Function::Create(
+                                            /*Type=*/FuncTy_21,
+                                            /*Linkage=*/GlobalValue::ExternalLinkage,
+                                            /*Name=*/"_ZN5types6Double5EmptyEv", mod); // (external, no body)
+        func__ZN5types6Double5EmptyEv->setCallingConv(CallingConv::C);
+    }
+    AttrListPtr func__ZN5types6Double5EmptyEv_PAL;
+    func__ZN5types6Double5EmptyEv->setAttributes(func__ZN5types6Double5EmptyEv_PAL);
+
+    Function* func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_ = mod->getFunction("_Z17AddDoubleToDoublePN5types6DoubleES1_PS1_");
+    if (!func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_)
+    {
+        func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_ = Function::Create(
+                    /*Type=*/FuncTy_23,
+                    /*Linkage=*/GlobalValue::ExternalLinkage,
+                    /*Name=*/"_Z17AddDoubleToDoublePN5types6DoubleES1_PS1_", mod); // (external, no body)
+        func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_->setCallingConv(CallingConv::C);
+    }
+    AttrListPtr func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1__PAL;
+    func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_->setAttributes(func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1__PAL);
+
+    Function* func__GLOBAL__I_a = mod->getFunction("_GLOBAL__I_a");
+    if (!func__GLOBAL__I_a)
+    {
+        func__GLOBAL__I_a = Function::Create(
+                                /*Type=*/FuncTy_5,
+                                /*Linkage=*/GlobalValue::InternalLinkage,
+                                /*Name=*/"_GLOBAL__I_a", mod);
+        func__GLOBAL__I_a->setCallingConv(CallingConv::C);
+        func__GLOBAL__I_a->setSection(".text.startup");
+    }
+    AttrListPtr func__GLOBAL__I_a_PAL;
+    func__GLOBAL__I_a->setAttributes(func__GLOBAL__I_a_PAL);
+
+    // Global Variable Declarations
+
+
+    GlobalVariable* gvar_struct__ZStL8__ioinit = new GlobalVariable(/*Module=*/*mod,
+            /*Type=*/StructTy_class_std__ios_base__Init,
+            /*isConstant=*/false,
+            /*Linkage=*/GlobalValue::InternalLinkage,
+            /*Initializer=*/0, // has initializer, specified below
+            /*Name=*/"_ZStL8__ioinit");
+    gvar_struct__ZStL8__ioinit->setAlignment(1);
+
+    GlobalVariable* gvar_int8___dso_handle = new GlobalVariable(/*Module=*/*mod,
+            /*Type=*/IntegerType::get(mod->getContext(), 8),
+            /*isConstant=*/false,
+            /*Linkage=*/GlobalValue::ExternalLinkage,
+            /*Initializer=*/0,
+            /*Name=*/"__dso_handle");
+
+    GlobalVariable* gvar_array_llvm_global_ctors = new GlobalVariable(/*Module=*/*mod,
+            /*Type=*/ArrayTy_2,
+            /*isConstant=*/false,
+            /*Linkage=*/GlobalValue::AppendingLinkage,
+            /*Initializer=*/0, // has initializer, specified below
+            /*Name=*/"llvm.global_ctors");
+
+    // Constant Definitions
+    ConstantAggregateZero* const_struct_24 = ConstantAggregateZero::get(StructTy_class_std__ios_base__Init);
+    std::vector<Constant*> const_array_25_elems;
+    std::vector<Constant*> const_struct_26_fields;
+    ConstantInt* const_int32_27 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("65535"), 10));
+    const_struct_26_fields.push_back(const_int32_27);
+    const_struct_26_fields.push_back(func__GLOBAL__I_a);
+    Constant* const_struct_26 = ConstantStruct::get(StructTy_3, const_struct_26_fields);
+    const_array_25_elems.push_back(const_struct_26);
+    Constant* const_array_25 = ConstantArray::get(ArrayTy_2, const_array_25_elems);
+    Constant* const_ptr_28 = ConstantExpr::getCast(Instruction::BitCast, func__ZNSt8ios_base4InitD1Ev, PointerTy_9);
+    std::vector<Constant*> const_ptr_29_indices;
+    ConstantInt* const_int32_30 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("0"), 10));
+    const_ptr_29_indices.push_back(const_int32_30);
+    const_ptr_29_indices.push_back(const_int32_30);
+    Constant* const_ptr_29 = ConstantExpr::getGetElementPtr(gvar_struct__ZStL8__ioinit, const_ptr_29_indices);
+    ConstantInt* const_int32_31 = ConstantInt::get(mod->getContext(), APInt(32, StringRef("1"), 10));
+
+    // Global Variable Definitions
+    gvar_struct__ZStL8__ioinit->setInitializer(const_struct_24);
+    gvar_array_llvm_global_ctors->setInitializer(const_array_25);
+
+    // Function Definitions
+
+    // Function: __cxx_global_var_init (func___cxx_global_var_init)
+    {
+
+        BasicBlock* label_32 = BasicBlock::Create(mod->getContext(), "", func___cxx_global_var_init, 0);
+
+        // Block  (label_32)
+        CallInst* void_33 = CallInst::Create(func__ZNSt8ios_base4InitC1Ev, gvar_struct__ZStL8__ioinit, "", label_32);
+        void_33->setCallingConv(CallingConv::C);
+        void_33->setTailCall(false);
+        AttrListPtr void_33_PAL;
+        void_33->setAttributes(void_33_PAL);
+
+        std::vector<Value*> int32_34_params;
+        int32_34_params.push_back(const_ptr_28);
+        int32_34_params.push_back(const_ptr_29);
+        int32_34_params.push_back(gvar_int8___dso_handle);
+        CallInst* int32_34 = CallInst::Create(func___cxa_atexit, int32_34_params, "", label_32);
+        int32_34->setCallingConv(CallingConv::C);
+        int32_34->setTailCall(false);
+        AttrListPtr int32_34_PAL;
+        int32_34->setAttributes(int32_34_PAL);
+
+        ReturnInst::Create(mod->getContext(), label_32);
+
+    }
+
+    // Function: main (func_main)
+    {
+
+        BasicBlock* label_36 = BasicBlock::Create(mod->getContext(), "", func_main, 0);
+
+        // Block  (label_36)
+        AllocaInst* ptr_37 = new AllocaInst(IntegerType::get(mod->getContext(), 32), "", label_36);
+        ptr_37->setAlignment(4);
+        AllocaInst* ptr_pdbl1 = new AllocaInst(PointerTy_16, "pdbl1", label_36);
+        ptr_pdbl1->setAlignment(8);
+        AllocaInst* ptr_res = new AllocaInst(IntegerType::get(mod->getContext(), 32), "res", label_36);
+        ptr_res->setAlignment(4);
+        StoreInst* void_38 = new StoreInst(const_int32_30, ptr_37, false, label_36);
+        CallInst* ptr_39 = CallInst::Create(func__ZN5types6Double5EmptyEv, "", label_36);
+        ptr_39->setCallingConv(CallingConv::C);
+        ptr_39->setTailCall(false);
+        AttrListPtr ptr_39_PAL;
+        ptr_39->setAttributes(ptr_39_PAL);
+
+        StoreInst* void_40 = new StoreInst(ptr_39, ptr_pdbl1, false, label_36);
+        void_40->setAlignment(8);
+        LoadInst* ptr_41 = new LoadInst(ptr_pdbl1, "", false, label_36);
+        ptr_41->setAlignment(8);
+        LoadInst* ptr_42 = new LoadInst(ptr_pdbl1, "", false, label_36);
+        ptr_42->setAlignment(8);
+        std::vector<Value*> int32_43_params;
+        int32_43_params.push_back(ptr_41);
+        int32_43_params.push_back(ptr_42);
+        int32_43_params.push_back(ptr_pdbl1);
+        CallInst* int32_43 = CallInst::Create(func__Z17AddDoubleToDoublePN5types6DoubleES1_PS1_, int32_43_params, "", label_36);
+        int32_43->setCallingConv(CallingConv::C);
+        int32_43->setTailCall(false);
+        AttrListPtr int32_43_PAL;
+        int32_43->setAttributes(int32_43_PAL);
+
+        StoreInst* void_44 = new StoreInst(int32_43, ptr_res, false, label_36);
+        void_44->setAlignment(4);
+        LoadInst* int32_45 = new LoadInst(ptr_res, "", false, label_36);
+        int32_45->setAlignment(4);
+        ReturnInst::Create(mod->getContext(), int32_45, label_36);
+
+    }
+
+    // Function: _GLOBAL__I_a (func__GLOBAL__I_a)
+    {
+
+        BasicBlock* label_47 = BasicBlock::Create(mod->getContext(), "", func__GLOBAL__I_a, 0);
+
+        // Block  (label_47)
+        CallInst* void_48 = CallInst::Create(func___cxx_global_var_init, "", label_47);
+        void_48->setCallingConv(CallingConv::C);
+        void_48->setTailCall(false);
+        AttrListPtr void_48_PAL;
+        void_48->setAttributes(void_48_PAL);
+
+        ReturnInst::Create(mod->getContext(), label_47);
+
+    }
+
+    return mod;
+
+}
diff --git a/scilab/modules/jit/src/cpp/llvm-wrapper.cpp b/scilab/modules/jit/src/cpp/llvm-wrapper.cpp
new file mode 100644 (file)
index 0000000..20f2ff5
--- /dev/null
@@ -0,0 +1,12 @@
+#include "double.hxx"
+#include "types_addition.hxx"
+
+int main()
+{
+    types::Double* pdbl1 = types::Double::Empty();
+    int res = AddDoubleToDouble(pdbl1, pdbl1, &pdbl1);
+
+    return res;
+}
+
+