Skip to content

Commit f3dcdf8

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

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
@@ -1199,10 +1199,10 @@ isReMaterializable = 1 in
11991199
//
12001200
// Expands to:
12011201
// ld Rd, P+
1202-
// ld Rd+1, P+
1202+
// ld Rd+1, P
12031203
let Constraints = "@earlyclobber $reg" in
12041204
def LDWRdPtr : Pseudo<(outs DREGS:$reg),
1205-
(ins PTRDISPREGS:$ptrreg),
1205+
(ins PTRREGS:$ptrreg),
12061206
"ldw\t$reg, $ptrreg",
12071207
[(set i16:$reg, (load i16:$ptrreg))]>,
12081208
Requires<[HasSRAM]>;
@@ -1211,7 +1211,7 @@ isReMaterializable = 1 in
12111211
// Indirect loads (with postincrement or predecrement).
12121212
let mayLoad = 1,
12131213
hasSideEffects = 0,
1214-
Constraints = "$ptrreg = $base_wb,@earlyclobber $reg,@earlyclobber $base_wb" in
1214+
Constraints = "$ptrreg = $base_wb,@earlyclobber $reg" in
12151215
{
12161216
def LDRdPtrPi : FSTLD<0,
12171217
0b01,

0 commit comments

Comments
 (0)