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#include "llvm-c/Visibility.h"
20
21LLVM_C_EXTERN_C_BEGIN
22
23/**
24 * @defgroup LLVMCCoreComdat Comdats
25 * @ingroup LLVMCCore
26 *
27 * @{
28 */
29
30typedef enum {
31 LLVMAnyComdatSelectionKind, ///< The linker may choose any COMDAT.
32 LLVMExactMatchComdatSelectionKind, ///< The data referenced by the COMDAT must
33 ///< be the same.
34 LLVMLargestComdatSelectionKind, ///< The linker will choose the largest
35 ///< COMDAT.
36 LLVMNoDeduplicateComdatSelectionKind, ///< No deduplication is performed.
37 LLVMSameSizeComdatSelectionKind ///< The data referenced by the COMDAT must be
38 ///< the same size.
39} LLVMComdatSelectionKind;
40
41/**
42 * Return the Comdat in the module with the specified name. It is created
43 * if it didn't already exist.
44 *
45 * @see llvm::Module::getOrInsertComdat()
46 */
47LLVM_C_ABI LLVMComdatRef LLVMGetOrInsertComdat(LLVMModuleRef M,
48 const char *Name);
49
50/**
51 * Get the Comdat assigned to the given global object.
52 *
53 * @see llvm::GlobalObject::getComdat()
54 */
55LLVM_C_ABI LLVMComdatRef LLVMGetComdat(LLVMValueRef V);
56
57/**
58 * Assign the Comdat to the given global object.
59 *
60 * @see llvm::GlobalObject::setComdat()
61 */
62LLVM_C_ABI void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C);
63
64/*
65 * Get the conflict resolution selection kind for the Comdat.
66 *
67 * @see llvm::Comdat::getSelectionKind()
68 */
69LLVM_C_ABI LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C);
70
71/*
72 * Set the conflict resolution selection kind for the Comdat.
73 *
74 * @see llvm::Comdat::setSelectionKind()
75 */
76LLVM_C_ABI void LLVMSetComdatSelectionKind(LLVMComdatRef C,
77 LLVMComdatSelectionKind Kind);
78
79/**
80 * @}
81 */
82
83LLVM_C_EXTERN_C_END
84
85#endif
86