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

Unified Diff: src/IceInstARM32.cpp

Issue 1433743002: Add POP instruction to ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issues in last patch. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceInstARM32.h ('k') | tests_lit/assembler/arm32/bic.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstARM32.cpp
diff --git a/src/IceInstARM32.cpp b/src/IceInstARM32.cpp
index 35dbef6ac2a9db99c70ee397427ec4e4439b2b64..48fc3f508a0abec372d5425348e2fc79aeb107ca 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;
Jim Stichnoth 2015/11/09 23:04:11 remove this
Karl 2015/11/10 16:32:22 Done.
+ SizeT IntegerCount = 0;
+ ARM32::IValueT GPRegisters = 0;
+ SizeT Index = 0;
Jim Stichnoth 2015/11/09 23:04:11 replace this with: Variable *LastDest = nullptr;
Karl 2015/11/10 16:32:21 Done.
+ for (const Variable *Var : Dests) {
+ if (!isScalarIntegerType(Var->getType()))
+ // TODO(kschimpf) Implement vpush.
+ return emitUsingTextFixup(Func);
+ assert((Var && Var->hasReg()) && "pop only applies to registers");
+ int32_t Reg = Var->getRegNum();
+ assert(Reg != RegARM32::Encoded_Not_GPR);
+ DestReg = Index;
Jim Stichnoth 2015/11/09 23:04:11 replace this with: LastDest = Var;
Karl 2015/11/10 16:32:22 Done.
+ GPRegisters |= (1 << Reg);
+ ++IntegerCount;
+ ++Index;
Jim Stichnoth 2015/11/09 23:04:11 remove this
Karl 2015/11/10 16:32:22 Done.
+ }
+ auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
+ switch (IntegerCount) {
+ case 0:
+ return;
+ case 1: {
+ if (const Variable *Var = Dests[DestReg]) {
Jim Stichnoth 2015/11/09 23:04:11 use LastDest instead of Dests[DestReg] Also, Last
Karl 2015/11/10 16:32:21 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(GPRegisters, CondARM32::AL);
+ break;
+ }
+ if (Asm->needsTextFixup())
+ emitUsingTextFixup(Func);
+}
+
void InstARM32Pop::dump(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
@@ -1199,17 +1244,17 @@ void InstARM32Push::emit(const Cfg *Func) const {
void InstARM32Push::emitIAS(const Cfg *Func) const {
SizeT SrcReg = 0;
SizeT IntegerCount = 0;
- ARM32::IValueT GPURegisters = 0;
- for (SizeT i = 0; i < getSrcSize(); ++i) {
- if (!isScalarIntegerType(getSrc(i)->getType()))
+ ARM32::IValueT GPRegisters = 0;
+ for (SizeT Index = 0; Index < getSrcSize(); ++Index) {
+ if (!isScalarIntegerType(getSrc(Index)->getType()))
// TODO(kschimpf) Implement vpush.
return emitUsingTextFixup(Func);
- auto *Var = llvm::dyn_cast<Variable>(getSrc(i));
+ auto *Var = llvm::dyn_cast<Variable>(getSrc(Index));
assert((Var && Var->hasReg()) && "push only applies to registers");
- ARM32::IValueT Reg = Var->getRegNum();
- assert(Reg != static_cast<ARM32::IValueT>(RegARM32::Encoded_Not_GPR));
- SrcReg = i;
- GPURegisters |= (1 << Reg);
+ int32_t Reg = Var->getRegNum();
+ assert(Reg != RegARM32::Encoded_Not_GPR);
+ SrcReg = Index;
+ GPRegisters |= (1 << Reg);
++IntegerCount;
}
auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
@@ -1234,7 +1279,7 @@ void InstARM32Push::emitIAS(const Cfg *Func) const {
}
default:
// TODO(kschimpf) Implement pushList in assembler.
- Asm->pushList(GPURegisters, CondARM32::AL);
+ Asm->pushList(GPRegisters, CondARM32::AL);
break;
}
if (Asm->needsTextFixup())
« no previous file with comments | « src/IceInstARM32.h ('k') | tests_lit/assembler/arm32/bic.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698