public IrFunction CreateFunction(string name, IFunctionType signature)
        {
            ThrowIfDisposed( );

            LLVMValueRef valueRef = ModuleHandle.GetNamedFunction(name);

            if (valueRef == default)
            {
                valueRef = ModuleHandle.AddFunction(name, signature.GetTypeRef( ));
            }
            return(Value.FromHandle <IrFunction>(valueRef) !);
        }
Exemple #2
0
        public Function AddFunction(string name, IFunctionType signature)
        {
            ValidateHandle( );
            name.ValidateNotNullOrWhiteSpace(nameof(name));
            signature.ValidateNotNull(nameof(signature));

            return(Value.FromHandle <Function>(LLVMGetOrInsertFunction(ModuleHandle, name, signature.GetTypeRef( ))));
        }