xref: /freebsd/contrib/llvm-project/llvm/include/llvm-c/Comdat.h (revision f7c32ed617858bcd22f8d1b03199099d50125721)
1 /*===-- llvm-c/Comdat.h - Module Comdat C Interface -------------*- C++ -*-===*\
2 |*                                                                            *|
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
4 |* Exceptions.                                                                *|
5 |* See https://llvm.org/LICENSE.txt for license information.                  *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
7 |*                                                                            *|
8 |*===----------------------------------------------------------------------===*|
9 |*                                                                            *|
10 |* This file defines the C interface to COMDAT.                               *|
11 |*                                                                            *|
12 \*===----------------------------------------------------------------------===*/
13 
14 #ifndef LLVM_C_COMDAT_H
15 #define LLVM_C_COMDAT_H
16 
17 #include "llvm-c/ExternC.h"
18 #include "llvm-c/Types.h"
19 
20 LLVM_C_EXTERN_C_BEGIN
21 
22 typedef enum {
23   LLVMAnyComdatSelectionKind,        ///< The linker may choose any COMDAT.
24   LLVMExactMatchComdatSelectionKind, ///< The data referenced by the COMDAT must
25                                      ///< be the same.
26   LLVMLargestComdatSelectionKind,    ///< The linker will choose the largest
27                                      ///< COMDAT.
28   LLVMNoDeduplicateComdatSelectionKind, ///< No deduplication is performed.
29   LLVMSameSizeComdatSelectionKind ///< The data referenced by the COMDAT must be
30                                   ///< the same size.
31 } LLVMComdatSelectionKind;
32 
33 /**
34  * Return the Comdat in the module with the specified name. It is created
35  * if it didn't already exist.
36  *
37  * @see llvm::Module::getOrInsertComdat()
38  */
39 LLVMComdatRef LLVMGetOrInsertComdat(LLVMModuleRef M, const char *Name);
40 
41 /**
42  * Get the Comdat assigned to the given global object.
43  *
44  * @see llvm::GlobalObject::getComdat()
45  */
46 LLVMComdatRef LLVMGetComdat(LLVMValueRef V);
47 
48 /**
49  * Assign the Comdat to the given global object.
50  *
51  * @see llvm::GlobalObject::setComdat()
52  */
53 void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C);
54 
55 /*
56  * Get the conflict resolution selection kind for the Comdat.
57  *
58  * @see llvm::Comdat::getSelectionKind()
59  */
60 LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C);
61 
62 /*
63  * Set the conflict resolution selection kind for the Comdat.
64  *
65  * @see llvm::Comdat::setSelectionKind()
66  */
67 void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind);
68 
69 LLVM_C_EXTERN_C_END
70 
71 #endif
72