Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | /*===-- llvm-c/Comdat.h - Module Comdat C Interface -------------*- C++ -*-===*\ |
| 2 | |* *| |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 *| |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 17 | #include "llvm-c/ExternC.h" |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 18 | #include "llvm-c/Types.h" |
| 19 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 20 | LLVM_C_EXTERN_C_BEGIN |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 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 | 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 | */ |
| 40 | LLVMComdatRef 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 | */ |
| 47 | LLVMComdatRef LLVMGetComdat(LLVMValueRef V); |
| 48 | |
| 49 | /** |
| 50 | * Assign the Comdat to the given global object. |
| 51 | * |
| 52 | * @see llvm::GlobalObject::setComdat() |
| 53 | */ |
| 54 | void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C); |
| 55 | |
| 56 | /* |
| 57 | * Get the conflict resolution selection kind for the Comdat. |
| 58 | * |
| 59 | * @see llvm::Comdat::getSelectionKind() |
| 60 | */ |
| 61 | LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C); |
| 62 | |
| 63 | /* |
| 64 | * Set the conflict resolution selection kind for the Comdat. |
| 65 | * |
| 66 | * @see llvm::Comdat::setSelectionKind() |
| 67 | */ |
| 68 | void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind); |
| 69 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 70 | LLVM_C_EXTERN_C_END |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 71 | |
| 72 | #endif |