1894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===- BlackfinInstrInfo.cpp - Blackfin Instruction Information -*- C++ -*-===//
2894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
3894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//                     The LLVM Compiler Infrastructure
4894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
5894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file is distributed under the University of Illinois Open Source
6894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// License. See LICENSE.TXT for details.
7894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
8894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
9894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
10894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman// This file contains the Blackfin implementation of the TargetInstrInfo class.
11894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//
12894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman//===----------------------------------------------------------------------===//
13894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
14894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "BlackfinInstrInfo.h"
15894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "BlackfinSubtarget.h"
16894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "Blackfin.h"
17894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/CodeGen/MachineRegisterInfo.h"
18894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/CodeGen/MachineInstrBuilder.h"
1919bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/ADT/STLExtras.h"
2019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/ADT/SmallVector.h"
21894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "llvm/Support/ErrorHandling.h"
2219bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#include "llvm/Support/TargetRegistry.h"
2319bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman
2419bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman#define GET_INSTRINFO_CTOR
25894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman#include "BlackfinGenInstrInfo.inc"
26894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
27894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanusing namespace llvm;
28894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
29894018228b0e0bdbd7aa7e8f47d4a9458789ca82John BaumanBlackfinInstrInfo::BlackfinInstrInfo(BlackfinSubtarget &ST)
3019bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman  : BlackfinGenInstrInfo(BF::ADJCALLSTACKDOWN, BF::ADJCALLSTACKUP),
31894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    RI(ST, *this),
32894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    Subtarget(ST) {}
33894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
34894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// isLoadFromStackSlot - If the specified machine instruction is a direct
35894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// load from a stack slot, return the virtual or physical register number of
36894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// the destination along with the FrameIndex of the loaded stack slot.  If
37894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// not, return 0.  This predicate must return 0 if the instruction has
38894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// any side effects other than loading from the stack slot.
39894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanunsigned BlackfinInstrInfo::isLoadFromStackSlot(const MachineInstr *MI,
40894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                                int &FrameIndex) const {
41894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  switch (MI->getOpcode()) {
42894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  default: break;
43894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  case BF::LOAD32fi:
44894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  case BF::LOAD16fi:
45894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    if (MI->getOperand(1).isFI() &&
46894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman        MI->getOperand(2).isImm() &&
47894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman        MI->getOperand(2).getImm() == 0) {
48894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FrameIndex = MI->getOperand(1).getIndex();
49894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return MI->getOperand(0).getReg();
50894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
51894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    break;
52894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
53894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  return 0;
54894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
55894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
56894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// isStoreToStackSlot - If the specified machine instruction is a direct
57894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// store to a stack slot, return the virtual or physical register number of
58894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// the source reg along with the FrameIndex of the loaded stack slot.  If
59894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// not, return 0.  This predicate must return 0 if the instruction has
60894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman/// any side effects other than storing to the stack slot.
61894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanunsigned BlackfinInstrInfo::isStoreToStackSlot(const MachineInstr *MI,
62894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                               int &FrameIndex) const {
63894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  switch (MI->getOpcode()) {
64894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  default: break;
65894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  case BF::STORE32fi:
66894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  case BF::STORE16fi:
67894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    if (MI->getOperand(1).isFI() &&
68894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman        MI->getOperand(2).isImm() &&
69894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman        MI->getOperand(2).getImm() == 0) {
70894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      FrameIndex = MI->getOperand(1).getIndex();
71894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return MI->getOperand(0).getReg();
72894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
73894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    break;
74894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
75894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  return 0;
76894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
77894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
78894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanunsigned BlackfinInstrInfo::
79894018228b0e0bdbd7aa7e8f47d4a9458789ca82John BaumanInsertBranch(MachineBasicBlock &MBB,
80894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman             MachineBasicBlock *TBB,
81894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman             MachineBasicBlock *FBB,
82894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman             const SmallVectorImpl<MachineOperand> &Cond,
83894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman             DebugLoc DL) const {
84894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  // Shouldn't be a fall through.
85894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  assert(TBB && "InsertBranch must not be told to insert a fallthrough");
86894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  assert((Cond.size() == 1 || Cond.size() == 0) &&
87894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman         "Branch conditions have one component!");
88894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
89894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (Cond.empty()) {
90894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    // Unconditional branch?
91894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    assert(!FBB && "Unconditional branch with multiple successors!");
92894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(&MBB, DL, get(BF::JUMPa)).addMBB(TBB);
93894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return 1;
94894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
95894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
96894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  // Conditional branch.
97894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  llvm_unreachable("Implement conditional branches!");
98894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
99894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
100894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanvoid BlackfinInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
101894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    MachineBasicBlock::iterator I, DebugLoc DL,
102894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    unsigned DestReg, unsigned SrcReg,
103894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                    bool KillSrc) const {
104894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (BF::ALLRegClass.contains(DestReg, SrcReg)) {
105894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::MOVE), DestReg)
106894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addReg(SrcReg, getKillRegState(KillSrc));
107894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
108894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
109894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
110894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (BF::D16RegClass.contains(DestReg, SrcReg)) {
111894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::SLL16i), DestReg)
112894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addReg(SrcReg, getKillRegState(KillSrc))
113894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addImm(0);
114894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
115894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
116894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
117894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (BF::DRegClass.contains(DestReg)) {
118894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    if (SrcReg == BF::NCC) {
119894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BuildMI(MBB, I, DL, get(BF::MOVENCC_z), DestReg)
120894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman        .addReg(SrcReg, getKillRegState(KillSrc));
121894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BuildMI(MBB, I, DL, get(BF::BITTGL), DestReg).addReg(DestReg).addImm(0);
122894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return;
123894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
124894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    if (SrcReg == BF::CC) {
125894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BuildMI(MBB, I, DL, get(BF::MOVECC_zext), DestReg)
126894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman        .addReg(SrcReg, getKillRegState(KillSrc));
127894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return;
128894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
129894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
130894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
131894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (BF::DRegClass.contains(SrcReg)) {
132894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    if (DestReg == BF::NCC) {
133894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BuildMI(MBB, I, DL, get(BF::SETEQri_not), DestReg)
134894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman        .addReg(SrcReg, getKillRegState(KillSrc)).addImm(0);
135894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return;
136894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
137894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    if (DestReg == BF::CC) {
138894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      BuildMI(MBB, I, DL, get(BF::MOVECC_nz), DestReg)
139894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman        .addReg(SrcReg, getKillRegState(KillSrc));
140894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      return;
141894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    }
142894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
143894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
144894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
145894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (DestReg == BF::NCC && SrcReg == BF::CC) {
146894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::MOVE_ncccc), DestReg)
147894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addReg(SrcReg, getKillRegState(KillSrc));
148894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
149894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
150894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
151894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (DestReg == BF::CC && SrcReg == BF::NCC) {
152894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::MOVE_ccncc), DestReg)
153894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addReg(SrcReg, getKillRegState(KillSrc));
154894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
155894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
156894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
157894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  llvm_unreachable("Bad reg-to-reg copy");
158894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
159894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
160894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanstatic bool inClass(const TargetRegisterClass &Test,
161894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                    unsigned Reg,
162894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                    const TargetRegisterClass *RC) {
163894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (TargetRegisterInfo::isPhysicalRegister(Reg))
164894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return Test.contains(Reg);
165894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  else
16619bac1e08be200c31efd26f0f5fd144c9b3eefd3John Bauman    return Test.hasSubClassEq(RC);
167894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
168894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
169894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanvoid
170894018228b0e0bdbd7aa7e8f47d4a9458789ca82John BaumanBlackfinInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
171894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                       MachineBasicBlock::iterator I,
172894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                       unsigned SrcReg,
173894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                       bool isKill,
174894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                       int FI,
175894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                       const TargetRegisterClass *RC,
176894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                       const TargetRegisterInfo *TRI) const {
177894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  DebugLoc DL = I != MBB.end() ? I->getDebugLoc() : DebugLoc();
178894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
179894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (inClass(BF::DPRegClass, SrcReg, RC)) {
180894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::STORE32fi))
181894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addReg(SrcReg, getKillRegState(isKill))
182894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addFrameIndex(FI)
183894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addImm(0);
184894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
185894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
186894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
187894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (inClass(BF::D16RegClass, SrcReg, RC)) {
188894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::STORE16fi))
189894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addReg(SrcReg, getKillRegState(isKill))
190894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addFrameIndex(FI)
191894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addImm(0);
192894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
193894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
194894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
195894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (inClass(BF::AnyCCRegClass, SrcReg, RC)) {
196894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::STORE8fi))
197894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addReg(SrcReg, getKillRegState(isKill))
198894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addFrameIndex(FI)
199894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addImm(0);
200894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
201894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
202894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
203894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  llvm_unreachable((std::string("Cannot store regclass to stack slot: ")+
204894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                    RC->getName()).c_str());
205894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
206894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
207894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanvoid BlackfinInstrInfo::
208894018228b0e0bdbd7aa7e8f47d4a9458789ca82John BaumanstoreRegToAddr(MachineFunction &MF,
209894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman               unsigned SrcReg,
210894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman               bool isKill,
211894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman               SmallVectorImpl<MachineOperand> &Addr,
212894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman               const TargetRegisterClass *RC,
213894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman               SmallVectorImpl<MachineInstr*> &NewMIs) const {
214894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  llvm_unreachable("storeRegToAddr not implemented");
215894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
216894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
217894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanvoid
218894018228b0e0bdbd7aa7e8f47d4a9458789ca82John BaumanBlackfinInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
219894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        MachineBasicBlock::iterator I,
220894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        unsigned DestReg,
221894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        int FI,
222894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        const TargetRegisterClass *RC,
223894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                                        const TargetRegisterInfo *TRI) const {
224894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  DebugLoc DL = I != MBB.end() ? I->getDebugLoc() : DebugLoc();
225894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (inClass(BF::DPRegClass, DestReg, RC)) {
226894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::LOAD32fi), DestReg)
227894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addFrameIndex(FI)
228894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addImm(0);
229894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
230894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
231894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
232894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (inClass(BF::D16RegClass, DestReg, RC)) {
233894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::LOAD16fi), DestReg)
234894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addFrameIndex(FI)
235894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addImm(0);
236894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
237894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
238894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
239894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  if (inClass(BF::AnyCCRegClass, DestReg, RC)) {
240894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    BuildMI(MBB, I, DL, get(BF::LOAD8fi), DestReg)
241894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addFrameIndex(FI)
242894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman      .addImm(0);
243894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman    return;
244894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  }
245894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
246894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  llvm_unreachable("Cannot load regclass from stack slot");
247894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
248894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman
249894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Baumanvoid BlackfinInstrInfo::
250894018228b0e0bdbd7aa7e8f47d4a9458789ca82John BaumanloadRegFromAddr(MachineFunction &MF,
251894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                unsigned DestReg,
252894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                SmallVectorImpl<MachineOperand> &Addr,
253894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                const TargetRegisterClass *RC,
254894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman                SmallVectorImpl<MachineInstr*> &NewMIs) const {
255894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman  llvm_unreachable("loadRegFromAddr not implemented");
256894018228b0e0bdbd7aa7e8f47d4a9458789ca82John Bauman}
257