Skip to content

[NFC][Support] Move ModRef/MemoryEffects printers to their own file #105367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/Support/ModRef.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===--- ModRef.h - Memory effect modelling ---------------------*- C++ -*-===//
//===--- ModRef.h - Memory effect modeling ----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down
36 changes: 0 additions & 36 deletions llvm/lib/Analysis/AliasAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,42 +423,6 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, AliasResult AR) {
return OS;
}

raw_ostream &llvm::operator<<(raw_ostream &OS, ModRefInfo MR) {
switch (MR) {
case ModRefInfo::NoModRef:
OS << "NoModRef";
break;
case ModRefInfo::Ref:
OS << "Ref";
break;
case ModRefInfo::Mod:
OS << "Mod";
break;
case ModRefInfo::ModRef:
OS << "ModRef";
break;
}
return OS;
}

raw_ostream &llvm::operator<<(raw_ostream &OS, MemoryEffects ME) {
for (IRMemLocation Loc : MemoryEffects::locations()) {
switch (Loc) {
case IRMemLocation::ArgMem:
OS << "ArgMem: ";
break;
case IRMemLocation::InaccessibleMem:
OS << "InaccessibleMem: ";
break;
case IRMemLocation::Other:
OS << "Other: ";
break;
}
OS << ME.getModRef(Loc) << ", ";
}
return OS;
}

//===----------------------------------------------------------------------===//
// Helper method implementation
//===----------------------------------------------------------------------===//
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ add_llvm_component_library(LLVMSupport
MemAlloc.cpp
MemoryBuffer.cpp
MemoryBufferRef.cpp
ModRef.cpp
MD5.cpp
MSP430Attributes.cpp
MSP430AttributeParser.cpp
Expand Down
51 changes: 51 additions & 0 deletions llvm/lib/Support/ModRef.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//===--- ModRef.cpp - Memory effect modeling --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements ModRef and MemoryEffects misc functions.
//
//===----------------------------------------------------------------------===//

#include "llvm/Support/ModRef.h"

using namespace llvm;

raw_ostream &llvm::operator<<(raw_ostream &OS, ModRefInfo MR) {
switch (MR) {
case ModRefInfo::NoModRef:
OS << "NoModRef";
break;
case ModRefInfo::Ref:
OS << "Ref";
break;
case ModRefInfo::Mod:
OS << "Mod";
break;
case ModRefInfo::ModRef:
OS << "ModRef";
break;
}
return OS;
}

raw_ostream &llvm::operator<<(raw_ostream &OS, MemoryEffects ME) {
for (IRMemLocation Loc : MemoryEffects::locations()) {
switch (Loc) {
case IRMemLocation::ArgMem:
OS << "ArgMem: ";
break;
case IRMemLocation::InaccessibleMem:
OS << "InaccessibleMem: ";
break;
case IRMemLocation::Other:
OS << "Other: ";
break;
}
OS << ME.getModRef(Loc) << ", ";
}
return OS;
}
Loading