Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 56462c5

Browse files
pftbestarielb1
authored andcommitted
[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
1 parent e34a7e8 commit 56462c5

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

lib/Target/MSP430/MSP430ISelDAGToDAG.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,12 @@ void MSP430DAGToDAGISel::Select(SDNode *Node) {
401401
int FI = cast<FrameIndexSDNode>(Node)->getIndex();
402402
SDValue TFI = CurDAG->getTargetFrameIndex(FI, MVT::i16);
403403
if (Node->hasOneUse()) {
404-
CurDAG->SelectNodeTo(Node, MSP430::ADD16ri, MVT::i16, TFI,
404+
CurDAG->SelectNodeTo(Node, MSP430::ADDframe, MVT::i16, TFI,
405405
CurDAG->getTargetConstant(0, dl, MVT::i16));
406406
return;
407407
}
408408
ReplaceNode(Node, CurDAG->getMachineNode(
409-
MSP430::ADD16ri, dl, MVT::i16, TFI,
409+
MSP430::ADDframe, dl, MVT::i16, TFI,
410410
CurDAG->getTargetConstant(0, dl, MVT::i16)));
411411
return;
412412
}

lib/Target/MSP430/MSP430InstrInfo.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ def ADJCALLSTACKUP : Pseudo<(outs), (ins i16imm:$amt1, i16imm:$amt2),
121121
[(MSP430callseq_end timm:$amt1, timm:$amt2)]>;
122122
}
123123

124+
let Defs = [SR], Uses = [SP] in {
125+
def ADDframe : Pseudo<(outs GR16:$dst), (ins i16imm:$base, i16imm:$offset),
126+
"# ADDframe PSEUDO", []>;
127+
}
128+
124129
let usesCustomInserter = 1 in {
125130
let Uses = [SR] in {
126131
def Select8 : Pseudo<(outs GR8:$dst), (ins GR8:$src, GR8:$src2, i8imm:$cc),

lib/Target/MSP430/MSP430RegisterInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
127127
// Fold imm into offset
128128
Offset += MI.getOperand(FIOperandNum + 1).getImm();
129129

130-
if (MI.getOpcode() == MSP430::ADD16ri) {
130+
if (MI.getOpcode() == MSP430::ADDframe) {
131131
// This is actually "load effective address" of the stack slot
132132
// instruction. We have only two-address instructions, thus we need to
133133
// expand it into mov + add

test/CodeGen/MSP430/vararg.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc < %s | FileCheck %s
1+
; RUN: llc -verify-machineinstrs < %s | FileCheck %s
22

33
target datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"
44
target triple = "msp430---elf"

0 commit comments

Comments
 (0)