Skip to content

Commit 20dbe59

Browse files
vladimirradosavljevicakiramenai
authored andcommitted
[EraVM][EVM] Add renamable bit to copyPhysReg
Signed-off-by: Vladimir Radosavljevic <[email protected]>
1 parent 700b08b commit 20dbe59

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

llvm/lib/Target/EVM/EVMInstrInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ bool EVMInstrInfo::isReallyTriviallyReMaterializable(
3636
void EVMInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
3737
MachineBasicBlock::iterator I,
3838
const DebugLoc &DL, MCRegister DestReg,
39-
MCRegister SrcReg, bool KillSrc) const {
39+
MCRegister SrcReg, bool KillSrc,
40+
bool RenamableDest, bool RenamableSrc) const {
4041
// This method is called by post-RA expansion, which expects only
4142
// phys registers to exist. However we expect only virtual here.
4243
assert(Register::isVirtualRegister(DestReg) &&

llvm/lib/Target/EVM/EVMInstrInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class EVMInstrInfo final : public EVMGenInstrInfo {
4444

4545
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
4646
const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
47-
bool KillSrc) const override;
47+
bool KillSrc, bool RenamableDest = false,
48+
bool RenamableSrc = false) const override;
4849

4950
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
5051
MachineBasicBlock *&FBB,

llvm/lib/Target/EraVM/EraVMInstrInfo.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,13 +607,15 @@ MachineInstr *EraVMInstrInfo::insertDecSP(MachineBasicBlock &MBB,
607607
void EraVMInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
608608
MachineBasicBlock::iterator I,
609609
const DebugLoc &DL, MCRegister DestReg,
610-
MCRegister SrcReg, bool KillSrc) const {
610+
MCRegister SrcReg, bool KillSrc,
611+
bool RenamableDest, bool RenamableSrc) const {
611612
unsigned opcode = I->getFlag(MachineInstr::MIFlag::IsFatPtr)
612613
? EraVM::PTR_ADDrrr_s
613614
: EraVM::ADDrrr_s;
614615

615616
BuildMI(MBB, I, DL, get(opcode), DestReg)
616-
.addReg(SrcReg, getKillRegState(KillSrc))
617+
.addReg(SrcReg,
618+
getKillRegState(KillSrc) | getRenamableRegState(RenamableSrc))
617619
.addReg(EraVM::R0)
618620
.addImm(EraVMCC::COND_NONE);
619621
}

llvm/lib/Target/EraVM/EraVMInstrInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ class EraVMInstrInfo : public EraVMGenInstrInfo {
255255

256256
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
257257
const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
258-
bool KillSrc) const override;
258+
bool KillSrc, bool RenamableDest = false,
259+
bool RenamableSrc = false) const override;
259260

260261
void storeRegToStackSlot(MachineBasicBlock &MBB,
261262
MachineBasicBlock::iterator MI, Register SrcReg,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2+
# RUN: llc -x mir -run-pass postrapseudos -verify-machineinstrs -compile-twice=false < %s | FileCheck %s
3+
4+
--- |
5+
6+
target datalayout = "E-p:256:256-i256:256:256-S32-a:256:256"
7+
target triple = "eravm"
8+
9+
define void @test() { ret void }
10+
11+
...
12+
---
13+
name: test
14+
tracksRegLiveness: true
15+
body: |
16+
bb.0:
17+
liveins: $r2
18+
; CHECK-LABEL: name: test
19+
; CHECK: liveins: $r2
20+
; CHECK-NEXT: {{ $}}
21+
; CHECK-NEXT: $r1 = ADDrrr_s killed renamable $r2, $r0, 0
22+
; CHECK-NEXT: RET 0, implicit $r1
23+
renamable $r1 = COPY killed renamable $r2
24+
RET 0, implicit $r1

0 commit comments

Comments
 (0)