[IR] Move GlobalValue::getGUID() out of line (NFC)

Avoid including MD5.h in a core IR header.
This commit is contained in:
Nikita Popov
2024-05-15 10:13:42 +09:00
parent 4d1ecf1923
commit 71fbbb69d6
5 changed files with 9 additions and 2 deletions

View File

@@ -24,7 +24,6 @@
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
#include <cassert>
#include <cstdint>
#include <string>
@@ -588,7 +587,7 @@ public:
/// Return a 64-bit global unique ID constructed from global value name
/// (i.e. returned by getGlobalIdentifier()).
static GUID getGUID(StringRef GlobalName) { return MD5Hash(GlobalName); }
static GUID getGUID(StringRef GlobalName);
/// Return a 64-bit global unique ID constructed from global value name
/// (i.e. returned by getGlobalIdentifier()).

View File

@@ -21,6 +21,7 @@
#include "llvm/IR/Module.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
#include "llvm/TargetParser/Triple.h"
using namespace llvm;
@@ -71,6 +72,10 @@ void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {
removeSanitizerMetadata();
}
GlobalValue::GUID GlobalValue::getGUID(StringRef GlobalName) {
return MD5Hash(GlobalName);
}
void GlobalValue::removeFromParent() {
switch (getValueID()) {
#define HANDLE_GLOBAL_VALUE(NAME) \

View File

@@ -22,6 +22,7 @@
#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MD5.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
using namespace llvm;

View File

@@ -53,6 +53,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/RandomNumberGenerator.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"

View File

@@ -18,6 +18,7 @@
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/xxhash.h"