1*0a6a1f1dSLionel Sambuc //===- IRBindings.h - Additional bindings for IR ----------------*- C++ -*-===//
2*0a6a1f1dSLionel Sambuc //
3*0a6a1f1dSLionel Sambuc // The LLVM Compiler Infrastructure
4*0a6a1f1dSLionel Sambuc //
5*0a6a1f1dSLionel Sambuc // This file is distributed under the University of Illinois Open Source
6*0a6a1f1dSLionel Sambuc // License. See LICENSE.TXT for details.
7*0a6a1f1dSLionel Sambuc //
8*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
9*0a6a1f1dSLionel Sambuc //
10*0a6a1f1dSLionel Sambuc // This file defines additional C bindings for the IR component.
11*0a6a1f1dSLionel Sambuc //
12*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
13*0a6a1f1dSLionel Sambuc
14*0a6a1f1dSLionel Sambuc #ifndef LLVM_BINDINGS_GO_LLVM_IRBINDINGS_H
15*0a6a1f1dSLionel Sambuc #define LLVM_BINDINGS_GO_LLVM_IRBINDINGS_H
16*0a6a1f1dSLionel Sambuc
17*0a6a1f1dSLionel Sambuc #include "llvm-c/Core.h"
18*0a6a1f1dSLionel Sambuc #ifdef __cplusplus
19*0a6a1f1dSLionel Sambuc #include "llvm/IR/Metadata.h"
20*0a6a1f1dSLionel Sambuc #include "llvm/Support/CBindingWrapping.h"
21*0a6a1f1dSLionel Sambuc #endif
22*0a6a1f1dSLionel Sambuc
23*0a6a1f1dSLionel Sambuc #include <stdint.h>
24*0a6a1f1dSLionel Sambuc
25*0a6a1f1dSLionel Sambuc #ifdef __cplusplus
26*0a6a1f1dSLionel Sambuc extern "C" {
27*0a6a1f1dSLionel Sambuc #endif
28*0a6a1f1dSLionel Sambuc
29*0a6a1f1dSLionel Sambuc typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
30*0a6a1f1dSLionel Sambuc
31*0a6a1f1dSLionel Sambuc // These functions duplicate the LLVM*FunctionAttr functions in the stable C
32*0a6a1f1dSLionel Sambuc // API. We cannot use the existing functions because they take 32-bit attribute
33*0a6a1f1dSLionel Sambuc // values, and the Go bindings expose all of the LLVM attributes, some of which
34*0a6a1f1dSLionel Sambuc // have values >= 1<<32.
35*0a6a1f1dSLionel Sambuc
36*0a6a1f1dSLionel Sambuc void LLVMAddFunctionAttr2(LLVMValueRef Fn, uint64_t PA);
37*0a6a1f1dSLionel Sambuc uint64_t LLVMGetFunctionAttr2(LLVMValueRef Fn);
38*0a6a1f1dSLionel Sambuc void LLVMRemoveFunctionAttr2(LLVMValueRef Fn, uint64_t PA);
39*0a6a1f1dSLionel Sambuc
40*0a6a1f1dSLionel Sambuc LLVMMetadataRef LLVMConstantAsMetadata(LLVMValueRef Val);
41*0a6a1f1dSLionel Sambuc
42*0a6a1f1dSLionel Sambuc LLVMMetadataRef LLVMMDString2(LLVMContextRef C, const char *Str, unsigned SLen);
43*0a6a1f1dSLionel Sambuc LLVMMetadataRef LLVMMDNode2(LLVMContextRef C, LLVMMetadataRef *MDs,
44*0a6a1f1dSLionel Sambuc unsigned Count);
45*0a6a1f1dSLionel Sambuc LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef C, LLVMMetadataRef *MDs,
46*0a6a1f1dSLionel Sambuc unsigned Count);
47*0a6a1f1dSLionel Sambuc
48*0a6a1f1dSLionel Sambuc void LLVMAddNamedMetadataOperand2(LLVMModuleRef M, const char *name,
49*0a6a1f1dSLionel Sambuc LLVMMetadataRef Val);
50*0a6a1f1dSLionel Sambuc void LLVMSetMetadata2(LLVMValueRef Inst, unsigned KindID, LLVMMetadataRef MD);
51*0a6a1f1dSLionel Sambuc
52*0a6a1f1dSLionel Sambuc void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef MD, LLVMMetadataRef New);
53*0a6a1f1dSLionel Sambuc
54*0a6a1f1dSLionel Sambuc void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Bref, unsigned Line,
55*0a6a1f1dSLionel Sambuc unsigned Col, LLVMMetadataRef Scope,
56*0a6a1f1dSLionel Sambuc LLVMMetadataRef InlinedAt);
57*0a6a1f1dSLionel Sambuc
58*0a6a1f1dSLionel Sambuc #ifdef __cplusplus
59*0a6a1f1dSLionel Sambuc }
60*0a6a1f1dSLionel Sambuc
61*0a6a1f1dSLionel Sambuc namespace llvm {
62*0a6a1f1dSLionel Sambuc
DEFINE_ISA_CONVERSION_FUNCTIONS(Metadata,LLVMMetadataRef)63*0a6a1f1dSLionel Sambuc DEFINE_ISA_CONVERSION_FUNCTIONS(Metadata, LLVMMetadataRef)
64*0a6a1f1dSLionel Sambuc
65*0a6a1f1dSLionel Sambuc inline Metadata **unwrap(LLVMMetadataRef *Vals) {
66*0a6a1f1dSLionel Sambuc return reinterpret_cast<Metadata**>(Vals);
67*0a6a1f1dSLionel Sambuc }
68*0a6a1f1dSLionel Sambuc
69*0a6a1f1dSLionel Sambuc }
70*0a6a1f1dSLionel Sambuc
71*0a6a1f1dSLionel Sambuc #endif
72*0a6a1f1dSLionel Sambuc
73*0a6a1f1dSLionel Sambuc #endif
74