diff options
author | Min-Yih Hsu <minyihh@uci.edu> | 2021-03-07 16:31:39 -0800 |
---|---|---|
committer | Min-Yih Hsu <minyihh@uci.edu> | 2021-03-08 12:30:57 -0800 |
commit | 6dcc325ce04541a766bef8217d7063ab2063caf0 (patch) | |
tree | 0e151db42ee922d088945174a7508d7c5ab45fda /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 503343191e12ccb9dad7e89072cd3e897caf4c2d (diff) | |
download | llvm-6dcc325ce04541a766bef8217d7063ab2063caf0.zip llvm-6dcc325ce04541a766bef8217d7063ab2063caf0.tar.gz llvm-6dcc325ce04541a766bef8217d7063ab2063caf0.tar.bz2 |
[M68k][MIR](2/8) Changes in the target-independent MIR part
- Add new callback in `TargetInstrInfo` --
`isPCRelRegisterOperandLegal` -- to query whether pc-rel
register MachineOperand is legal.
- Add new function to search DebugLoc in a reverse ordering
Authors: myhsu, m4yers, glaubitz
Differential Revision: https://reviews.llvm.org/D88386
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 8ed1701..f31eae9 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -1401,6 +1401,14 @@ MachineBasicBlock::findDebugLoc(instr_iterator MBBI) { return {}; } +DebugLoc MachineBasicBlock::rfindDebugLoc(reverse_instr_iterator MBBI) { + // Skip debug declarations, we don't want a DebugLoc from them. + MBBI = skipDebugInstructionsBackward(MBBI, instr_rbegin()); + if (!MBBI->isDebugInstr()) + return MBBI->getDebugLoc(); + return {}; +} + /// Find the previous valid DebugLoc preceding MBBI, skipping and DBG_VALUE /// instructions. Return UnknownLoc if there is none. DebugLoc MachineBasicBlock::findPrevDebugLoc(instr_iterator MBBI) { @@ -1411,6 +1419,16 @@ DebugLoc MachineBasicBlock::findPrevDebugLoc(instr_iterator MBBI) { return {}; } +DebugLoc MachineBasicBlock::rfindPrevDebugLoc(reverse_instr_iterator MBBI) { + if (MBBI == instr_rend()) + return {}; + // Skip debug declarations, we don't want a DebugLoc from them. + MBBI = next_nodbg(MBBI, instr_rend()); + if (MBBI != instr_rend()) + return MBBI->getDebugLoc(); + return {}; +} + /// Find and return the merged DebugLoc of the branch instructions of the block. /// Return UnknownLoc if there is none. DebugLoc |