OLD | NEW |
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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 Str << ", "; | 867 Str << ", "; |
868 if (auto CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { | 868 if (auto CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { |
869 Str << "#:upper16:"; | 869 Str << "#:upper16:"; |
870 CR->emitWithoutPrefix(Func->getTarget()); | 870 CR->emitWithoutPrefix(Func->getTarget()); |
871 } else { | 871 } else { |
872 Src1->emit(Func); | 872 Src1->emit(Func); |
873 } | 873 } |
874 } | 874 } |
875 | 875 |
876 void InstARM32Pop::emit(const Cfg *Func) const { | 876 void InstARM32Pop::emit(const Cfg *Func) const { |
| 877 // TODO(jpp): Improve FP register save/restore. |
877 if (!BuildDefs::dump()) | 878 if (!BuildDefs::dump()) |
878 return; | 879 return; |
879 SizeT IntegerCount = 0; | 880 SizeT IntegerCount = 0; |
880 for (const Operand *Op : Dests) { | 881 for (const Operand *Op : Dests) { |
881 if (isScalarIntegerType(Op->getType())) { | 882 if (isScalarIntegerType(Op->getType())) { |
882 ++IntegerCount; | 883 ++IntegerCount; |
883 } | 884 } |
884 } | 885 } |
885 Ostream &Str = Func->getContext()->getStrEmit(); | 886 Ostream &Str = Func->getContext()->getStrEmit(); |
886 if (IntegerCount == 0) { | 887 if (IntegerCount != 0) { |
887 Str << "\t@ empty pop"; | 888 Str << "\t" |
888 return; | 889 << "pop" |
| 890 << "\t{"; |
| 891 bool PrintComma = false; |
| 892 for (const Operand *Op : Dests) { |
| 893 if (isScalarIntegerType(Op->getType())) { |
| 894 if (PrintComma) |
| 895 Str << ", "; |
| 896 Op->emit(Func); |
| 897 PrintComma = true; |
| 898 } |
| 899 } |
| 900 Str << "}\n"; |
889 } | 901 } |
890 Str << "\t" | 902 |
891 << "pop" | |
892 << "\t{"; | |
893 bool PrintComma = false; | |
894 for (const Operand *Op : Dests) { | 903 for (const Operand *Op : Dests) { |
895 if (isScalarIntegerType(Op->getType())) { | 904 if (isScalarIntegerType(Op->getType())) |
896 if (PrintComma) | 905 continue; |
897 Str << ", "; | 906 Str << "\t" |
898 Op->emit(Func); | 907 << "vpop" |
899 PrintComma = true; | 908 << "\t{"; |
900 } | 909 Op->emit(Func); |
| 910 Str << "}\n"; |
901 } | 911 } |
902 Str << "}"; | |
903 } | 912 } |
904 | 913 |
905 void InstARM32Pop::emitIAS(const Cfg *Func) const { | 914 void InstARM32Pop::emitIAS(const Cfg *Func) const { |
906 (void)Func; | 915 (void)Func; |
907 llvm_unreachable("Not yet implemented"); | 916 llvm_unreachable("Not yet implemented"); |
908 } | 917 } |
909 | 918 |
910 void InstARM32Pop::dump(const Cfg *Func) const { | 919 void InstARM32Pop::dump(const Cfg *Func) const { |
911 if (!BuildDefs::dump()) | 920 if (!BuildDefs::dump()) |
912 return; | 921 return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 return; | 956 return; |
948 Ostream &Str = Func->getContext()->getStrDump(); | 957 Ostream &Str = Func->getContext()->getStrDump(); |
949 getDest()->dump(Func); | 958 getDest()->dump(Func); |
950 Str << " = sub.i32 "; | 959 Str << " = sub.i32 "; |
951 getSrc(0)->dump(Func); | 960 getSrc(0)->dump(Func); |
952 Str << ", " << Amount << " ; "; | 961 Str << ", " << Amount << " ; "; |
953 getSrc(1)->dump(Func); | 962 getSrc(1)->dump(Func); |
954 } | 963 } |
955 | 964 |
956 void InstARM32Push::emit(const Cfg *Func) const { | 965 void InstARM32Push::emit(const Cfg *Func) const { |
| 966 // TODO(jpp): Improve FP register save/restore. |
957 if (!BuildDefs::dump()) | 967 if (!BuildDefs::dump()) |
958 return; | 968 return; |
959 SizeT IntegerCount = 0; | 969 SizeT IntegerCount = 0; |
960 for (SizeT i = 0; i < getSrcSize(); ++i) { | 970 for (SizeT i = 0; i < getSrcSize(); ++i) { |
961 if (isScalarIntegerType(getSrc(i)->getType())) { | 971 if (isScalarIntegerType(getSrc(i)->getType())) { |
962 ++IntegerCount; | 972 ++IntegerCount; |
963 } | 973 } |
964 } | 974 } |
965 Ostream &Str = Func->getContext()->getStrEmit(); | 975 Ostream &Str = Func->getContext()->getStrEmit(); |
966 if (IntegerCount == 0) { | 976 for (SizeT i = getSrcSize(); i > 0; --i) { |
| 977 Operand *Op = getSrc(i - 1); |
| 978 if (isScalarIntegerType(Op->getType())) |
| 979 continue; |
967 Str << "\t" | 980 Str << "\t" |
968 << "@empty push"; | 981 << "vpush" |
969 return; | 982 << "\t{"; |
| 983 Op->emit(Func); |
| 984 Str << "}\n"; |
970 } | 985 } |
971 Str << "\t" | 986 if (IntegerCount != 0) { |
972 << "push" | 987 Str << "\t" |
973 << "\t{"; | 988 << "push" |
974 bool PrintComma = false; | 989 << "\t{"; |
975 for (SizeT i = 0; i < getSrcSize(); ++i) { | 990 bool PrintComma = false; |
976 Operand *Op = getSrc(i); | 991 for (SizeT i = 0; i < getSrcSize(); ++i) { |
977 if (isScalarIntegerType(Op->getType())) { | 992 Operand *Op = getSrc(i); |
978 if (PrintComma) | 993 if (isScalarIntegerType(Op->getType())) { |
979 Str << ", "; | 994 if (PrintComma) |
980 Op->emit(Func); | 995 Str << ", "; |
981 PrintComma = true; | 996 Op->emit(Func); |
| 997 PrintComma = true; |
| 998 } |
982 } | 999 } |
| 1000 Str << "}\n"; |
983 } | 1001 } |
984 Str << "}"; | |
985 } | 1002 } |
986 | 1003 |
987 void InstARM32Push::emitIAS(const Cfg *Func) const { | 1004 void InstARM32Push::emitIAS(const Cfg *Func) const { |
988 (void)Func; | 1005 (void)Func; |
989 llvm_unreachable("Not yet implemented"); | 1006 llvm_unreachable("Not yet implemented"); |
990 } | 1007 } |
991 | 1008 |
992 void InstARM32Push::dump(const Cfg *Func) const { | 1009 void InstARM32Push::dump(const Cfg *Func) const { |
993 if (!BuildDefs::dump()) | 1010 if (!BuildDefs::dump()) |
994 return; | 1011 return; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 template class InstARM32ThreeAddrGPR<InstARM32::Sbc>; | 1470 template class InstARM32ThreeAddrGPR<InstARM32::Sbc>; |
1454 template class InstARM32ThreeAddrGPR<InstARM32::Sdiv>; | 1471 template class InstARM32ThreeAddrGPR<InstARM32::Sdiv>; |
1455 template class InstARM32ThreeAddrGPR<InstARM32::Sub>; | 1472 template class InstARM32ThreeAddrGPR<InstARM32::Sub>; |
1456 template class InstARM32ThreeAddrGPR<InstARM32::Udiv>; | 1473 template class InstARM32ThreeAddrGPR<InstARM32::Udiv>; |
1457 template class InstARM32ThreeAddrFP<InstARM32::Vadd>; | 1474 template class InstARM32ThreeAddrFP<InstARM32::Vadd>; |
1458 template class InstARM32ThreeAddrFP<InstARM32::Vdiv>; | 1475 template class InstARM32ThreeAddrFP<InstARM32::Vdiv>; |
1459 template class InstARM32ThreeAddrFP<InstARM32::Vmul>; | 1476 template class InstARM32ThreeAddrFP<InstARM32::Vmul>; |
1460 template class InstARM32ThreeAddrFP<InstARM32::Vsub>; | 1477 template class InstARM32ThreeAddrFP<InstARM32::Vsub>; |
1461 | 1478 |
1462 } // end of namespace Ice | 1479 } // end of namespace Ice |
OLD | NEW |