Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: src/IceTargetLoweringMIPS32.cpp

Issue 2005823002: [Subzero][MIPS32] Add LowerStore implementation (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addressed review comments, enabled store test for MIPS32 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceTargetLoweringMIPS32.h ('k') | tests_lit/llvm2ice_tests/store.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // 1 //
2 // The Subzero Code Generator 2 // The Subzero Code Generator
3 // 3 //
4 // This file is distributed under the University of Illinois Open Source 4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details. 5 // License. See LICENSE.TXT for details.
6 // 6 //
7 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
8 /// 8 ///
9 /// \file 9 /// \file
10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost 10 /// \brief Implements the TargetLoweringMIPS32 class, which consists almost
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // There aren't any 64-bit integer registers for Mips32. 364 // There aren't any 64-bit integer registers for Mips32.
365 assert(Type != IceType_i64); 365 assert(Type != IceType_i64);
366 Variable *Reg = Func->makeVariable(Type); 366 Variable *Reg = Func->makeVariable(Type);
367 if (RegNum.hasValue()) 367 if (RegNum.hasValue())
368 Reg->setRegNum(RegNum); 368 Reg->setRegNum(RegNum);
369 else 369 else
370 Reg->setMustHaveReg(); 370 Reg->setMustHaveReg();
371 return Reg; 371 return Reg;
372 } 372 }
373 373
374 OperandMIPS32Mem *TargetMIPS32::formMemoryOperand(Operand *Operand, Type Ty) {
375 // It may be the case that address mode optimization already creates an
376 // OperandMIPS32Mem, so in that case it wouldn't need another level of
377 // transformation.
378 if (llvm::isa<OperandMIPS32Mem>(Operand)) {
Jim Stichnoth 2016/05/31 18:18:52 Sorry, I was a bit off in my previous comment. Th
379 return llvm::cast<OperandMIPS32Mem>(Operand);
380 }
381
382 // If we didn't do address mode optimization, then we only have a base/offset
383 // to work with. MIPS always requires a base register, so just use that to
384 // hold the operand.
385 auto *Base = llvm::cast<Variable>(legalize(Operand, Legal_Reg));
386 return OperandMIPS32Mem::create(
387 Func, Ty, Base,
388 llvm::cast<ConstantInteger32>(Ctx->getConstantZero(IceType_i32)));
389 }
390
374 void TargetMIPS32::emitVariable(const Variable *Var) const { 391 void TargetMIPS32::emitVariable(const Variable *Var) const {
375 if (!BuildDefs::dump()) 392 if (!BuildDefs::dump())
376 return; 393 return;
377 Ostream &Str = Ctx->getStrEmit(); 394 Ostream &Str = Ctx->getStrEmit();
378 const Type FrameSPTy = IceType_i32; 395 const Type FrameSPTy = IceType_i32;
379 if (Var->hasReg()) { 396 if (Var->hasReg()) {
380 Str << '$' << getRegName(Var->getRegNum(), Var->getType()); 397 Str << '$' << getRegName(Var->getRegNum(), Var->getType());
381 return; 398 return;
382 } else { 399 } else {
383 int32_t Offset = Var->getStackOffset(); 400 int32_t Offset = Var->getStackOffset();
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 1337
1321 void TargetMIPS32::lowerSelect(const InstSelect *Instr) { 1338 void TargetMIPS32::lowerSelect(const InstSelect *Instr) {
1322 UnimplementedLoweringError(this, Instr); 1339 UnimplementedLoweringError(this, Instr);
1323 } 1340 }
1324 1341
1325 void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) { 1342 void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) {
1326 UnimplementedLoweringError(this, Instr); 1343 UnimplementedLoweringError(this, Instr);
1327 } 1344 }
1328 1345
1329 void TargetMIPS32::lowerStore(const InstStore *Instr) { 1346 void TargetMIPS32::lowerStore(const InstStore *Instr) {
1330 UnimplementedLoweringError(this, Instr); 1347 Operand *Value = Instr->getData();
1348 Operand *Addr = Instr->getAddr();
1349 OperandMIPS32Mem *NewAddr = formMemoryOperand(Addr, Value->getType());
1350 Type Ty = NewAddr->getType();
1351
1352 if (Ty == IceType_i64) {
1353 Value = legalizeUndef(Value);
1354 Variable *ValueHi = legalizeToReg(hiOperand(Value));
1355 Variable *ValueLo = legalizeToReg(loOperand(Value));
1356 _sw(ValueHi, llvm::cast<OperandMIPS32Mem>(hiOperand(NewAddr)));
1357 _sw(ValueLo, llvm::cast<OperandMIPS32Mem>(loOperand(NewAddr)));
1358 } else {
1359 Variable *ValueR = legalizeToReg(Value);
1360 _sw(ValueR, NewAddr);
1361 }
1331 } 1362 }
1332 1363
1333 void TargetMIPS32::doAddressOptStore() { UnimplementedError(getFlags()); } 1364 void TargetMIPS32::doAddressOptStore() { UnimplementedError(getFlags()); }
1334 1365
1335 void TargetMIPS32::lowerSwitch(const InstSwitch *Instr) { 1366 void TargetMIPS32::lowerSwitch(const InstSwitch *Instr) {
1336 UnimplementedLoweringError(this, Instr); 1367 UnimplementedLoweringError(this, Instr);
1337 } 1368 }
1338 1369
1339 void TargetMIPS32::lowerBreakpoint(const InstBreakpoint *Instr) { 1370 void TargetMIPS32::lowerBreakpoint(const InstBreakpoint *Instr) {
1340 UnimplementedLoweringError(this, Instr); 1371 UnimplementedLoweringError(this, Instr);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 Str << "\t.set\t" 1533 Str << "\t.set\t"
1503 << "nomips16\n"; 1534 << "nomips16\n";
1504 } 1535 }
1505 1536
1506 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 1537 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
1507 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 1538 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
1508 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 1539 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
1509 1540
1510 } // end of namespace MIPS32 1541 } // end of namespace MIPS32
1511 } // end of namespace Ice 1542 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringMIPS32.h ('k') | tests_lit/llvm2ice_tests/store.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698