You've already forked linux-packaging-mono
Imported Upstream version 6.0.0.172
Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
parent
8016999e4d
commit
64ac736ec5
5
external/llvm/bindings/ocaml/irreader/CMakeLists.txt
vendored
Normal file
5
external/llvm/bindings/ocaml/irreader/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
add_ocaml_library(llvm_irreader
|
||||
OCAML llvm_irreader
|
||||
OCAMLDEP llvm
|
||||
C irreader_ocaml
|
||||
LLVM irreader)
|
35
external/llvm/bindings/ocaml/irreader/irreader_ocaml.c
vendored
Normal file
35
external/llvm/bindings/ocaml/irreader/irreader_ocaml.c
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
/*===-- irreader_ocaml.c - LLVM OCaml Glue ----------------------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* The LLVM Compiler Infrastructure *|
|
||||
|* *|
|
||||
|* This file is distributed under the University of Illinois Open Source *|
|
||||
|* License. See LICENSE.TXT for details. *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This file glues LLVM's OCaml interface to its C interface. These functions *|
|
||||
|* are by and large transparent wrappers to the corresponding C functions. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#include "llvm-c/IRReader.h"
|
||||
#include "caml/alloc.h"
|
||||
#include "caml/fail.h"
|
||||
#include "caml/memory.h"
|
||||
#include "caml/callback.h"
|
||||
|
||||
void llvm_raise(value Prototype, char *Message);
|
||||
|
||||
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
|
||||
CAMLprim value llvm_parse_ir(LLVMContextRef C,
|
||||
LLVMMemoryBufferRef MemBuf) {
|
||||
CAMLparam0();
|
||||
CAMLlocal2(Variant, MessageVal);
|
||||
LLVMModuleRef M;
|
||||
char *Message;
|
||||
|
||||
if (LLVMParseIRInContext(C, MemBuf, &M, &Message))
|
||||
llvm_raise(*caml_named_value("Llvm_irreader.Error"), Message);
|
||||
|
||||
CAMLreturn((value) M);
|
||||
}
|
16
external/llvm/bindings/ocaml/irreader/llvm_irreader.ml
vendored
Normal file
16
external/llvm/bindings/ocaml/irreader/llvm_irreader.ml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
(*===-- llvm_irreader.ml - LLVM OCaml Interface ---------------*- OCaml -*-===*
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is distributed under the University of Illinois Open Source
|
||||
* License. See LICENSE.TXT for details.
|
||||
*
|
||||
*===----------------------------------------------------------------------===*)
|
||||
|
||||
|
||||
exception Error of string
|
||||
|
||||
let _ = Callback.register_exception "Llvm_irreader.Error" (Error "")
|
||||
|
||||
external parse_ir : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
|
||||
= "llvm_parse_ir"
|
21
external/llvm/bindings/ocaml/irreader/llvm_irreader.mli
vendored
Normal file
21
external/llvm/bindings/ocaml/irreader/llvm_irreader.mli
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
(*===-- llvm_irreader.mli - LLVM OCaml Interface --------------*- OCaml -*-===*
|
||||
*
|
||||
* The LLVM Compiler Infrastructure
|
||||
*
|
||||
* This file is distributed under the University of Illinois Open Source
|
||||
* License. See LICENSE.TXT for details.
|
||||
*
|
||||
*===----------------------------------------------------------------------===*)
|
||||
|
||||
(** IR reader.
|
||||
|
||||
This interface provides an OCaml API for the LLVM assembly reader, the
|
||||
classes in the IRReader library. *)
|
||||
|
||||
exception Error of string
|
||||
|
||||
(** [parse_ir context mb] parses the IR for a new module [m] from the
|
||||
memory buffer [mb] in the context [context]. Returns [m] if successful, or
|
||||
raises [Error msg] otherwise, where [msg] is a description of the error
|
||||
encountered. See the function [llvm::ParseIR]. *)
|
||||
val parse_ir : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
|
Reference in New Issue
Block a user