Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
Comdat.cpp
Go to the documentation of this file.
1//===- Comdat.cpp - Implement Metadata classes ----------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the Comdat class (including the C bindings).
10//
11//===----------------------------------------------------------------------===//
12
13#include "llvm-c/Comdat.h"
16#include "llvm/ADT/StringRef.h"
17#include "llvm/IR/Comdat.h"
19#include "llvm/IR/Module.h"
20#include "llvm/IR/Value.h"
21
22using namespace llvm;
23
24Comdat::Comdat(Comdat &&C) : Name(C.Name), SK(C.SK) {}
25
26Comdat::Comdat() = default;
27
28StringRef Comdat::getName() const { return Name->first(); }
29
30void Comdat::addUser(GlobalObject *GO) { Users.insert(GO); }
31
32void Comdat::removeUser(GlobalObject *GO) { Users.erase(GO); }
33
35 return wrap(unwrap(M)->getOrInsertComdat(Name));
36}
37
42
47
63
This file defines the StringMapEntry class - it is intended to be a low dependency implementation det...
Module.h This file contains the declarations for the Module class.
iv Induction Variable Users
Definition IVUsers.cpp:48
#define G(x, y, z)
Definition MD5.cpp:56
This file defines the SmallPtrSet class.
Comdat(const Comdat &)=delete
LLVM_ABI StringRef getName() const
Definition Comdat.cpp:28
@ Largest
The linker will choose the largest COMDAT.
Definition Comdat.h:39
@ SameSize
The data referenced by the COMDAT must be the same size.
Definition Comdat.h:41
@ Any
The linker may choose any COMDAT.
Definition Comdat.h:37
@ NoDeduplicate
No deduplication is performed.
Definition Comdat.h:40
@ ExactMatch
The data referenced by the COMDAT must be the same.
Definition Comdat.h:38
void setSelectionKind(SelectionKind Val)
Definition Comdat.h:48
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
LLVM_C_ABI void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C)
Assign the Comdat to the given global object.
Definition Comdat.cpp:43
LLVM_C_ABI LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C)
Definition Comdat.cpp:48
LLVM_C_ABI void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind)
Definition Comdat.cpp:64
LLVMComdatSelectionKind
Definition Comdat.h:30
LLVM_C_ABI LLVMComdatRef LLVMGetComdat(LLVMValueRef V)
Get the Comdat assigned to the given global object.
Definition Comdat.cpp:38
LLVM_C_ABI LLVMComdatRef LLVMGetOrInsertComdat(LLVMModuleRef M, const char *Name)
Return the Comdat in the module with the specified name.
Definition Comdat.cpp:34
@ LLVMLargestComdatSelectionKind
The linker will choose the largest COMDAT.
Definition Comdat.h:34
@ LLVMSameSizeComdatSelectionKind
The data referenced by the COMDAT must be the same size.
Definition Comdat.h:37
@ LLVMExactMatchComdatSelectionKind
The data referenced by the COMDAT must be the same.
Definition Comdat.h:32
@ LLVMAnyComdatSelectionKind
The linker may choose any COMDAT.
Definition Comdat.h:31
@ LLVMNoDeduplicateComdatSelectionKind
No deduplication is performed.
Definition Comdat.h:36
struct LLVMOpaqueValue * LLVMValueRef
Represents an individual value in LLVM IR.
Definition Types.h:75
struct LLVMComdat * LLVMComdatRef
Definition Types.h:155
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition Types.h:61
This file contains the declaration of the Comdat class, which represents a single COMDAT in LLVM.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Attribute unwrap(LLVMAttributeRef Attr)
Definition Attributes.h:351
LLVMAttributeRef wrap(Attribute Attr)
Definition Attributes.h:346