Skip to content

Commit e65b858

Browse files
committed
[AVR] Elaborate LDWRdPtr into ld r, X++; ld r+1, X
avr-rust/rust-legacy-fork#58
1 parent f614b2f commit e65b858

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/Target/AVR/AVRExpandPseudoInsts.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ bool AVRExpandPseudo::expand<AVR::LDWRdPtr>(Block &MBB, BlockIt MBBI) {
584584
unsigned TmpReg = 0; // 0 for no temporary register
585585
unsigned SrcReg = MI.getOperand(1).getReg();
586586
bool SrcIsKill = MI.getOperand(1).isKill();
587-
OpLo = AVR::LDRdPtr;
588-
OpHi = AVR::LDDRdPtrQ;
587+
OpLo = AVR::LDRdPtrPi;
588+
OpHi = AVR::LDRdPtr;
589589
TRI->splitReg(DstReg, DstLoReg, DstHiReg);
590590

591591
// Use a temporary register if src and dst registers are the same.
@@ -598,6 +598,7 @@ bool AVRExpandPseudo::expand<AVR::LDWRdPtr>(Block &MBB, BlockIt MBBI) {
598598
// Load low byte.
599599
auto MIBLO = buildMI(MBB, MBBI, OpLo)
600600
.addReg(CurDstLoReg, RegState::Define)
601+
.addReg(SrcReg, RegState::Define)
601602
.addReg(SrcReg);
602603

603604
// Push low byte onto stack if necessary.
@@ -607,8 +608,7 @@ bool AVRExpandPseudo::expand<AVR::LDWRdPtr>(Block &MBB, BlockIt MBBI) {
607608
// Load high byte.
608609
auto MIBHI = buildMI(MBB, MBBI, OpHi)
609610
.addReg(CurDstHiReg, RegState::Define)
610-
.addReg(SrcReg, getKillRegState(SrcIsKill))
611-
.addImm(1);
611+
.addReg(SrcReg, getKillRegState(SrcIsKill));
612612

613613
if (TmpReg) {
614614
// Move the high byte into the final destination.

lib/Target/AVR/AVRInstrInfo.td

+3-3
Original file line numberDiff line numberDiff line change
@@ -1200,10 +1200,10 @@ isReMaterializable = 1 in
12001200
//
12011201
// Expands to:
12021202
// ld Rd, P+
1203-
// ld Rd+1, P+
1203+
// ld Rd+1, P
12041204
let Constraints = "@earlyclobber $reg" in
12051205
def LDWRdPtr : Pseudo<(outs DREGS:$reg),
1206-
(ins PTRDISPREGS:$ptrreg),
1206+
(ins PTRREGS:$ptrreg),
12071207
"ldw\t$reg, $ptrreg",
12081208
[(set i16:$reg, (load i16:$ptrreg))]>,
12091209
Requires<[HasSRAM]>;
@@ -1212,7 +1212,7 @@ isReMaterializable = 1 in
12121212
// Indirect loads (with postincrement or predecrement).
12131213
let mayLoad = 1,
12141214
hasSideEffects = 0,
1215-
Constraints = "$ptrreg = $base_wb,@earlyclobber $reg,@earlyclobber $base_wb" in
1215+
Constraints = "$ptrreg = $base_wb,@earlyclobber $reg" in
12161216
{
12171217
def LDRdPtrPi : FSTLD<0,
12181218
0b01,

0 commit comments

Comments
 (0)