(* Wolfram Language Source File *)

(*****************************************************

        Source file generated by Wolfram Language AutoLibraryLink
        Package.  Understand that AutoLibraryLink might in the future
        overwrite any custom changes to this source code.

        Package: LLVMLink`llvmc
        Generated on behalf of: abduld
        CreationDate: Thu 20 Oct 2016 02:36:19

*******************************************************)


BeginPackage["LLVMLink`llvmc`"]



Begin["`Private`"]


Needs["LLVMLink`"]
Needs["LLVMLink`LLVMInformation`"]



LLVMLibraryName[] := LLVMLibraryName[] = FindLibrary["LLVMLink"]

llvmVersion = $LLVMInformation["LLVM_VERSION"]

Switch[llvmVersion,
    3.8,
        Get["LLVMLink`llvmc38`"],
    3.9,
        Get["LLVMLink`llvmc39`"],
    4.0,
        Get["LLVMLink`llvmc40`"],
    6.0,
        Get["LLVMLink`llvmc60`"],
    7.0,
        Get["LLVMLink`llvmc70`"],
    _,
        Throw["Unsupported LLVM Version"]
]

Get["LLVMLink`LLVMDebugInfoBindings`"]
Get["LLVMLink`LLVMProfiling`"]
Get["LLVMLink`LLVMMetadata`"]
Get["LLVMLink`LLVMSystem`"]


LLVMLibraryFunction["LLVMInitializeAssumptionCacheTracker"] :=
LLVMLibraryFunction["LLVMInitializeAssumptionCacheTracker"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_LLVMInitializeAssumptionCacheTracker_Wrapper",
    {
        (* Type[LLVMPassRegistryRef -> struct LLVMOpaquePassRegistry *] *)
        Integer
    },
    (* Type[void] *)
    "Void"
]

LLVMLibraryFunction["dereferenceCharPointerPointer"] :=
LLVMLibraryFunction["dereferenceCharPointerPointer"] = LibraryFunctionLoad[LLVMLibraryName[],
    "dereferenceCharPointerPointer",
    {Integer},
    Integer
]

LLVMLibraryFunction["setUTF8String"] :=
LLVMLibraryFunction["setUTF8String"] = LibraryFunctionLoad[LLVMLibraryName[],
    "setUTF8String",
    {Integer},
    "UTF8String"
]

LLVMLibraryFunction["LLVMDisposeMessage_fromPointer"] :=
LLVMLibraryFunction["LLVMDisposeMessage_fromPointer"] = LibraryFunctionLoad[LLVMLibraryName[],
	"LLVMDisposeMessage_fromPointer",
	{Integer},
	"Void"
]

LLVMLibraryFunction["LLVMPrintModuleToString_toPointer"] :=
LLVMLibraryFunction["LLVMPrintModuleToString_toPointer"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMPrintModuleToString_toPointer",
    {Integer},
    Integer
]

LLVMLibraryFunction["LLVMPrintValueToString_toPointer"] :=
LLVMLibraryFunction["LLVMPrintValueToString_toPointer"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMPrintValueToString_toPointer",
    {Integer},
    Integer
]

LLVMLibraryFunction["LLVMPrintTypeToString_toPointer"] :=
LLVMLibraryFunction["LLVMPrintTypeToString_toPointer"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMPrintTypeToString_toPointer",
    {Integer},
    Integer
]

LLVMLibraryFunction["LLVMGetDefaultTargetTriple_toPointer"] :=
LLVMLibraryFunction["LLVMGetDefaultTargetTriple_toPointer"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMGetDefaultTargetTriple_toPointer",
    {},
    Integer
]




LLVMLibraryFunction["getSymbolResolverAddress"] :=
LLVMLibraryFunction["getSymbolResolverAddress"] = LibraryFunctionLoad[LLVMLibraryName[],
    "getSymbolResolverAddress",
    {},
    Integer
]

LLVMLibraryFunction["LLVMLookupIntrinsicID"] :=
LLVMLibraryFunction["LLVMLookupIntrinsicID"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_LLVMLookupIntrinsicID_Wrapper",
    {"UTF8String"},
    Integer
]

LLVMLibraryFunction["LLVMIntrinsicDeclaration"] :=
LLVMLibraryFunction["LLVMIntrinsicDeclaration"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_LLVMIntrinsicDeclaration_Wrapper",
    {Integer, Integer, {Integer, 1}},
    Integer
]

(*
Validation
*)

LLVMLibraryFunction["castIsValid"] :=
LLVMLibraryFunction["castIsValid"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_castIsValid_Wrapper",
    {
        Integer,
        Integer,
        Integer
    },
    True|False
]


(*
Arguments
*)


LLVMLibraryFunction["LLVMParseCommandLineOptions2"] :=
LLVMLibraryFunction["LLVMParseCommandLineOptions2"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_LLVMParseCommandLineOptions2_Wrapper",
    {
        (* input string *)
        "UTF8String",
        (* delimiter *)
        "UTF8String",
        (* name *)
        "UTF8String"
    },
    "Void"
]


LLVMLibraryFunction["LLVMResetCommandLineOptions"] :=
LLVMLibraryFunction["LLVMResetCommandLineOptions"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_LLVMResetCommandLineOptions_Wrapper",
    {
    },
    "Void"
]



(*
Miscellaneous
*)


LLVMLibraryFunction["LLVMOrcGetSymbolAddress2"] :=
LLVMLibraryFunction["LLVMOrcGetSymbolAddress2"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_LLVMOrcGetSymbolAddress2_Wrapper",
    {
        (* Type[LLVMOrcJITStackRef -> struct LLVMOrcOpaqueJITStack *] *)
        Integer,
        (* Type[LLVMOrcTargetAddress * -> uint64_t *] *)
        Integer,
        (* Type[const char *] *)
        "UTF8String",
        (*ExportedSymbolsOnly*)
        True|False
    },
    (* Type[LLVMOrcErrorCode -> enum LLVMOrcErrorCode] *)
    Integer
]






LLVMLibraryFunction[args___] := Throw[{"Unknown LLVMLibraryFunction: ", args}, "LLVMLibraryFunction"];

LLVMEnumeration[args___] := Throw[{"Unknown LLVMEnumeration: ", args}, "LLVMEnumeration"];


LLVMLibraryFunction["LLVMBuildCleanupPad"] :=
LLVMLibraryFunction["LLVMBuildCleanupPad"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_LLVMBuildCleanupPad",
    {Integer, Integer, Integer, Integer, "UTF8String"},
    Integer
]

LLVMLibraryFunction["LLVMBuildCleanupRet"] :=
LLVMLibraryFunction["LLVMBuildCleanupRet"] = LibraryFunctionLoad[LLVMLibraryName[],
    "LLVMLink_LLVMBuildCleanupRet",
    {Integer, Integer, Integer},
    Integer
]




End[]

EndPackage[]

