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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1419903002: Subzero: Refactor x86 register definitions to use the alias mechanism. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add some comments 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 unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===// 1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 const bool DestIsScalarFP = isScalarFloatingType(Dest->getType()); 600 const bool DestIsScalarFP = isScalarFloatingType(Dest->getType());
601 const bool CoreVFPMove = isMoveBetweenCoreAndVFPRegisters(Dest, Src0); 601 const bool CoreVFPMove = isMoveBetweenCoreAndVFPRegisters(Dest, Src0);
602 const char *LoadOpcode = 602 const char *LoadOpcode =
603 DestIsVector ? "vld1" : (DestIsScalarFP ? "vldr" : "ldr"); 603 DestIsVector ? "vld1" : (DestIsScalarFP ? "vldr" : "ldr");
604 const char *RegMovOpcode = 604 const char *RegMovOpcode =
605 (DestIsVector || DestIsScalarFP || CoreVFPMove) ? "vmov" : "mov"; 605 (DestIsVector || DestIsScalarFP || CoreVFPMove) ? "vmov" : "mov";
606 const char *ActualOpcode = isMemoryAccess(Src0) ? LoadOpcode : RegMovOpcode; 606 const char *ActualOpcode = isMemoryAccess(Src0) ? LoadOpcode : RegMovOpcode;
607 // when vmov{c}'ing, we need to emit a width string. Otherwise, the 607 // when vmov{c}'ing, we need to emit a width string. Otherwise, the
608 // assembler might be tempted to assume we want a vector vmov{c}, and that 608 // assembler might be tempted to assume we want a vector vmov{c}, and that
609 // is disallowed because ARM. 609 // is disallowed because ARM.
610 const char *NoWidthString = ""; 610 const char *NoWidthString = "";
Karl 2015/10/27 16:13:18 constexprs?
Jim Stichnoth 2015/10/27 19:14:09 C++ compiler says no.
611 const char *WidthString = 611 const char *WidthString =
612 isMemoryAccess(Src0) 612 isMemoryAccess(Src0)
613 ? (DestIsVector ? ".64" : NoWidthString) 613 ? (DestIsVector ? ".64" : NoWidthString)
614 : (!CoreVFPMove ? getVecWidthString(DestTy) : NoWidthString); 614 : (!CoreVFPMove ? getVecWidthString(DestTy) : NoWidthString);
615 615
616 Str << "\t" << ActualOpcode << getPredicate() << WidthString << "\t"; 616 Str << "\t" << ActualOpcode << getPredicate() << WidthString << "\t";
617 Dest->emit(Func); 617 Dest->emit(Func);
618 Str << ", "; 618 Str << ", ";
619 Src0->emit(Func); 619 Src0->emit(Func);
620 } else { 620 } else {
621 Variable *Src0 = llvm::cast<Variable>(getSrc(0)); 621 Variable *Src0 = llvm::cast<Variable>(getSrc(0));
622 assert(Src0->hasReg()); 622 assert(Src0->hasReg());
623 const char *ActualOpcode = 623 const char *ActualOpcode =
624 isVectorType(Src0->getType()) 624 isVectorType(Src0->getType())
625 ? "vst1" 625 ? "vst1"
626 : (isScalarFloatingType(Src0->getType()) ? "vstr" : "str"); 626 : (isScalarFloatingType(Src0->getType()) ? "vstr" : "str");
627 const char *NoWidthString = ""; 627 const char *NoWidthString = "";
Karl 2015/10/27 16:13:19 constexprs?
Jim Stichnoth 2015/10/27 19:14:09 C++ compiler says no.
628 const char *WidthString = 628 const char *WidthString =
629 isVectorType(Src0->getType()) ? ".64" : NoWidthString; 629 isVectorType(Src0->getType()) ? ".64" : NoWidthString;
630 Str << "\t" << ActualOpcode << getPredicate() << WidthString << "\t"; 630 Str << "\t" << ActualOpcode << getPredicate() << WidthString << "\t";
631 Src0->emit(Func); 631 Src0->emit(Func);
632 Str << ", "; 632 Str << ", ";
633 Dest->emit(Func); 633 Dest->emit(Func);
634 } 634 }
635 } 635 }
636 636
637 void InstARM32Mov::emitIASSingleDestSingleSource(const Cfg *Func) const { 637 void InstARM32Mov::emitIASSingleDestSingleSource(const Cfg *Func) const {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 852
853 template <> void InstARM32Movw::emit(const Cfg *Func) const { 853 template <> void InstARM32Movw::emit(const Cfg *Func) const {
854 if (!BuildDefs::dump()) 854 if (!BuildDefs::dump())
855 return; 855 return;
856 Ostream &Str = Func->getContext()->getStrEmit(); 856 Ostream &Str = Func->getContext()->getStrEmit();
857 assert(getSrcSize() == 1); 857 assert(getSrcSize() == 1);
858 Str << "\t" << Opcode << getPredicate() << "\t"; 858 Str << "\t" << Opcode << getPredicate() << "\t";
859 getDest()->emit(Func); 859 getDest()->emit(Func);
860 Str << ", "; 860 Str << ", ";
861 Constant *Src0 = llvm::cast<Constant>(getSrc(0)); 861 Constant *Src0 = llvm::cast<Constant>(getSrc(0));
862 if (auto CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) { 862 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) {
863 Str << "#:lower16:"; 863 Str << "#:lower16:";
864 CR->emitWithoutPrefix(Func->getTarget()); 864 CR->emitWithoutPrefix(Func->getTarget());
865 } else { 865 } else {
866 Src0->emit(Func); 866 Src0->emit(Func);
867 } 867 }
868 } 868 }
869 869
870 template <> void InstARM32Movt::emit(const Cfg *Func) const { 870 template <> void InstARM32Movt::emit(const Cfg *Func) const {
871 if (!BuildDefs::dump()) 871 if (!BuildDefs::dump())
872 return; 872 return;
873 Ostream &Str = Func->getContext()->getStrEmit(); 873 Ostream &Str = Func->getContext()->getStrEmit();
874 assert(getSrcSize() == 2); 874 assert(getSrcSize() == 2);
875 Variable *Dest = getDest(); 875 Variable *Dest = getDest();
876 Constant *Src1 = llvm::cast<Constant>(getSrc(1)); 876 Constant *Src1 = llvm::cast<Constant>(getSrc(1));
877 Str << "\t" << Opcode << getPredicate() << "\t"; 877 Str << "\t" << Opcode << getPredicate() << "\t";
878 Dest->emit(Func); 878 Dest->emit(Func);
879 Str << ", "; 879 Str << ", ";
880 if (auto CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { 880 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) {
881 Str << "#:upper16:"; 881 Str << "#:upper16:";
882 CR->emitWithoutPrefix(Func->getTarget()); 882 CR->emitWithoutPrefix(Func->getTarget());
883 } else { 883 } else {
884 Src1->emit(Func); 884 Src1->emit(Func);
885 } 885 }
886 } 886 }
887 887
888 void InstARM32Pop::emit(const Cfg *Func) const { 888 void InstARM32Pop::emit(const Cfg *Func) const {
889 // TODO(jpp): Improve FP register save/restore. 889 // TODO(jpp): Improve FP register save/restore.
890 if (!BuildDefs::dump()) 890 if (!BuildDefs::dump())
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 template class InstARM32ThreeAddrGPR<InstARM32::Udiv>; 1417 template class InstARM32ThreeAddrGPR<InstARM32::Udiv>;
1418 1418
1419 template class InstARM32ThreeAddrFP<InstARM32::Vadd>; 1419 template class InstARM32ThreeAddrFP<InstARM32::Vadd>;
1420 template class InstARM32ThreeAddrFP<InstARM32::Vdiv>; 1420 template class InstARM32ThreeAddrFP<InstARM32::Vdiv>;
1421 template class InstARM32ThreeAddrFP<InstARM32::Vmul>; 1421 template class InstARM32ThreeAddrFP<InstARM32::Vmul>;
1422 template class InstARM32ThreeAddrFP<InstARM32::Vsub>; 1422 template class InstARM32ThreeAddrFP<InstARM32::Vsub>;
1423 1423
1424 template class InstARM32TwoAddrGPR<InstARM32::Movt>; 1424 template class InstARM32TwoAddrGPR<InstARM32::Movt>;
1425 1425
1426 } // end of namespace Ice 1426 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698