llvm.org GIT mirror llvm / 6f94f45
[MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex. Use ADDframe pseudo instruction instead. This will fix machine verifier error, and will help to fix PR32146. Differential Revision: https://reviews.llvm.org/D33452 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303758 91177308-0d34-0410-b5e6-96231b3b80d8 Vadzim Dambrouski 3 years ago
4 changed file(s) with 9 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
402402 int FI = cast(Node)->getIndex();
403403 SDValue TFI = CurDAG->getTargetFrameIndex(FI, MVT::i16);
404404 if (Node->hasOneUse()) {
405 CurDAG->SelectNodeTo(Node, MSP430::ADD16ri, MVT::i16, TFI,
405 CurDAG->SelectNodeTo(Node, MSP430::ADDframe, MVT::i16, TFI,
406406 CurDAG->getTargetConstant(0, dl, MVT::i16));
407407 return;
408408 }
409409 ReplaceNode(Node, CurDAG->getMachineNode(
410 MSP430::ADD16ri, dl, MVT::i16, TFI,
410 MSP430::ADDframe, dl, MVT::i16, TFI,
411411 CurDAG->getTargetConstant(0, dl, MVT::i16)));
412412 return;
413413 }
119119 def ADJCALLSTACKUP : Pseudo<(outs), (ins i16imm:$amt1, i16imm:$amt2),
120120 "#ADJCALLSTACKUP",
121121 [(MSP430callseq_end timm:$amt1, timm:$amt2)]>;
122 }
123
124 let Defs = [SR], Uses = [SP] in {
125 def ADDframe : Pseudo<(outs GR16:$dst), (ins i16imm:$base, i16imm:$offset),
126 "# ADDframe PSEUDO", []>;
122127 }
123128
124129 let usesCustomInserter = 1 in {
126126 // Fold imm into offset
127127 Offset += MI.getOperand(FIOperandNum + 1).getImm();
128128
129 if (MI.getOpcode() == MSP430::ADD16ri) {
129 if (MI.getOpcode() == MSP430::ADDframe) {
130130 // This is actually "load effective address" of the stack slot
131131 // instruction. We have only two-address instructions, thus we need to
132132 // expand it into mov + add
None ; RUN: llc < %s | FileCheck %s
0 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s
11
22 target datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"
33 target triple = "msp430---elf"