xref: /freebsd-src/contrib/llvm-project/llvm/include/llvm-c/Comdat.h (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
10b57cec5SDimitry Andric /*===-- llvm-c/Comdat.h - Module Comdat C Interface -------------*- C++ -*-===*\
20b57cec5SDimitry Andric |*                                                                            *|
30b57cec5SDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
40b57cec5SDimitry Andric |* Exceptions.                                                                *|
50b57cec5SDimitry Andric |* See https://llvm.org/LICENSE.txt for license information.                  *|
60b57cec5SDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
70b57cec5SDimitry Andric |*                                                                            *|
80b57cec5SDimitry Andric |*===----------------------------------------------------------------------===*|
90b57cec5SDimitry Andric |*                                                                            *|
100b57cec5SDimitry Andric |* This file defines the C interface to COMDAT.                               *|
110b57cec5SDimitry Andric |*                                                                            *|
120b57cec5SDimitry Andric \*===----------------------------------------------------------------------===*/
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef LLVM_C_COMDAT_H
150b57cec5SDimitry Andric #define LLVM_C_COMDAT_H
160b57cec5SDimitry Andric 
17480093f4SDimitry Andric #include "llvm-c/ExternC.h"
180b57cec5SDimitry Andric #include "llvm-c/Types.h"
190b57cec5SDimitry Andric 
20480093f4SDimitry Andric LLVM_C_EXTERN_C_BEGIN
210b57cec5SDimitry Andric 
22*349cc55cSDimitry Andric /**
23*349cc55cSDimitry Andric  * @defgroup LLVMCCoreComdat Comdats
24*349cc55cSDimitry Andric  * @ingroup LLVMCCore
25*349cc55cSDimitry Andric  *
26*349cc55cSDimitry Andric  * @{
27*349cc55cSDimitry Andric  */
28*349cc55cSDimitry Andric 
290b57cec5SDimitry Andric typedef enum {
300b57cec5SDimitry Andric   LLVMAnyComdatSelectionKind,        ///< The linker may choose any COMDAT.
310b57cec5SDimitry Andric   LLVMExactMatchComdatSelectionKind, ///< The data referenced by the COMDAT must
320b57cec5SDimitry Andric                                      ///< be the same.
330b57cec5SDimitry Andric   LLVMLargestComdatSelectionKind,    ///< The linker will choose the largest
340b57cec5SDimitry Andric                                      ///< COMDAT.
35fe6060f1SDimitry Andric   LLVMNoDeduplicateComdatSelectionKind, ///< No deduplication is performed.
360b57cec5SDimitry Andric   LLVMSameSizeComdatSelectionKind ///< The data referenced by the COMDAT must be
370b57cec5SDimitry Andric                                   ///< the same size.
380b57cec5SDimitry Andric } LLVMComdatSelectionKind;
390b57cec5SDimitry Andric 
400b57cec5SDimitry Andric /**
410b57cec5SDimitry Andric  * Return the Comdat in the module with the specified name. It is created
420b57cec5SDimitry Andric  * if it didn't already exist.
430b57cec5SDimitry Andric  *
440b57cec5SDimitry Andric  * @see llvm::Module::getOrInsertComdat()
450b57cec5SDimitry Andric  */
460b57cec5SDimitry Andric LLVMComdatRef LLVMGetOrInsertComdat(LLVMModuleRef M, const char *Name);
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric /**
490b57cec5SDimitry Andric  * Get the Comdat assigned to the given global object.
500b57cec5SDimitry Andric  *
510b57cec5SDimitry Andric  * @see llvm::GlobalObject::getComdat()
520b57cec5SDimitry Andric  */
530b57cec5SDimitry Andric LLVMComdatRef LLVMGetComdat(LLVMValueRef V);
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric /**
560b57cec5SDimitry Andric  * Assign the Comdat to the given global object.
570b57cec5SDimitry Andric  *
580b57cec5SDimitry Andric  * @see llvm::GlobalObject::setComdat()
590b57cec5SDimitry Andric  */
600b57cec5SDimitry Andric void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C);
610b57cec5SDimitry Andric 
620b57cec5SDimitry Andric /*
630b57cec5SDimitry Andric  * Get the conflict resolution selection kind for the Comdat.
640b57cec5SDimitry Andric  *
650b57cec5SDimitry Andric  * @see llvm::Comdat::getSelectionKind()
660b57cec5SDimitry Andric  */
670b57cec5SDimitry Andric LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C);
680b57cec5SDimitry Andric 
690b57cec5SDimitry Andric /*
700b57cec5SDimitry Andric  * Set the conflict resolution selection kind for the Comdat.
710b57cec5SDimitry Andric  *
720b57cec5SDimitry Andric  * @see llvm::Comdat::setSelectionKind()
730b57cec5SDimitry Andric  */
740b57cec5SDimitry Andric void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind);
750b57cec5SDimitry Andric 
76*349cc55cSDimitry Andric /**
77*349cc55cSDimitry Andric  * @}
78*349cc55cSDimitry Andric  */
79*349cc55cSDimitry Andric 
80480093f4SDimitry Andric LLVM_C_EXTERN_C_END
810b57cec5SDimitry Andric 
820b57cec5SDimitry Andric #endif
83