[PATCH] D33452: [MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 08:08:42 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL303758: [MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex. (authored by dambrouski).

Changed prior to commit:
  https://reviews.llvm.org/D33452?vs=99957&id=100091#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33452

Files:
  llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
  llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td
  llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp
  llvm/trunk/test/CodeGen/MSP430/vararg.ll


Index: llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp
+++ llvm/trunk/lib/Target/MSP430/MSP430RegisterInfo.cpp
@@ -127,7 +127,7 @@
   // Fold imm into offset
   Offset += MI.getOperand(FIOperandNum + 1).getImm();
 
-  if (MI.getOpcode() == MSP430::ADD16ri) {
+  if (MI.getOpcode() == MSP430::ADDframe) {
     // This is actually "load effective address" of the stack slot
     // instruction. We have only two-address instructions, thus we need to
     // expand it into mov + add
Index: llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td
===================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td
+++ llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td
@@ -122,6 +122,11 @@
                               [(MSP430callseq_end timm:$amt1, timm:$amt2)]>;
 }
 
+let Defs = [SR], Uses = [SP] in {
+def ADDframe : Pseudo<(outs GR16:$dst), (ins i16imm:$base, i16imm:$offset),
+                      "# ADDframe PSEUDO", []>;
+}
+
 let usesCustomInserter = 1 in {
   let Uses = [SR] in {
   def Select8  : Pseudo<(outs GR8:$dst), (ins GR8:$src, GR8:$src2, i8imm:$cc),
Index: llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
===================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
+++ llvm/trunk/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp
@@ -403,12 +403,12 @@
     int FI = cast<FrameIndexSDNode>(Node)->getIndex();
     SDValue TFI = CurDAG->getTargetFrameIndex(FI, MVT::i16);
     if (Node->hasOneUse()) {
-      CurDAG->SelectNodeTo(Node, MSP430::ADD16ri, MVT::i16, TFI,
+      CurDAG->SelectNodeTo(Node, MSP430::ADDframe, MVT::i16, TFI,
                            CurDAG->getTargetConstant(0, dl, MVT::i16));
       return;
     }
     ReplaceNode(Node, CurDAG->getMachineNode(
-                          MSP430::ADD16ri, dl, MVT::i16, TFI,
+                          MSP430::ADDframe, dl, MVT::i16, TFI,
                           CurDAG->getTargetConstant(0, dl, MVT::i16)));
     return;
   }
Index: llvm/trunk/test/CodeGen/MSP430/vararg.ll
===================================================================
--- llvm/trunk/test/CodeGen/MSP430/vararg.ll
+++ llvm/trunk/test/CodeGen/MSP430/vararg.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs < %s | FileCheck %s
 
 target datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"
 target triple = "msp430---elf"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33452.100091.patch
Type: text/x-patch
Size: 2556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170524/92b2583c/attachment.bin>


More information about the llvm-commits mailing list