Skip to content

Commit b63a93b

Browse files
authored
[MIR] Add some new functions
1 parent 706c610 commit b63a93b

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed

llvm/include/llvm/CodeGen/MachineBasicBlock.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,12 @@ class MachineBasicBlock
11391139
void dump() const;
11401140
void print(raw_ostream &OS, const SlotIndexes * = nullptr,
11411141
bool IsStandalone = true) const;
1142+
void println(raw_ostream &OS, const SlotIndexes * = nullptr,
1143+
bool IsStandalone = true) const;
11421144
void print(raw_ostream &OS, ModuleSlotTracker &MST,
11431145
const SlotIndexes * = nullptr, bool IsStandalone = true) const;
1146+
void println(raw_ostream &OS, ModuleSlotTracker &MST,
1147+
const SlotIndexes * = nullptr, bool IsStandalone = true) const;
11441148

11451149
enum PrintNameFlag {
11461150
PrintNameIr = (1 << 0), ///< Add IR name where available

llvm/include/llvm/CodeGen/MachineInstr.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,10 +1797,17 @@ class MachineInstr
17971797
void print(raw_ostream &OS, bool IsStandalone = true, bool SkipOpers = false,
17981798
bool SkipDebugLoc = false, bool AddNewLine = true,
17991799
const TargetInstrInfo *TII = nullptr) const;
1800+
void println(raw_ostream &OS, bool IsStandalone = true, bool SkipOpers = false,
1801+
bool SkipDebugLoc = false, bool AddNewLine = true,
1802+
const TargetInstrInfo *TII = nullptr) const;
18001803
void print(raw_ostream &OS, ModuleSlotTracker &MST, bool IsStandalone = true,
18011804
bool SkipOpers = false, bool SkipDebugLoc = false,
18021805
bool AddNewLine = true,
18031806
const TargetInstrInfo *TII = nullptr) const;
1807+
void println(raw_ostream &OS, ModuleSlotTracker &MST, bool IsStandalone = true,
1808+
bool SkipOpers = false, bool SkipDebugLoc = false,
1809+
bool AddNewLine = true,
1810+
const TargetInstrInfo *TII = nullptr) const;
18041811
void dump() const;
18051812
/// Print on dbgs() the current instruction and the instructions defining its
18061813
/// operands and so on until we reach \p MaxDepth.

llvm/lib/CodeGen/MachineBasicBlock.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ std::string MachineBasicBlock::getFullName() const {
334334
return Name;
335335
}
336336

337+
void MachineBasicBlock::println(raw_ostream &OS, const SlotIndexes *Indexes,
338+
bool IsStandalone) const {
339+
print(OS, Indexes, IsStandalone);
340+
OS << "\n";
341+
}
342+
337343
void MachineBasicBlock::print(raw_ostream &OS, const SlotIndexes *Indexes,
338344
bool IsStandalone) const {
339345
const MachineFunction *MF = getParent();
@@ -463,6 +469,13 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST,
463469
}
464470
}
465471

472+
void MachineBasicBlock::println(raw_ostream &OS, ModuleSlotTracker &MST,
473+
const SlotIndexes *Indexes,
474+
bool IsStandalone) const {
475+
print(OS, MST, Indexes, IsStandalone);
476+
OS << "\n";
477+
}
478+
466479
/// Print the basic block's name as:
467480
///
468481
/// bb.{number}[.{ir-name}] [(attributes...)]

llvm/lib/CodeGen/MachineFunction.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,12 @@ void MachineFunction::print(raw_ostream &OS, const SlotIndexes *Indexes) const {
632632
OS << "\n# End machine code for function " << getName() << ".\n\n";
633633
}
634634

635+
void MachineFunction::println(raw_ostream &OS,
636+
const SlotIndexes *Indexes) const {
637+
print(OS, Indexes);
638+
OS << "\n";
639+
}
640+
635641
/// True if this function needs frame moves for debug or exceptions.
636642
bool MachineFunction::needsFrameMoves() const {
637643
return getMMI().hasDebugInfo() ||

llvm/lib/CodeGen/MachineInstr.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,13 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
19331933
OS << '\n';
19341934
}
19351935

1936+
void MachineInstr::println(raw_ostream &OS, ModuleSlotTracker &MST,
1937+
bool IsStandalone, bool SkipOpers, bool SkipDebugLoc,
1938+
bool AddNewLine, const TargetInstrInfo *TII) const {
1939+
print(OS, MST, IsStandalone, SkipOpers, SkipDebugLoc, AddNewLine, TII);
1940+
OS << "\n";
1941+
}
1942+
19361943
bool MachineInstr::addRegisterKilled(Register IncomingReg,
19371944
const TargetRegisterInfo *RegInfo,
19381945
bool AddIfNotFound) {

0 commit comments

Comments
 (0)