Skip to content

Commit 991ecce

Browse files
committed
[AVR] Add ISel pattern which maches load-from-global, compile it to
LPMRdZ (avr-rust/rust-legacy-fork#47, avr-rust/rust-legacy-fork#48)
1 parent b2a14c0 commit 991ecce

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/Target/AVR/AVRInstrInfo.td

+5-2
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,7 @@ def STDWPtrQRr : Pseudo<(outs),
14421442
// Load program memory operations.
14431443
let canFoldAsLoad = 1,
14441444
isReMaterializable = 1,
1445+
mayLoad = 1,
14451446
hasSideEffects = 0 in
14461447
{
14471448
let Defs = [R0],
@@ -1468,8 +1469,7 @@ hasSideEffects = 0 in
14681469
Requires<[HasLPMX]>;
14691470

14701471
// Load program memory, while postincrementing the Z register.
1471-
let mayLoad = 1,
1472-
Defs = [R31R30] in
1472+
let Defs = [R31R30] in
14731473
{
14741474
def LPMRdZPi : FLPMX<0,
14751475
1,
@@ -2032,6 +2032,9 @@ def Asr16 : ShiftPseudo<
20322032
// Non-Instruction Patterns
20332033
//===----------------------------------------------------------------------===//
20342034

2035+
def : Pat<(load (add i16:$offset, (AVRWrapper tglobaladdr:$base))),
2036+
(LPMRdZ (SUBIWRdK i16:$offset, tglobaladdr:$base))>;
2037+
20352038
//:TODO: look in x86InstrCompiler.td for odd encoding trick related to
20362039
// add x, 128 -> sub x, -128. Clang is emitting an eor for this (ldi+eor)
20372040

0 commit comments

Comments
 (0)