Chromium Code Reviews| Index: src/IceTargetLoweringMIPS32.cpp |
| diff --git a/src/IceTargetLoweringMIPS32.cpp b/src/IceTargetLoweringMIPS32.cpp |
| index ce1f810f73912944c8b2d7f920853c642d8043e2..93202a068d2d3824dcdd1be311ca6a4b799b17b6 100644 |
| --- a/src/IceTargetLoweringMIPS32.cpp |
| +++ b/src/IceTargetLoweringMIPS32.cpp |
| @@ -371,6 +371,23 @@ Variable *TargetMIPS32::makeReg(Type Type, RegNumT RegNum) { |
| return Reg; |
| } |
| +OperandMIPS32Mem *TargetMIPS32::formMemoryOperand(Operand *Operand, Type Ty) { |
| + auto *Mem = llvm::dyn_cast<OperandMIPS32Mem>(Operand); |
|
Jim Stichnoth
2016/05/23 17:12:19
Just use llvm::isa<> instead of testing the result
|
| + // It may be the case that address mode optimization already creates an |
| + // OperandMIPS32Mem, so in that case it wouldn't need another level of |
| + // transformation. |
| + if (Mem) { |
| + return llvm::cast<OperandMIPS32Mem>(legalize(Mem)); |
| + } |
| + // If we didn't do address mode optimization, then we only have a |
|
Jim Stichnoth
2016/05/23 17:12:18
reflow comment to 80-col
|
| + // base/offset to work with. MIPS always requires a base register, so |
| + // just use that to hold the operand. |
| + auto *Base = llvm::cast<Variable>(legalize(Operand, Legal_Reg)); |
| + return OperandMIPS32Mem::create( |
| + Func, Ty, Base, |
| + llvm::cast<ConstantInteger32>(Ctx->getConstantZero(IceType_i32))); |
| +} |
| + |
| void TargetMIPS32::emitVariable(const Variable *Var) const { |
| if (!BuildDefs::dump()) |
| return; |
| @@ -1327,7 +1344,21 @@ void TargetMIPS32::lowerShuffleVector(const InstShuffleVector *Instr) { |
| } |
| void TargetMIPS32::lowerStore(const InstStore *Instr) { |
| - UnimplementedLoweringError(this, Instr); |
| + Operand *Value = Instr->getData(); |
| + Operand *Addr = Instr->getAddr(); |
| + OperandMIPS32Mem *NewAddr = formMemoryOperand(Addr, Value->getType()); |
| + Type Ty = NewAddr->getType(); |
| + |
| + if (Ty == IceType_i64) { |
| + Value = legalizeUndef(Value); |
| + Variable *ValueHi = legalizeToReg(hiOperand(Value)); |
| + Variable *ValueLo = legalizeToReg(loOperand(Value)); |
| + _sw(ValueHi, llvm::cast<OperandMIPS32Mem>(hiOperand(NewAddr))); |
| + _sw(ValueLo, llvm::cast<OperandMIPS32Mem>(loOperand(NewAddr))); |
| + } else { |
| + Variable *ValueR = legalizeToReg(Value); |
| + _sw(ValueR, NewAddr); |
| + } |
| } |
| void TargetMIPS32::doAddressOptStore() { UnimplementedError(getFlags()); } |