On Tue, Oct 25, 2016 at 3:55 PM, <iceblue2...@gmail.com> wrote: > I need some part of my julia code to be executed at run time and be loaded > as llvm IR (or assembly). It is allowed to be IR or assembly code but not > julia source code or c source code.
Why does it have to be IR or assembly? > > Are there other options like the output-bc option that can work for me? > > What other approaches I can consider? What problem are you trying to solve. > > Thanks for all the work making julia great!! > > On Tuesday, October 25, 2016 at 10:58:37 AM UTC-7, Stefan Karpinski wrote: >> >> Julia can already generate static code: >> >> http://juliacomputing.com/blog/2016/02/09/static-julia.html >> http://juliacomputing.com/blog/2016/03/10/j2c-announcement.html >> >> However, Julia's @code_llvm output is not meant to be compilable. What are >> you trying to do? >> >> >> On Tue, Oct 25, 2016 at 1:11 PM, <icebl...@gmail.com> wrote: >>> >>> Thanks, is it possible for julia to avoid generating jl_value_t >>> >>> When I use a scalar Int64 julia generates code with i64 as input and no >>> jl_value_t appears. is it possible to do the same with arrays? >>> Array{Float32,2} genrates a jl_value_t? Is there an array type that can do >>> this? For example fixed arrays? >>> >>> Finally, is this features planned to be supported if julia statically >>> compiles? >>> >>> Thanks >>> >>> On Tuesday, October 25, 2016 at 9:23:02 AM UTC-7, Yichao Yu wrote: >>>> >>>> On Mon, Oct 24, 2016 at 8:15 PM, <icebl...@gmail.com> wrote: >>>> > Hi All, >>>> > >>>> > I am trying to call llvm ir generated from julia. >>>> > >>>> > Here is my function: >>>> > >>>> > function incr(a::Array{Int64}) a+1; end >>>> > >>>> > >>>> > thus: >>>> > >>>> > @code_llvm(incr([1 2 5 6 7])) >>>> > >>>> > returns: >>>> > >>>> > define %jl_value_t* @julia_incr_62127(%jl_value_t*) #0 { >>>> > top: >>>> > %1 = call %jl_value_t* @"julia_.+_62128"(%jl_value_t* %0, i64 1) #0 >>>> > ret %jl_value_t* %1 >>>> > } >>>> > >>>> > >>>> > >>>> > Thus to call it using llvm I try : >>>> > >>>> > Base.llvmcall(("""declare %jl_value_t* >>>> > @julia_incr_62127(%jl_value_t*)""", >>>> > """top: >>>> > %1 = call %jl_value_t* @"julia_.+_62128"(%jl_value_t* %0, i64 >>>> > 1) #0 >>>> > ret %jl_value_t* %1 >>>> > """),Vector{Int64},Tuple{Array{Int64}},[1 2 5 6 7]) >>>> > >>>> > >>>> > >>>> > >>>> > and I get the error: >>>> > >>>> > ERROR: error compiling anonymous: Failed to parse LLVM Assembly: >>>> > julia: llvmcall:2:9: error: use of undefined type named 'jl_value_t' >>>> > declare %jl_value_t* @julia_incr_62127(%jl_value_t*) >>>> > >>>> > >>>> > I m not sure how to define jl_value_t. >>>> >>>> This is not supported. >>>> You also shouldn't call julia generated functions with `llvmcall`. >>>> >>>> > >>>> > >>>> > any help? >>>> > >>>> > Thanks >> >> >