llvm.org GIT mirror llvm / 09f612a
[ARM] GlobalISel: Move local variable. NFC Move a local variable from outside a switch to inside every case that needs it (which isn't all of the cases, of course). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307893 91177308-0d34-0410-b5e6-96231b3b80d8 Diana Picus 3 years ago
1 changed file(s) with 10 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
211211
212212 const MachineFunction &MF = *MI.getParent()->getParent();
213213 const MachineRegisterInfo &MRI = MF.getRegInfo();
214 LLT Ty = MRI.getType(MI.getOperand(0).getReg());
215
216214 unsigned NumOperands = MI.getNumOperands();
217215 const ValueMapping *OperandsMapping = &ARM::ValueMappings[ARM::GPR3OpsIdx];
218216
235233 OperandsMapping = &ARM::ValueMappings[ARM::GPR3OpsIdx];
236234 break;
237235 case G_LOAD:
238 case G_STORE:
236 case G_STORE: {
237 LLT Ty = MRI.getType(MI.getOperand(0).getReg());
239238 OperandsMapping =
240239 Ty.getSizeInBits() == 64
241240 ? getOperandsMapping({&ARM::ValueMappings[ARM::DPR3OpsIdx],
242241 &ARM::ValueMappings[ARM::GPR3OpsIdx]})
243242 : &ARM::ValueMappings[ARM::GPR3OpsIdx];
244243 break;
245 case G_FADD:
244 }
245 case G_FADD: {
246 LLT Ty = MRI.getType(MI.getOperand(0).getReg());
246247 assert((Ty.getSizeInBits() == 32 || Ty.getSizeInBits() == 64) &&
247248 "Unsupported size for G_FADD");
248249 OperandsMapping = Ty.getSizeInBits() == 64
249250 ? &ARM::ValueMappings[ARM::DPR3OpsIdx]
250251 : &ARM::ValueMappings[ARM::SPR3OpsIdx];
251252 break;
253 }
252254 case G_CONSTANT:
253255 case G_FRAME_INDEX:
254256 OperandsMapping =
255257 getOperandsMapping({&ARM::ValueMappings[ARM::GPR3OpsIdx], nullptr});
256258 break;
257259 case G_SELECT: {
260 LLT Ty = MRI.getType(MI.getOperand(0).getReg());
258261 LLT Ty2 = MRI.getType(MI.getOperand(1).getReg());
259262 (void)Ty2;
260263 assert(Ty.getSizeInBits() == 32 && "Unsupported size for G_SELECT");
277280 break;
278281 }
279282 case G_FCMP: {
283 LLT Ty = MRI.getType(MI.getOperand(0).getReg());
280284 LLT Ty1 = MRI.getType(MI.getOperand(2).getReg());
281285 LLT Ty2 = MRI.getType(MI.getOperand(3).getReg());
282286 (void)Ty2;
297301 case G_MERGE_VALUES: {
298302 // We only support G_MERGE_VALUES for creating a double precision floating
299303 // point value out of two GPRs.
304 LLT Ty = MRI.getType(MI.getOperand(0).getReg());
300305 LLT Ty1 = MRI.getType(MI.getOperand(1).getReg());
301306 LLT Ty2 = MRI.getType(MI.getOperand(2).getReg());
302307 if (Ty.getSizeInBits() != 64 || Ty1.getSizeInBits() != 32 ||
311316 case G_UNMERGE_VALUES: {
312317 // We only support G_UNMERGE_VALUES for splitting a double precision
313318 // floating point value into two GPRs.
319 LLT Ty = MRI.getType(MI.getOperand(0).getReg());
314320 LLT Ty1 = MRI.getType(MI.getOperand(1).getReg());
315321 LLT Ty2 = MRI.getType(MI.getOperand(2).getReg());
316322 if (Ty.getSizeInBits() != 32 || Ty1.getSizeInBits() != 32 ||