Skip to content

Commit c96dd58

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 516f621 commit c96dd58

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
@@ -1417,6 +1417,7 @@ def STDWPtrQRr : Pseudo<(outs),
14171417
// Load program memory operations.
14181418
let canFoldAsLoad = 1,
14191419
isReMaterializable = 1,
1420+
mayLoad = 1,
14201421
hasSideEffects = 0 in
14211422
{
14221423
let Defs = [R0],
@@ -1437,8 +1438,7 @@ hasSideEffects = 0 in
14371438
Requires<[HasLPMX]>;
14381439

14391440
// Load program memory, while postincrementing the Z register.
1440-
let mayLoad = 1,
1441-
Defs = [R31R30] in
1441+
let Defs = [R31R30] in
14421442
{
14431443
def LPMRdZPi : FLPMX<0,
14441444
1,
@@ -2007,6 +2007,9 @@ def Asr16 : ShiftPseudo<
20072007
// Non-Instruction Patterns
20082008
//===----------------------------------------------------------------------===//
20092009

2010+
def : Pat<(load (add i16:$offset, (AVRWrapper tglobaladdr:$base))),
2011+
(LPMRdZ (SUBIWRdK i16:$offset, tglobaladdr:$base))>;
2012+
20102013
//:TODO: look in x86InstrCompiler.td for odd encoding trick related to
20112014
// add x, 128 -> sub x, -128. Clang is emitting an eor for this (ldi+eor)
20122015

0 commit comments

Comments
 (0)