Chromium Code Reviews| Index: src/IceInstARM32.cpp |
| diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp |
| index 35dbef6ac2a9db99c70ee397427ec4e4439b2b64..740d3920748c72c11185a5b82417333711f51b04 100644 |
| --- a/src/IceInstARM32.cpp |
| +++ b/src/IceInstARM32.cpp |
| @@ -1116,6 +1116,51 @@ void InstARM32Pop::emit(const Cfg *Func) const { |
| } |
| } |
| +void InstARM32Pop::emitIAS(const Cfg *Func) const { |
| + SizeT DestReg = 0; |
| + SizeT IntegerCount = 0; |
| + ARM32::IValueT GPRegisters = 0; |
| + for (SizeT i = 0; i < Dests.size(); ++i) { |
|
Jim Stichnoth
2015/11/09 22:17:26
Consider using a range-based for loop:
Variable
|
| + Operand *Op = Dests[i]; |
| + if (!isScalarIntegerType(Op->getType())) |
| + // TODO(kschimpf) Implement vpush. |
| + return emitUsingTextFixup(Func); |
| + auto *Var = llvm::dyn_cast<Variable>(Op); |
| + assert((Var && Var->hasReg()) && "pop only applies to registers"); |
| + ARM32::IValueT Reg = Var->getRegNum(); |
|
Jim Stichnoth
2015/11/09 22:17:26
I think you're better off declaring this as int32_
Karl
2015/11/09 22:44:35
Forgot that Encoded_Not_GPR is negative. Changing.
|
| + assert(Reg != static_cast<ARM32::IValueT>(RegARM32::Encoded_Not_GPR)); |
| + DestReg = i; |
| + GPRegisters |= (1 << Reg); |
| + ++IntegerCount; |
| + } |
| + auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| + switch (IntegerCount) { |
| + case 0: |
| + return; |
| + case 1: { |
| + if (auto *Var = llvm::dyn_cast<Variable>(Dests[DestReg])) { |
|
Jim Stichnoth
2015/11/09 22:17:26
Dests[] is a VarList, so the dyn_cast is unnecessa
Karl
2015/11/09 22:44:35
Done.
|
| + // Note: Can only apply pop register if single register is not sp. |
| + assert((RegARM32::Encoded_Reg_sp != Var->getRegNum()) && |
| + "Effects of pop register SP is undefined!"); |
| + // TODO(kschimpf) ARM sandbox does not allow the single register form of |
| + // pop, and the popList form expects multiple registers. Convert this |
| + // assert to a conditional check once it has been shown that popList |
| + // works. |
| + assert(!Func->getContext()->getFlags().getUseSandboxing() && |
| + "pop register not in ARM sandbox!"); |
| + Asm->pop(Var, CondARM32::AL); |
| + break; |
| + } |
| + // Intentionally fall to next case. |
| + } |
| + default: |
| + Asm->popList(GPURegisters, CondARM32::AL); |
|
Jim Stichnoth
2015/11/09 22:17:26
GPURegisters? Should this be GPRegisters?
|
| + break; |
| + } |
| + if (Asm->needsTextFixup()) |
| + emitUsingTextFixup(Func); |
| +} |
| + |
| void InstARM32Pop::dump(const Cfg *Func) const { |
| if (!BuildDefs::dump()) |
| return; |