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

Unified Diff: src/IceInstARM32.cpp

Issue 1348393002: Subzero. Fixes ARM32 VFP calling convention. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/IceTargetLoweringARM32.h » ('j') | src/IceTargetLoweringARM32.h » ('J')
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 9a6811541b312ce2be45be4854a56a18c40554af..f66c5ea75d3e494968d6f4217dfcbafeb73f4a70 100644
--- a/src/IceInstARM32.cpp
+++ b/src/IceInstARM32.cpp
@@ -540,26 +540,31 @@ void InstARM32Vmov::emitSingleDestMultiSource(const Cfg *Func) const {
Src1->emit(Func);
}
+namespace {
+bool isVariableWithoutRegister(Operand *Op) {
Jim Stichnoth 2015/09/16 21:31:54 Consider declaring these as const Operand * ?
John 2015/09/16 23:12:46 Done.
+ if (const auto *OpV = llvm::dyn_cast<Variable>(Op)) {
+ return !OpV->hasReg();
+ }
+ return false;
+}
+
+bool isMemoryAccess(Operand *Op) {
+ return isVariableWithoutRegister(Op) || llvm::isa<OperandARM32Mem>(Op);
+}
+} // end of anonymous namespace
+
void InstARM32Vmov::emitSingleDestSingleSource(const Cfg *Func) const {
if (!BuildDefs::dump())
return;
Ostream &Str = Func->getContext()->getStrEmit();
Variable *Dest = getDest();
if (Dest->hasReg()) {
- IceString ActualOpcode = "vmov";
Operand *Src0 = getSrc(0);
- if (const auto *Src0V = llvm::dyn_cast<Variable>(Src0)) {
- if (!Src0V->hasReg()) {
- ActualOpcode = IceString("vldr");
- }
- } else {
- if (llvm::isa<OperandARM32Mem>(Src0))
- ActualOpcode = IceString("vldr");
- }
+ const char *ActualOpcode = isMemoryAccess(Src0) ? "vldr" : "vmov";
Str << "\t" << ActualOpcode << "\t";
- getDest()->emit(Func);
+ Dest->emit(Func);
Str << ", ";
- getSrc(0)->emit(Func);
+ Src0->emit(Func);
} else {
Variable *Src0 = llvm::cast<Variable>(getSrc(0));
assert(Src0->hasReg());
@@ -899,8 +904,8 @@ void InstARM32Str::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 2);
Type Ty = getSrc(0)->getType();
- Str << "\t"
- << "str" << getWidthString(Ty) << getPredicate() << "\t";
+ const char *Opcode = isScalarFloatingType(Ty) ? "vstr" : "str";
+ Str << "\t" << Opcode << getWidthString(Ty) << getPredicate() << "\t";
getSrc(0)->emit(Func);
Str << ", ";
getSrc(1)->emit(Func);
« no previous file with comments | « no previous file | src/IceTargetLoweringARM32.h » ('j') | src/IceTargetLoweringARM32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698