Skip to content

Commit de25392

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 383e429 commit de25392

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
@@ -1443,6 +1443,7 @@ def STDWPtrQRr : Pseudo<(outs),
14431443
// Load program memory operations.
14441444
let canFoldAsLoad = 1,
14451445
isReMaterializable = 1,
1446+
mayLoad = 1,
14461447
hasSideEffects = 0 in
14471448
{
14481449
let Defs = [R0],
@@ -1469,8 +1470,7 @@ hasSideEffects = 0 in
14691470
Requires<[HasLPMX]>;
14701471

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

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

0 commit comments

Comments
 (0)