blob: 81fee3fc9a6b4018a60fb1e95962a15b0b721c13 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001/*===-- llvm-c/Comdat.h - Module Comdat C Interface -------------*- C++ -*-===*\
2|* *|
Andrew Walbran16937d02019-10-22 13:54:20 +01003|* 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 *|
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01007|* *|
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/Types.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23typedef enum {
24 LLVMAnyComdatSelectionKind, ///< The linker may choose any COMDAT.
25 LLVMExactMatchComdatSelectionKind, ///< The data referenced by the COMDAT must
26 ///< be the same.
27 LLVMLargestComdatSelectionKind, ///< The linker will choose the largest
28 ///< COMDAT.
29 LLVMNoDuplicatesComdatSelectionKind, ///< No other Module may specify this
30 ///< COMDAT.
31 LLVMSameSizeComdatSelectionKind ///< The data referenced by the COMDAT must be
32 ///< the same size.
33} LLVMComdatSelectionKind;
34
35/**
36 * Return the Comdat in the module with the specified name. It is created
37 * if it didn't already exist.
38 *
39 * @see llvm::Module::getOrInsertComdat()
40 */
41LLVMComdatRef LLVMGetOrInsertComdat(LLVMModuleRef M, const char *Name);
42
43/**
44 * Get the Comdat assigned to the given global object.
45 *
46 * @see llvm::GlobalObject::getComdat()
47 */
48LLVMComdatRef LLVMGetComdat(LLVMValueRef V);
49
50/**
51 * Assign the Comdat to the given global object.
52 *
53 * @see llvm::GlobalObject::setComdat()
54 */
55void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C);
56
57/*
58 * Get the conflict resolution selection kind for the Comdat.
59 *
60 * @see llvm::Comdat::getSelectionKind()
61 */
62LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C);
63
64/*
65 * Set the conflict resolution selection kind for the Comdat.
66 *
67 * @see llvm::Comdat::setSelectionKind()
68 */
69void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind);
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif