Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 22 18:24

    tannergooding on master

    Expose GetTargetFromTriple from… (compare)

  • Nov 22 18:24
    tannergooding closed #153
  • Nov 15 21:25
    jackoalan opened #153
  • Nov 14 22:40
    jackoalan closed #152
  • Nov 12 20:21
    tannergooding commented #152
  • Nov 12 05:54
    jackoalan opened #152
  • Oct 26 18:22

    tannergooding on master

    Regenerating bindings for LLVM … (compare)

  • Oct 26 18:22
    tannergooding closed #151
  • Oct 26 18:22
    tannergooding closed #150
  • Oct 26 18:10
    tannergooding commented #150
  • Oct 19 22:01
    tannergooding commented #151
  • Oct 19 21:57
    tannergooding reopened #151
  • Oct 19 21:57
    tannergooding closed #151
  • Oct 19 21:49
    tannergooding commented #150
  • Oct 19 21:49
    tannergooding commented #150
  • Oct 19 21:49
    tannergooding commented #150
  • Oct 19 21:49
    tannergooding commented #150
  • Oct 19 21:48
    tannergooding commented #150
  • Oct 19 21:48
    tannergooding commented #150
  • Oct 19 21:48
    tannergooding opened #151
λtlas
@cloudrex
Yea I'm suspecting that's the issue too, with C# 7.0 you can ignore out params
but since I'm ignoring it, it shouldn't be an issue at all
must be something wrong internally
Ivan
@advancedwebdeveloper
Hi
any motivated people here, targeting MIPS support for the LLVM?
λtlas
@cloudrex
Any ideas why the LLVM.BuildStructGEP method accepts an LLVMValueRef instead of LLVMTypeRef (target struct) as the 2nd parameter?
yowl
@yowl
How do add conditions to LLLVM.BuildPhi ?
yowl
@yowl
yowl
@yowl
Trying to use LLVMSharp 8.0.0 and VS is not finding DIBuilderCreateDebugLocation even though its in the downloaded package
.method public hidebysig static pinvokeimpl("libLLVM" as "LLVMDIBuilderCreateConstantValueExpression" cdecl) 
        valuetype LLVMSharp.LLVMOpaqueMetadata* 
        DIBuilderCreateConstantValueExpression(valuetype LLVMSharp.LLVMOpaqueDIBuilder* Builder,
                                               int64 Value) cil managed preservesig
building gives error CS0117: 'LLVM' does not contain a definition for 'DIBuilderCreateDebugLocation'
Sorry, this is the IL
.method public hidebysig static pinvokeimpl("libLLVM" as "LLVMDIBuilderCreateDebugLocation" cdecl) 
        valuetype LLVMSharp.LLVMOpaqueMetadata* 
        DIBuilderCreateDebugLocation(valuetype LLVMSharp.LLVMOpaqueContext* Ctx,
                                     uint32 Line,
                                     uint32 Column,
                                     valuetype LLVMSharp.LLVMOpaqueMetadata* Scope,
                                     valuetype LLVMSharp.LLVMOpaqueMetadata* InlinedAt) cil managed preservesig
{
yowl
@yowl
Seems like that was just some old 5.0.0 reference getting in the way
However, things like LLVM.Int32Type() are returning pointers so the using class needs to b marked unsafe ?
Andy Jansson
@andyjansson
Hi. Is it possible to use trampoline intrinsics with LLVMSharp?
yowl
@yowl
@andyjansson I didn't see any references to those in the source. Could be wrong. You might create an issue, you'll probably get one of the maintainers responding there.
proxy
@3n-k1

Hi there! Sorry if this is the wrong place, I'm just not sure where else to ask. Given this code:

LLVMTypeRef[] param_types = { LLVM.Int32Type(), LLVM.Int32Type() };
LLVMTypeRef ret_type = LLVM.FunctionType(LLVM.Int32Type(), param_types, false);
 LLVMValueRef sum = LLVM.AddFunction(mod, "sum", ret_type);

is there a way to make the param_types named, so that I can refer to them by a specific string with LLVM.GetParam()?

It seems like it's possible in LLVM, just wanted to see if it was doable in LLVMSharp
Andy Jansson
@andyjansson

@3n-k1 I believe you do it by fetching each parameter by its index, then setting the name. So something like:

var param = sum.GetParam(index);
param.Name = paramNames[index];

(untested)

proxy
@3n-k1
Sadly no: 'LLVMValueRef' does not contain a definition for 'Name' and no accessible extension method 'Name' accepting a first argument of type 'LLVMValueRef' could be found
but thank you for the attempt @andyjansson
Andy Jansson
@andyjansson
proxy
@3n-k1
@andyjansson I didn't know there was an OOP wrapper, but that sounds lovely. thanks for the help!
hmmm, now how do I access it by name?
Andy Jansson
@andyjansson
Well, the Kaleidoscope tutorial tracks it by using a dictionary.
proxy
@3n-k1
yeah, I was just hoping there was an easier way. Oh well. Thanks a ton for the help, I appreciate it
chilipepperhott
@chilipepperhott
I was wondering the reasont behind the license. If it is really a generated wrapper, then why not a more permissive license?
Actually, nevermind
I did a bit more research, and it is already really permissive
Bartosz Strachowski
@strachob
Hey. I am new to LLVM Sharp and lately have started to develop my own language using it.
Can someone please help me with some example code of how to create (print to standard output) and (read from standard input). Because i have problems developing it
yowl
@yowl
@strachob what is your final target ?
Bartosz Strachowski
@strachob
@yowl I don't know if I get your question right. I'm using LLVMSharp in 5.0 version with .Net Core 3.1.
in the Code i have
            LLVM.LinkInMCJIT();
            LLVM.InitializeX86TargetMC();
            LLVM.InitializeX86Target();
            LLVM.InitializeX86TargetInfo();
            LLVM.InitializeX86AsmParser();
            LLVM.InitializeX86AsmPrinter();
yowl
@yowl
@strachob but you are going to compile your LLVM to something, what is that?
Or you are trying to build a windows exe and want to do what C printf would do?
yowl
@yowl
I suppose if that is the case, you could extern WriteConsoleW and link that in. I've not tried that...
I would recommend going to the latest version if you can
Bartosz Strachowski
@strachob

For now what I do I write my module into bitecode and then use it from .cpp

#include <iostream>

extern "C" int sum(int, int);

int main() {
    std::cout << "Output of sum(-2, -2): " << sum(-2, -2) << std::endl;
    return 0;
}

Like that compiling it with clang++

Where sum is a function from my language
Bartosz Strachowski
@strachob
But in my language I would like to have a print(4) statement which would print 4 to the output
I use Antlr to generate Parser and Visitor which I later extend in my C# code
yowl
@yowl
I suppose you should be able to declare std::cout and write as extern symbol and dllimport function, and link them in.
Bartosz Strachowski
@strachob
Can you provide a bit of code for that?
yowl
@yowl
An external function is like:
                nativeFunc = Module.AddFunction(realMethodName, nativeFuncType);
                nativeFunc.Linkage = LLVMLinkage.LLVMDLLImportLinkage;
(this is LLVMSharp 9)
A symbol is like
                    s_shadowStackTop = Module.AddGlobal(LLVMTypeRef.CreatePointer(LLVMTypeRef.Int8, 0), "t_pShadowStackTop");
                    s_shadowStackTop.Linkage = LLVMLinkage.LLVMExternalLinkage;
Bartosz Strachowski
@strachob
Thank you very much. You helped a lot
Jan Blackquill (Carson Black)
@Appadeia_gitlab
are debug builds/builds with LLVM assertions enabled available from nuget?
if not, how would I get LLVMSharp to build against a copy of LLVM with those enabled