LLVM 24.0.0git
SplitModuleCommon.cpp
Go to the documentation of this file.
1//===----- SplitModuleCommon.cpp - shared module splitting helpers --------===//
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 utilities shared by the module splitting
10// implementations (SplitModule, AMDGPUSplitModule, ...).
11//
12//===----------------------------------------------------------------------===//
13
15#include "llvm/IR/GlobalValue.h"
16
17using namespace llvm;
18
20 // Unnamed entities must be named consistently between modules. setName will
21 // give a distinct name to each such entity.
22 if (!GV.hasName())
23 GV.setName("__llvmsplit_externalize_unnamed");
24}
25
bool hasLocalLinkage() const
void setLinkage(LinkageTypes LT)
@ HiddenVisibility
The GV is hidden.
Definition GlobalValue.h:69
void setVisibility(VisibilityTypes V)
@ ExternalLinkage
Externally visible function.
Definition GlobalValue.h:53
LLVM_ABI void setName(const Twine &Name)
Change the name of the value.
Definition Value.cpp:394
bool hasName() const
Definition Value.h:263
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void nameUnnamedGlobalValue(GlobalValue &GV)
Assign a stable name to GV if it is unnamed, so that it is named consistently across the split partit...
LLVM_ABI void externalizeGlobal(GlobalValue &GV)
If GV has local linkage, promote it to external + hidden visibility so it can be referenced across mo...