1 //===- IRBindings.h - Additional bindings for IR ----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines additional C bindings for the IR component.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_BINDINGS_GO_LLVM_IRBINDINGS_H
15 #define LLVM_BINDINGS_GO_LLVM_IRBINDINGS_H
17 #include "llvm-c/Core.h"
19 #include "llvm/IR/Metadata.h"
20 #include "llvm/Support/CBindingWrapping.h"
29 typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
31 // These functions duplicate the LLVM*FunctionAttr functions in the stable C
32 // API. We cannot use the existing functions because they take 32-bit attribute
33 // values, and the Go bindings expose all of the LLVM attributes, some of which
34 // have values >= 1<<32.
36 void LLVMAddFunctionAttr2(LLVMValueRef Fn, uint64_t PA);
37 uint64_t LLVMGetFunctionAttr2(LLVMValueRef Fn);
38 void LLVMRemoveFunctionAttr2(LLVMValueRef Fn, uint64_t PA);
40 LLVMMetadataRef LLVMConstantAsMetadata(LLVMValueRef Val);
42 LLVMMetadataRef LLVMMDString2(LLVMContextRef C, const char *Str, unsigned SLen);
43 LLVMMetadataRef LLVMMDNode2(LLVMContextRef C, LLVMMetadataRef *MDs,
45 LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef C, LLVMMetadataRef *MDs,
48 void LLVMAddNamedMetadataOperand2(LLVMModuleRef M, const char *name,
50 void LLVMSetMetadata2(LLVMValueRef Inst, unsigned KindID, LLVMMetadataRef MD);
52 void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef MD, LLVMMetadataRef New);
54 void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Bref, unsigned Line,
55 unsigned Col, LLVMMetadataRef Scope,
56 LLVMMetadataRef InlinedAt);
58 void LLVMSetSubprogram(LLVMValueRef Fn, LLVMMetadataRef SP);
65 DEFINE_ISA_CONVERSION_FUNCTIONS(Metadata, LLVMMetadataRef)
67 inline Metadata **unwrap(LLVMMetadataRef *Vals) {
68 return reinterpret_cast<Metadata**>(Vals);