xref: /aosp_15_r20/external/llvm/lib/Target/SystemZ/SystemZShortenInst.cpp (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- SystemZShortenInst.cpp - Instruction-shortening pass --------------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This pass tries to replace instructions with shorter forms.  For example,
11*9880d681SAndroid Build Coastguard Worker // IILF can be replaced with LLILL or LLILH if the constant fits and if the
12*9880d681SAndroid Build Coastguard Worker // other 32 bits of the GR64 destination are not live.
13*9880d681SAndroid Build Coastguard Worker //
14*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
15*9880d681SAndroid Build Coastguard Worker 
16*9880d681SAndroid Build Coastguard Worker #include "SystemZTargetMachine.h"
17*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineFunctionPass.h"
18*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineInstrBuilder.h"
19*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/LivePhysRegs.h"
20*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetRegisterInfo.h"
21*9880d681SAndroid Build Coastguard Worker 
22*9880d681SAndroid Build Coastguard Worker using namespace llvm;
23*9880d681SAndroid Build Coastguard Worker 
24*9880d681SAndroid Build Coastguard Worker #define DEBUG_TYPE "systemz-shorten-inst"
25*9880d681SAndroid Build Coastguard Worker 
26*9880d681SAndroid Build Coastguard Worker namespace {
27*9880d681SAndroid Build Coastguard Worker class SystemZShortenInst : public MachineFunctionPass {
28*9880d681SAndroid Build Coastguard Worker public:
29*9880d681SAndroid Build Coastguard Worker   static char ID;
30*9880d681SAndroid Build Coastguard Worker   SystemZShortenInst(const SystemZTargetMachine &tm);
31*9880d681SAndroid Build Coastguard Worker 
getPassName() const32*9880d681SAndroid Build Coastguard Worker   const char *getPassName() const override {
33*9880d681SAndroid Build Coastguard Worker     return "SystemZ Instruction Shortening";
34*9880d681SAndroid Build Coastguard Worker   }
35*9880d681SAndroid Build Coastguard Worker 
36*9880d681SAndroid Build Coastguard Worker   bool processBlock(MachineBasicBlock &MBB);
37*9880d681SAndroid Build Coastguard Worker   bool runOnMachineFunction(MachineFunction &F) override;
getRequiredProperties() const38*9880d681SAndroid Build Coastguard Worker   MachineFunctionProperties getRequiredProperties() const override {
39*9880d681SAndroid Build Coastguard Worker     return MachineFunctionProperties().set(
40*9880d681SAndroid Build Coastguard Worker         MachineFunctionProperties::Property::AllVRegsAllocated);
41*9880d681SAndroid Build Coastguard Worker   }
42*9880d681SAndroid Build Coastguard Worker 
43*9880d681SAndroid Build Coastguard Worker private:
44*9880d681SAndroid Build Coastguard Worker   bool shortenIIF(MachineInstr &MI, unsigned LLIxL, unsigned LLIxH);
45*9880d681SAndroid Build Coastguard Worker   bool shortenOn0(MachineInstr &MI, unsigned Opcode);
46*9880d681SAndroid Build Coastguard Worker   bool shortenOn01(MachineInstr &MI, unsigned Opcode);
47*9880d681SAndroid Build Coastguard Worker   bool shortenOn001(MachineInstr &MI, unsigned Opcode);
48*9880d681SAndroid Build Coastguard Worker   bool shortenOn001AddCC(MachineInstr &MI, unsigned Opcode);
49*9880d681SAndroid Build Coastguard Worker   bool shortenFPConv(MachineInstr &MI, unsigned Opcode);
50*9880d681SAndroid Build Coastguard Worker 
51*9880d681SAndroid Build Coastguard Worker   const SystemZInstrInfo *TII;
52*9880d681SAndroid Build Coastguard Worker   const TargetRegisterInfo *TRI;
53*9880d681SAndroid Build Coastguard Worker   LivePhysRegs LiveRegs;
54*9880d681SAndroid Build Coastguard Worker };
55*9880d681SAndroid Build Coastguard Worker 
56*9880d681SAndroid Build Coastguard Worker char SystemZShortenInst::ID = 0;
57*9880d681SAndroid Build Coastguard Worker } // end anonymous namespace
58*9880d681SAndroid Build Coastguard Worker 
createSystemZShortenInstPass(SystemZTargetMachine & TM)59*9880d681SAndroid Build Coastguard Worker FunctionPass *llvm::createSystemZShortenInstPass(SystemZTargetMachine &TM) {
60*9880d681SAndroid Build Coastguard Worker   return new SystemZShortenInst(TM);
61*9880d681SAndroid Build Coastguard Worker }
62*9880d681SAndroid Build Coastguard Worker 
SystemZShortenInst(const SystemZTargetMachine & tm)63*9880d681SAndroid Build Coastguard Worker SystemZShortenInst::SystemZShortenInst(const SystemZTargetMachine &tm)
64*9880d681SAndroid Build Coastguard Worker   : MachineFunctionPass(ID), TII(nullptr) {}
65*9880d681SAndroid Build Coastguard Worker 
66*9880d681SAndroid Build Coastguard Worker // Tie operands if MI has become a two-address instruction.
tieOpsIfNeeded(MachineInstr & MI)67*9880d681SAndroid Build Coastguard Worker static void tieOpsIfNeeded(MachineInstr &MI) {
68*9880d681SAndroid Build Coastguard Worker   if (MI.getDesc().getOperandConstraint(0, MCOI::TIED_TO) &&
69*9880d681SAndroid Build Coastguard Worker       !MI.getOperand(0).isTied())
70*9880d681SAndroid Build Coastguard Worker     MI.tieOperands(0, 1);
71*9880d681SAndroid Build Coastguard Worker }
72*9880d681SAndroid Build Coastguard Worker 
73*9880d681SAndroid Build Coastguard Worker // MI loads one word of a GPR using an IIxF instruction and LLIxL and LLIxH
74*9880d681SAndroid Build Coastguard Worker // are the halfword immediate loads for the same word.  Try to use one of them
75*9880d681SAndroid Build Coastguard Worker // instead of IIxF.
shortenIIF(MachineInstr & MI,unsigned LLIxL,unsigned LLIxH)76*9880d681SAndroid Build Coastguard Worker bool SystemZShortenInst::shortenIIF(MachineInstr &MI, unsigned LLIxL,
77*9880d681SAndroid Build Coastguard Worker                                     unsigned LLIxH) {
78*9880d681SAndroid Build Coastguard Worker   unsigned Reg = MI.getOperand(0).getReg();
79*9880d681SAndroid Build Coastguard Worker   // The new opcode will clear the other half of the GR64 reg, so
80*9880d681SAndroid Build Coastguard Worker   // cancel if that is live.
81*9880d681SAndroid Build Coastguard Worker   unsigned thisSubRegIdx =
82*9880d681SAndroid Build Coastguard Worker       (SystemZ::GRH32BitRegClass.contains(Reg) ? SystemZ::subreg_h32
83*9880d681SAndroid Build Coastguard Worker                                                : SystemZ::subreg_l32);
84*9880d681SAndroid Build Coastguard Worker   unsigned otherSubRegIdx =
85*9880d681SAndroid Build Coastguard Worker       (thisSubRegIdx == SystemZ::subreg_l32 ? SystemZ::subreg_h32
86*9880d681SAndroid Build Coastguard Worker                                             : SystemZ::subreg_l32);
87*9880d681SAndroid Build Coastguard Worker   unsigned GR64BitReg =
88*9880d681SAndroid Build Coastguard Worker       TRI->getMatchingSuperReg(Reg, thisSubRegIdx, &SystemZ::GR64BitRegClass);
89*9880d681SAndroid Build Coastguard Worker   unsigned OtherReg = TRI->getSubReg(GR64BitReg, otherSubRegIdx);
90*9880d681SAndroid Build Coastguard Worker   if (LiveRegs.contains(OtherReg))
91*9880d681SAndroid Build Coastguard Worker     return false;
92*9880d681SAndroid Build Coastguard Worker 
93*9880d681SAndroid Build Coastguard Worker   uint64_t Imm = MI.getOperand(1).getImm();
94*9880d681SAndroid Build Coastguard Worker   if (SystemZ::isImmLL(Imm)) {
95*9880d681SAndroid Build Coastguard Worker     MI.setDesc(TII->get(LLIxL));
96*9880d681SAndroid Build Coastguard Worker     MI.getOperand(0).setReg(SystemZMC::getRegAsGR64(Reg));
97*9880d681SAndroid Build Coastguard Worker     return true;
98*9880d681SAndroid Build Coastguard Worker   }
99*9880d681SAndroid Build Coastguard Worker   if (SystemZ::isImmLH(Imm)) {
100*9880d681SAndroid Build Coastguard Worker     MI.setDesc(TII->get(LLIxH));
101*9880d681SAndroid Build Coastguard Worker     MI.getOperand(0).setReg(SystemZMC::getRegAsGR64(Reg));
102*9880d681SAndroid Build Coastguard Worker     MI.getOperand(1).setImm(Imm >> 16);
103*9880d681SAndroid Build Coastguard Worker     return true;
104*9880d681SAndroid Build Coastguard Worker   }
105*9880d681SAndroid Build Coastguard Worker   return false;
106*9880d681SAndroid Build Coastguard Worker }
107*9880d681SAndroid Build Coastguard Worker 
108*9880d681SAndroid Build Coastguard Worker // Change MI's opcode to Opcode if register operand 0 has a 4-bit encoding.
shortenOn0(MachineInstr & MI,unsigned Opcode)109*9880d681SAndroid Build Coastguard Worker bool SystemZShortenInst::shortenOn0(MachineInstr &MI, unsigned Opcode) {
110*9880d681SAndroid Build Coastguard Worker   if (SystemZMC::getFirstReg(MI.getOperand(0).getReg()) < 16) {
111*9880d681SAndroid Build Coastguard Worker     MI.setDesc(TII->get(Opcode));
112*9880d681SAndroid Build Coastguard Worker     return true;
113*9880d681SAndroid Build Coastguard Worker   }
114*9880d681SAndroid Build Coastguard Worker   return false;
115*9880d681SAndroid Build Coastguard Worker }
116*9880d681SAndroid Build Coastguard Worker 
117*9880d681SAndroid Build Coastguard Worker // Change MI's opcode to Opcode if register operands 0 and 1 have a
118*9880d681SAndroid Build Coastguard Worker // 4-bit encoding.
shortenOn01(MachineInstr & MI,unsigned Opcode)119*9880d681SAndroid Build Coastguard Worker bool SystemZShortenInst::shortenOn01(MachineInstr &MI, unsigned Opcode) {
120*9880d681SAndroid Build Coastguard Worker   if (SystemZMC::getFirstReg(MI.getOperand(0).getReg()) < 16 &&
121*9880d681SAndroid Build Coastguard Worker       SystemZMC::getFirstReg(MI.getOperand(1).getReg()) < 16) {
122*9880d681SAndroid Build Coastguard Worker     MI.setDesc(TII->get(Opcode));
123*9880d681SAndroid Build Coastguard Worker     return true;
124*9880d681SAndroid Build Coastguard Worker   }
125*9880d681SAndroid Build Coastguard Worker   return false;
126*9880d681SAndroid Build Coastguard Worker }
127*9880d681SAndroid Build Coastguard Worker 
128*9880d681SAndroid Build Coastguard Worker // Change MI's opcode to Opcode if register operands 0, 1 and 2 have a
129*9880d681SAndroid Build Coastguard Worker // 4-bit encoding and if operands 0 and 1 are tied. Also ties op 0
130*9880d681SAndroid Build Coastguard Worker // with op 1, if MI becomes 2-address.
shortenOn001(MachineInstr & MI,unsigned Opcode)131*9880d681SAndroid Build Coastguard Worker bool SystemZShortenInst::shortenOn001(MachineInstr &MI, unsigned Opcode) {
132*9880d681SAndroid Build Coastguard Worker   if (SystemZMC::getFirstReg(MI.getOperand(0).getReg()) < 16 &&
133*9880d681SAndroid Build Coastguard Worker       MI.getOperand(1).getReg() == MI.getOperand(0).getReg() &&
134*9880d681SAndroid Build Coastguard Worker       SystemZMC::getFirstReg(MI.getOperand(2).getReg()) < 16) {
135*9880d681SAndroid Build Coastguard Worker     MI.setDesc(TII->get(Opcode));
136*9880d681SAndroid Build Coastguard Worker     tieOpsIfNeeded(MI);
137*9880d681SAndroid Build Coastguard Worker     return true;
138*9880d681SAndroid Build Coastguard Worker   }
139*9880d681SAndroid Build Coastguard Worker   return false;
140*9880d681SAndroid Build Coastguard Worker }
141*9880d681SAndroid Build Coastguard Worker 
142*9880d681SAndroid Build Coastguard Worker // Calls shortenOn001 if CCLive is false. CC def operand is added in
143*9880d681SAndroid Build Coastguard Worker // case of success.
shortenOn001AddCC(MachineInstr & MI,unsigned Opcode)144*9880d681SAndroid Build Coastguard Worker bool SystemZShortenInst::shortenOn001AddCC(MachineInstr &MI, unsigned Opcode) {
145*9880d681SAndroid Build Coastguard Worker   if (!LiveRegs.contains(SystemZ::CC) && shortenOn001(MI, Opcode)) {
146*9880d681SAndroid Build Coastguard Worker     MachineInstrBuilder(*MI.getParent()->getParent(), &MI)
147*9880d681SAndroid Build Coastguard Worker       .addReg(SystemZ::CC, RegState::ImplicitDefine | RegState::Dead);
148*9880d681SAndroid Build Coastguard Worker     return true;
149*9880d681SAndroid Build Coastguard Worker   }
150*9880d681SAndroid Build Coastguard Worker   return false;
151*9880d681SAndroid Build Coastguard Worker }
152*9880d681SAndroid Build Coastguard Worker 
153*9880d681SAndroid Build Coastguard Worker // MI is a vector-style conversion instruction with the operand order:
154*9880d681SAndroid Build Coastguard Worker // destination, source, exact-suppress, rounding-mode.  If both registers
155*9880d681SAndroid Build Coastguard Worker // have a 4-bit encoding then change it to Opcode, which has operand order:
156*9880d681SAndroid Build Coastguard Worker // destination, rouding-mode, source, exact-suppress.
shortenFPConv(MachineInstr & MI,unsigned Opcode)157*9880d681SAndroid Build Coastguard Worker bool SystemZShortenInst::shortenFPConv(MachineInstr &MI, unsigned Opcode) {
158*9880d681SAndroid Build Coastguard Worker   if (SystemZMC::getFirstReg(MI.getOperand(0).getReg()) < 16 &&
159*9880d681SAndroid Build Coastguard Worker       SystemZMC::getFirstReg(MI.getOperand(1).getReg()) < 16) {
160*9880d681SAndroid Build Coastguard Worker     MachineOperand Dest(MI.getOperand(0));
161*9880d681SAndroid Build Coastguard Worker     MachineOperand Src(MI.getOperand(1));
162*9880d681SAndroid Build Coastguard Worker     MachineOperand Suppress(MI.getOperand(2));
163*9880d681SAndroid Build Coastguard Worker     MachineOperand Mode(MI.getOperand(3));
164*9880d681SAndroid Build Coastguard Worker     MI.RemoveOperand(3);
165*9880d681SAndroid Build Coastguard Worker     MI.RemoveOperand(2);
166*9880d681SAndroid Build Coastguard Worker     MI.RemoveOperand(1);
167*9880d681SAndroid Build Coastguard Worker     MI.RemoveOperand(0);
168*9880d681SAndroid Build Coastguard Worker     MI.setDesc(TII->get(Opcode));
169*9880d681SAndroid Build Coastguard Worker     MachineInstrBuilder(*MI.getParent()->getParent(), &MI)
170*9880d681SAndroid Build Coastguard Worker       .addOperand(Dest)
171*9880d681SAndroid Build Coastguard Worker       .addOperand(Mode)
172*9880d681SAndroid Build Coastguard Worker       .addOperand(Src)
173*9880d681SAndroid Build Coastguard Worker       .addOperand(Suppress);
174*9880d681SAndroid Build Coastguard Worker     return true;
175*9880d681SAndroid Build Coastguard Worker   }
176*9880d681SAndroid Build Coastguard Worker   return false;
177*9880d681SAndroid Build Coastguard Worker }
178*9880d681SAndroid Build Coastguard Worker 
179*9880d681SAndroid Build Coastguard Worker // Process all instructions in MBB.  Return true if something changed.
processBlock(MachineBasicBlock & MBB)180*9880d681SAndroid Build Coastguard Worker bool SystemZShortenInst::processBlock(MachineBasicBlock &MBB) {
181*9880d681SAndroid Build Coastguard Worker   bool Changed = false;
182*9880d681SAndroid Build Coastguard Worker 
183*9880d681SAndroid Build Coastguard Worker   // Set up the set of live registers at the end of MBB (live out)
184*9880d681SAndroid Build Coastguard Worker   LiveRegs.clear();
185*9880d681SAndroid Build Coastguard Worker   LiveRegs.addLiveOuts(MBB);
186*9880d681SAndroid Build Coastguard Worker 
187*9880d681SAndroid Build Coastguard Worker   // Iterate backwards through the block looking for instructions to change.
188*9880d681SAndroid Build Coastguard Worker   for (auto MBBI = MBB.rbegin(), MBBE = MBB.rend(); MBBI != MBBE; ++MBBI) {
189*9880d681SAndroid Build Coastguard Worker     MachineInstr &MI = *MBBI;
190*9880d681SAndroid Build Coastguard Worker     switch (MI.getOpcode()) {
191*9880d681SAndroid Build Coastguard Worker     case SystemZ::IILF:
192*9880d681SAndroid Build Coastguard Worker       Changed |= shortenIIF(MI, SystemZ::LLILL, SystemZ::LLILH);
193*9880d681SAndroid Build Coastguard Worker       break;
194*9880d681SAndroid Build Coastguard Worker 
195*9880d681SAndroid Build Coastguard Worker     case SystemZ::IIHF:
196*9880d681SAndroid Build Coastguard Worker       Changed |= shortenIIF(MI, SystemZ::LLIHL, SystemZ::LLIHH);
197*9880d681SAndroid Build Coastguard Worker       break;
198*9880d681SAndroid Build Coastguard Worker 
199*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFADB:
200*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn001AddCC(MI, SystemZ::ADBR);
201*9880d681SAndroid Build Coastguard Worker       break;
202*9880d681SAndroid Build Coastguard Worker 
203*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFDDB:
204*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn001(MI, SystemZ::DDBR);
205*9880d681SAndroid Build Coastguard Worker       break;
206*9880d681SAndroid Build Coastguard Worker 
207*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFIDB:
208*9880d681SAndroid Build Coastguard Worker       Changed |= shortenFPConv(MI, SystemZ::FIDBRA);
209*9880d681SAndroid Build Coastguard Worker       break;
210*9880d681SAndroid Build Coastguard Worker 
211*9880d681SAndroid Build Coastguard Worker     case SystemZ::WLDEB:
212*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn01(MI, SystemZ::LDEBR);
213*9880d681SAndroid Build Coastguard Worker       break;
214*9880d681SAndroid Build Coastguard Worker 
215*9880d681SAndroid Build Coastguard Worker     case SystemZ::WLEDB:
216*9880d681SAndroid Build Coastguard Worker       Changed |= shortenFPConv(MI, SystemZ::LEDBRA);
217*9880d681SAndroid Build Coastguard Worker       break;
218*9880d681SAndroid Build Coastguard Worker 
219*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFMDB:
220*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn001(MI, SystemZ::MDBR);
221*9880d681SAndroid Build Coastguard Worker       break;
222*9880d681SAndroid Build Coastguard Worker 
223*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFLCDB:
224*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn01(MI, SystemZ::LCDFR);
225*9880d681SAndroid Build Coastguard Worker       break;
226*9880d681SAndroid Build Coastguard Worker 
227*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFLNDB:
228*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn01(MI, SystemZ::LNDFR);
229*9880d681SAndroid Build Coastguard Worker       break;
230*9880d681SAndroid Build Coastguard Worker 
231*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFLPDB:
232*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn01(MI, SystemZ::LPDFR);
233*9880d681SAndroid Build Coastguard Worker       break;
234*9880d681SAndroid Build Coastguard Worker 
235*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFSQDB:
236*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn01(MI, SystemZ::SQDBR);
237*9880d681SAndroid Build Coastguard Worker       break;
238*9880d681SAndroid Build Coastguard Worker 
239*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFSDB:
240*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn001AddCC(MI, SystemZ::SDBR);
241*9880d681SAndroid Build Coastguard Worker       break;
242*9880d681SAndroid Build Coastguard Worker 
243*9880d681SAndroid Build Coastguard Worker     case SystemZ::WFCDB:
244*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn01(MI, SystemZ::CDBR);
245*9880d681SAndroid Build Coastguard Worker       break;
246*9880d681SAndroid Build Coastguard Worker 
247*9880d681SAndroid Build Coastguard Worker     case SystemZ::VL32:
248*9880d681SAndroid Build Coastguard Worker       // For z13 we prefer LDE over LE to avoid partial register dependencies.
249*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn0(MI, SystemZ::LDE32);
250*9880d681SAndroid Build Coastguard Worker       break;
251*9880d681SAndroid Build Coastguard Worker 
252*9880d681SAndroid Build Coastguard Worker     case SystemZ::VST32:
253*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn0(MI, SystemZ::STE);
254*9880d681SAndroid Build Coastguard Worker       break;
255*9880d681SAndroid Build Coastguard Worker 
256*9880d681SAndroid Build Coastguard Worker     case SystemZ::VL64:
257*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn0(MI, SystemZ::LD);
258*9880d681SAndroid Build Coastguard Worker       break;
259*9880d681SAndroid Build Coastguard Worker 
260*9880d681SAndroid Build Coastguard Worker     case SystemZ::VST64:
261*9880d681SAndroid Build Coastguard Worker       Changed |= shortenOn0(MI, SystemZ::STD);
262*9880d681SAndroid Build Coastguard Worker       break;
263*9880d681SAndroid Build Coastguard Worker     }
264*9880d681SAndroid Build Coastguard Worker 
265*9880d681SAndroid Build Coastguard Worker     LiveRegs.stepBackward(MI);
266*9880d681SAndroid Build Coastguard Worker   }
267*9880d681SAndroid Build Coastguard Worker 
268*9880d681SAndroid Build Coastguard Worker   return Changed;
269*9880d681SAndroid Build Coastguard Worker }
270*9880d681SAndroid Build Coastguard Worker 
runOnMachineFunction(MachineFunction & F)271*9880d681SAndroid Build Coastguard Worker bool SystemZShortenInst::runOnMachineFunction(MachineFunction &F) {
272*9880d681SAndroid Build Coastguard Worker   if (skipFunction(*F.getFunction()))
273*9880d681SAndroid Build Coastguard Worker     return false;
274*9880d681SAndroid Build Coastguard Worker 
275*9880d681SAndroid Build Coastguard Worker   const SystemZSubtarget &ST = F.getSubtarget<SystemZSubtarget>();
276*9880d681SAndroid Build Coastguard Worker   TII = ST.getInstrInfo();
277*9880d681SAndroid Build Coastguard Worker   TRI = ST.getRegisterInfo();
278*9880d681SAndroid Build Coastguard Worker   LiveRegs.init(TRI);
279*9880d681SAndroid Build Coastguard Worker 
280*9880d681SAndroid Build Coastguard Worker   bool Changed = false;
281*9880d681SAndroid Build Coastguard Worker   for (auto &MBB : F)
282*9880d681SAndroid Build Coastguard Worker     Changed |= processBlock(MBB);
283*9880d681SAndroid Build Coastguard Worker 
284*9880d681SAndroid Build Coastguard Worker   return Changed;
285*9880d681SAndroid Build Coastguard Worker }
286