LLVM 23.0.0git
AssignGUID.h
Go to the documentation of this file.
1//===-- AssignGUID.h - Unique identifier assignment pass --------*- C++ -*-===//
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 provides a pass which assigns a a GUID (globally unique identifier)
10// to every GlobalValue in the module, according to its current name, linkage,
11// and originating file. This way we have a consistent identifier even when
12// these inputs to the GUID change (for instance, after externalising a global
13// in ThinLTO).
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_TRANSFORMS_UTILS_ASSIGNGUID_H
18#define LLVM_TRANSFORMS_UTILS_ASSIGNGUID_H
19
21#include "llvm/IR/LLVMContext.h"
22#include "llvm/IR/Module.h"
23#include "llvm/IR/PassManager.h"
24#include "llvm/Support/Debug.h"
25
26namespace llvm {
27
28class AssignGUIDPass : public PassInfoMixin<AssignGUIDPass> {
29public:
30 AssignGUIDPass() = default;
31
32 static void runOnModule(Module &M);
33
38
39 static bool isRequired() { return true; }
40
41 // Let GlobalMerge assign a GUID for merged GVs, instead of needing to
42 // traverse all the module; or instead of making GlobalValue::assignGUID
43 // public.
45};
46
47} // end namespace llvm
48
49#endif // LLVM_TRANSFORMS_UTILS_ASSIGNGUID_H
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
static void assignGUIDForMergedGV(GlobalVariable &GV)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition AssignGUID.h:34
static bool isRequired()
Definition AssignGUID.h:39
static void runOnModule(Module &M)
AssignGUIDPass()=default
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition PassManager.h:89