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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1424923005: Add workaround to allow testing of ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 750
751 if (isMultiSource()) { 751 if (isMultiSource()) {
752 emitSingleDestMultiSource(Func); 752 emitSingleDestMultiSource(Func);
753 return; 753 return;
754 } 754 }
755 755
756 emitSingleDestSingleSource(Func); 756 emitSingleDestSingleSource(Func);
757 } 757 }
758 758
759 void InstARM32Mov::emitIAS(const Cfg *Func) const { 759 void InstARM32Mov::emitIAS(const Cfg *Func) const {
760 (void)Func; 760 if (!Func->getContext()->getFlags().getAllowUnsafeIas())
761 return emitUsingTextFixup(Func);
761 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type."); 762 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type.");
762 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 763 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
763 if (!(isMultiDest() || isMultiSource())) { 764 if (!(isMultiDest() || isMultiSource())) {
764 // Must be single source/dest. 765 // Must be single source/dest.
765 emitIASSingleDestSingleSource(Func); 766 emitIASSingleDestSingleSource(Func);
766 } 767 }
767 if (Asm->needsTextFixup()) 768 if (Asm->needsTextFixup())
768 emitUsingTextFixup(Func); 769 emitUsingTextFixup(Func);
769 } 770 }
770 771
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 if (getTargetFalse()) { 804 if (getTargetFalse()) {
804 Str << "\n\t" 805 Str << "\n\t"
805 << "b" 806 << "b"
806 << "\t" << getTargetFalse()->getAsmName(); 807 << "\t" << getTargetFalse()->getAsmName();
807 } 808 }
808 } 809 }
809 } 810 }
810 } 811 }
811 812
812 void InstARM32Br::emitIAS(const Cfg *Func) const { 813 void InstARM32Br::emitIAS(const Cfg *Func) const {
814 if (!Func->getContext()->getFlags().getAllowUnsafeIas())
815 return emitUsingTextFixup(Func);
813 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 816 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
814 if (Label) { 817 if (Label) {
815 Asm->b(Asm->getOrCreateLocalLabel(Label->getNumber()), getPredicate()); 818 Asm->b(Asm->getOrCreateLocalLabel(Label->getNumber()), getPredicate());
816 } else if (isUnconditionalBranch()) { 819 } else if (isUnconditionalBranch()) {
817 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex()), 820 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex()),
818 getPredicate()); 821 getPredicate());
819 } else { 822 } else {
820 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetTrue()->getIndex()), 823 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetTrue()->getIndex()),
821 getPredicate()); 824 getPredicate());
822 if (const CfgNode *False = getTargetFalse()) 825 if (const CfgNode *False = getTargetFalse())
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 891
889 void InstARM32Label::emit(const Cfg *Func) const { 892 void InstARM32Label::emit(const Cfg *Func) const {
890 if (!BuildDefs::dump()) 893 if (!BuildDefs::dump())
891 return; 894 return;
892 Ostream &Str = Func->getContext()->getStrEmit(); 895 Ostream &Str = Func->getContext()->getStrEmit();
893 Str << getName(Func) << ":"; 896 Str << getName(Func) << ":";
894 } 897 }
895 898
896 void InstARM32Label::emitIAS(const Cfg *Func) const { 899 void InstARM32Label::emitIAS(const Cfg *Func) const {
897 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 900 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
898 Asm->bindLocalLabel(Number); 901 Asm->bindLocalLabel(Func, this, Number);
899 if (Asm->needsTextFixup()) 902 if (Asm->needsTextFixup())
900 emitUsingTextFixup(Func); 903 emitUsingTextFixup(Func);
901 } 904 }
902 905
903 void InstARM32Label::dump(const Cfg *Func) const { 906 void InstARM32Label::dump(const Cfg *Func) const {
904 if (!BuildDefs::dump()) 907 if (!BuildDefs::dump())
905 return; 908 return;
906 Ostream &Str = Func->getContext()->getStrDump(); 909 Ostream &Str = Func->getContext()->getStrDump();
907 Str << getName(Func) << ":"; 910 Str << getName(Func) << ":";
908 } 911 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 Constant *Src0 = llvm::cast<Constant>(getSrc(0)); 987 Constant *Src0 = llvm::cast<Constant>(getSrc(0));
985 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) { 988 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) {
986 Str << "#:lower16:"; 989 Str << "#:lower16:";
987 CR->emitWithoutPrefix(Func->getTarget()); 990 CR->emitWithoutPrefix(Func->getTarget());
988 } else { 991 } else {
989 Src0->emit(Func); 992 Src0->emit(Func);
990 } 993 }
991 } 994 }
992 995
993 template <> void InstARM32Movw::emitIAS(const Cfg *Func) const { 996 template <> void InstARM32Movw::emitIAS(const Cfg *Func) const {
997 if (!Func->getContext()->getFlags().getAllowUnsafeIas())
998 return emitUsingTextFixup(Func);
994 assert(getSrcSize() == 1); 999 assert(getSrcSize() == 1);
995 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 1000 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
996 Asm->movw(getDest(), getSrc(0), getPredicate()); 1001 Asm->movw(getDest(), getSrc(0), getPredicate());
997 if (Asm->needsTextFixup()) 1002 if (Asm->needsTextFixup())
998 emitUsingTextFixup(Func); 1003 emitUsingTextFixup(Func);
999 } 1004 }
1000 1005
1001 template <> void InstARM32Movt::emit(const Cfg *Func) const { 1006 template <> void InstARM32Movt::emit(const Cfg *Func) const {
1002 if (!BuildDefs::dump()) 1007 if (!BuildDefs::dump())
1003 return; 1008 return;
1004 Ostream &Str = Func->getContext()->getStrEmit(); 1009 Ostream &Str = Func->getContext()->getStrEmit();
1005 assert(getSrcSize() == 2); 1010 assert(getSrcSize() == 2);
1006 Variable *Dest = getDest(); 1011 Variable *Dest = getDest();
1007 Constant *Src1 = llvm::cast<Constant>(getSrc(1)); 1012 Constant *Src1 = llvm::cast<Constant>(getSrc(1));
1008 Str << "\t" << Opcode << getPredicate() << "\t"; 1013 Str << "\t" << Opcode << getPredicate() << "\t";
1009 Dest->emit(Func); 1014 Dest->emit(Func);
1010 Str << ", "; 1015 Str << ", ";
1011 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { 1016 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) {
1012 Str << "#:upper16:"; 1017 Str << "#:upper16:";
1013 CR->emitWithoutPrefix(Func->getTarget()); 1018 CR->emitWithoutPrefix(Func->getTarget());
1014 } else { 1019 } else {
1015 Src1->emit(Func); 1020 Src1->emit(Func);
1016 } 1021 }
1017 } 1022 }
1018 1023
1019 template <> void InstARM32Movt::emitIAS(const Cfg *Func) const { 1024 template <> void InstARM32Movt::emitIAS(const Cfg *Func) const {
1025 if (!Func->getContext()->getFlags().getAllowUnsafeIas())
1026 return emitUsingTextFixup(Func);
1020 assert(getSrcSize() == 2); 1027 assert(getSrcSize() == 2);
1021 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); 1028 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
1022 Asm->movt(getDest(), getSrc(1), getPredicate()); 1029 Asm->movt(getDest(), getSrc(1), getPredicate());
1023 if (Asm->needsTextFixup()) 1030 if (Asm->needsTextFixup())
1024 emitUsingTextFixup(Func); 1031 emitUsingTextFixup(Func);
1025 } 1032 }
1026 1033
1027 void InstARM32Pop::emit(const Cfg *Func) const { 1034 void InstARM32Pop::emit(const Cfg *Func) const {
1028 // TODO(jpp): Improve FP register save/restore. 1035 // TODO(jpp): Improve FP register save/restore.
1029 if (!BuildDefs::dump()) 1036 if (!BuildDefs::dump())
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 template class InstARM32UnaryopGPR<InstARM32::Rbit, false>; 1591 template class InstARM32UnaryopGPR<InstARM32::Rbit, false>;
1585 template class InstARM32UnaryopGPR<InstARM32::Rev, false>; 1592 template class InstARM32UnaryopGPR<InstARM32::Rev, false>;
1586 template class InstARM32UnaryopGPR<InstARM32::Sxt, true>; 1593 template class InstARM32UnaryopGPR<InstARM32::Sxt, true>;
1587 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; 1594 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>;
1588 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; 1595 template class InstARM32UnaryopFP<InstARM32::Vsqrt>;
1589 1596
1590 template class InstARM32CmpLike<InstARM32::Cmp>; 1597 template class InstARM32CmpLike<InstARM32::Cmp>;
1591 template class InstARM32CmpLike<InstARM32::Tst>; 1598 template class InstARM32CmpLike<InstARM32::Tst>;
1592 1599
1593 } // end of namespace Ice 1600 } // end of namespace Ice
OLDNEW
« src/IceClFlags.h ('K') | « src/IceClFlags.cpp ('k') | tests_lit/assembler/arm32/bic.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698