blob: 499996d68a53cb9fe5d5cbe6e1bf8e6174393bc2 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001/*===-- llvm-c/Comdat.h - Module Comdat C Interface -------------*- C++ -*-===*\
2|* *|
3|* The LLVM Compiler Infrastructure *|
4|* *|
5|* This file is distributed under the University of Illinois Open Source *|
6|* License. See LICENSE.TXT for details. *|
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/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