blob: 45b4007695fdcb5f2d7e16377b1fd6b88fccfda7 [file] [log] [blame]
Reid Klecknere66458a2018-03-14 18:33:53 +00001/*===-- llvm-c/Comdat.h - Module Comdat C Interface -------------*- C++ -*-===*\
2|* *|
Chandler Carruth2946cd72019-01-19 08:50:56 +00003|* 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 *|
Reid Klecknere66458a2018-03-14 18:33:53 +00007|* *|
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
Duncan P. N. Exon Smith8c484052019-11-14 13:57:57 -080017#include "llvm-c/ExternC.h"
Reid Klecknere66458a2018-03-14 18:33:53 +000018#include "llvm-c/Types.h"
19
Duncan P. N. Exon Smith8c484052019-11-14 13:57:57 -080020LLVM_C_EXTERN_C_BEGIN
Reid Klecknere66458a2018-03-14 18:33:53 +000021
22typedef 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 LLVMNoDuplicatesComdatSelectionKind, ///< No other Module may specify this
29 ///< COMDAT.
30 LLVMSameSizeComdatSelectionKind ///< The data referenced by the COMDAT must be
31 ///< the same size.
32} LLVMComdatSelectionKind;
33
34/**
35 * Return the Comdat in the module with the specified name. It is created
36 * if it didn't already exist.
37 *
38 * @see llvm::Module::getOrInsertComdat()
39 */
40LLVMComdatRef LLVMGetOrInsertComdat(LLVMModuleRef M, const char *Name);
41
42/**
43 * Get the Comdat assigned to the given global object.
44 *
45 * @see llvm::GlobalObject::getComdat()
46 */
47LLVMComdatRef LLVMGetComdat(LLVMValueRef V);
48
49/**
50 * Assign the Comdat to the given global object.
51 *
52 * @see llvm::GlobalObject::setComdat()
53 */
54void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C);
55
56/*
57 * Get the conflict resolution selection kind for the Comdat.
58 *
59 * @see llvm::Comdat::getSelectionKind()
60 */
61LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C);
62
63/*
64 * Set the conflict resolution selection kind for the Comdat.
65 *
66 * @see llvm::Comdat::setSelectionKind()
67 */
68void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind);
69
Duncan P. N. Exon Smith8c484052019-11-14 13:57:57 -080070LLVM_C_EXTERN_C_END
Reid Klecknere66458a2018-03-14 18:33:53 +000071
72#endif