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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 | 77 |
78 void InstARM32Pred::dumpOpcodePred(Ostream &Str, const char *Opcode, | 78 void InstARM32Pred::dumpOpcodePred(Ostream &Str, const char *Opcode, |
79 Type Ty) const { | 79 Type Ty) const { |
80 Str << Opcode << getPredicate() << "." << Ty; | 80 Str << Opcode << getPredicate() << "." << Ty; |
81 } | 81 } |
82 | 82 |
83 CondARM32::Cond InstARM32::getOppositeCondition(CondARM32::Cond Cond) { | 83 CondARM32::Cond InstARM32::getOppositeCondition(CondARM32::Cond Cond) { |
84 return InstARM32CondAttributes[Cond].Opposite; | 84 return InstARM32CondAttributes[Cond].Opposite; |
85 } | 85 } |
86 | 86 |
87 void InstARM32::startNextInst(const Cfg *Func) const { | |
88 if (auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>()) | |
89 Asm->startNextInst(); | |
90 } | |
91 | |
87 void InstARM32::emitUsingTextFixup(const Cfg *Func) const { | 92 void InstARM32::emitUsingTextFixup(const Cfg *Func) const { |
88 if (!BuildDefs::dump()) | 93 if (!BuildDefs::dump()) |
89 return; | 94 return; |
90 GlobalContext *Ctx = Func->getContext(); | 95 GlobalContext *Ctx = Func->getContext(); |
91 if (Ctx->getFlags().getDisableHybridAssembly()) { | 96 if (Ctx->getFlags().getDisableHybridAssembly()) { |
92 UnimplementedError(Ctx->getFlags()); | 97 UnimplementedError(Ctx->getFlags()); |
93 return; | 98 return; |
94 } | 99 } |
95 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 100 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
96 std::string Buffer; | 101 std::string Buffer; |
97 llvm::raw_string_ostream StrBuf(Buffer); | 102 llvm::raw_string_ostream StrBuf(Buffer); |
98 OstreamLocker L(Ctx); | 103 OstreamLocker L(Ctx); |
99 Ostream &OldStr = Ctx->getStrEmit(); | 104 Ostream &OldStr = Ctx->getStrEmit(); |
100 Ctx->setStrEmit(StrBuf); | 105 Ctx->setStrEmit(StrBuf); |
106 // Start counting instructions here, so that emit() methods don't | |
107 // need to call this for the first instruction. | |
108 Asm->startFirstInst(); | |
101 emit(Func); | 109 emit(Func); |
102 Ctx->setStrEmit(OldStr); | 110 Ctx->setStrEmit(OldStr); |
103 Asm->emitTextInst(StrBuf.str()); | 111 Asm->emitTextInst(StrBuf.str(), |
112 Asm->getNumberEmittedInsts() * sizeof(uint32_t)); | |
104 } | 113 } |
105 | 114 |
106 void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); } | 115 void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); } |
107 | 116 |
108 void InstARM32Pred::emitUnaryopGPR(const char *Opcode, | 117 void InstARM32Pred::emitUnaryopGPR(const char *Opcode, |
109 const InstARM32Pred *Inst, const Cfg *Func, | 118 const InstARM32Pred *Inst, const Cfg *Func, |
110 bool NeedsWidthSuffix) { | 119 bool NeedsWidthSuffix) { |
111 Ostream &Str = Func->getContext()->getStrEmit(); | 120 Ostream &Str = Func->getContext()->getStrEmit(); |
112 assert(Inst->getSrcSize() == 1); | 121 assert(Inst->getSrcSize() == 1); |
113 Type SrcTy = Inst->getSrc(0)->getType(); | 122 Type SrcTy = Inst->getSrc(0)->getType(); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 Str << "\t" | 804 Str << "\t" |
796 << "b" << getPredicate() << "\t"; | 805 << "b" << getPredicate() << "\t"; |
797 if (Label) { | 806 if (Label) { |
798 Str << Label->getName(Func); | 807 Str << Label->getName(Func); |
799 } else { | 808 } else { |
800 if (isUnconditionalBranch()) { | 809 if (isUnconditionalBranch()) { |
801 Str << getTargetFalse()->getAsmName(); | 810 Str << getTargetFalse()->getAsmName(); |
802 } else { | 811 } else { |
803 Str << getTargetTrue()->getAsmName(); | 812 Str << getTargetTrue()->getAsmName(); |
804 if (getTargetFalse()) { | 813 if (getTargetFalse()) { |
814 startNextInst(Func); | |
Jim Stichnoth
2015/11/04 23:45:26
This is interesting. Are our ARM conditional bran
| |
805 Str << "\n\t" | 815 Str << "\n\t" |
806 << "b" | 816 << "b" |
807 << "\t" << getTargetFalse()->getAsmName(); | 817 << "\t" << getTargetFalse()->getAsmName(); |
808 } | 818 } |
809 } | 819 } |
810 } | 820 } |
811 } | 821 } |
812 | 822 |
813 void InstARM32Br::emitIAS(const Cfg *Func) const { | 823 void InstARM32Br::emitIAS(const Cfg *Func) const { |
814 if (!Func->getContext()->getFlags().getAllowUnsafeIas()) | 824 if (!Func->getContext()->getFlags().getAllowUnsafeIas()) |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1054 Op->emit(Func); | 1064 Op->emit(Func); |
1055 PrintComma = true; | 1065 PrintComma = true; |
1056 } | 1066 } |
1057 } | 1067 } |
1058 Str << "}\n"; | 1068 Str << "}\n"; |
1059 } | 1069 } |
1060 | 1070 |
1061 for (const Operand *Op : Dests) { | 1071 for (const Operand *Op : Dests) { |
1062 if (isScalarIntegerType(Op->getType())) | 1072 if (isScalarIntegerType(Op->getType())) |
1063 continue; | 1073 continue; |
1074 startNextInst(Func); | |
1064 Str << "\t" | 1075 Str << "\t" |
1065 << "vpop" | 1076 << "vpop" |
1066 << "\t{"; | 1077 << "\t{"; |
1067 Op->emit(Func); | 1078 Op->emit(Func); |
1068 Str << "}\n"; | 1079 Str << "}\n"; |
1069 } | 1080 } |
1070 } | 1081 } |
1071 | 1082 |
1072 void InstARM32Pop::dump(const Cfg *Func) const { | 1083 void InstARM32Pop::dump(const Cfg *Func) const { |
1073 if (!BuildDefs::dump()) | 1084 if (!BuildDefs::dump()) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1124 Operand *Op = getSrc(i - 1); | 1135 Operand *Op = getSrc(i - 1); |
1125 if (isScalarIntegerType(Op->getType())) | 1136 if (isScalarIntegerType(Op->getType())) |
1126 continue; | 1137 continue; |
1127 Str << "\t" | 1138 Str << "\t" |
1128 << "vpush" | 1139 << "vpush" |
1129 << "\t{"; | 1140 << "\t{"; |
1130 Op->emit(Func); | 1141 Op->emit(Func); |
1131 Str << "}\n"; | 1142 Str << "}\n"; |
1132 } | 1143 } |
1133 if (IntegerCount != 0) { | 1144 if (IntegerCount != 0) { |
1145 startNextInst(Func); | |
1134 Str << "\t" | 1146 Str << "\t" |
1135 << "push" | 1147 << "push" |
1136 << "\t{"; | 1148 << "\t{"; |
1137 bool PrintComma = false; | 1149 bool PrintComma = false; |
1138 for (SizeT i = 0; i < getSrcSize(); ++i) { | 1150 for (SizeT i = 0; i < getSrcSize(); ++i) { |
1139 Operand *Op = getSrc(i); | 1151 Operand *Op = getSrc(i); |
1140 if (isScalarIntegerType(Op->getType())) { | 1152 if (isScalarIntegerType(Op->getType())) { |
1141 if (PrintComma) | 1153 if (PrintComma) |
1142 Str << ", "; | 1154 Str << ", "; |
1143 Op->emit(Func); | 1155 Op->emit(Func); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1591 template class InstARM32UnaryopGPR<InstARM32::Rbit, false>; | 1603 template class InstARM32UnaryopGPR<InstARM32::Rbit, false>; |
1592 template class InstARM32UnaryopGPR<InstARM32::Rev, false>; | 1604 template class InstARM32UnaryopGPR<InstARM32::Rev, false>; |
1593 template class InstARM32UnaryopGPR<InstARM32::Sxt, true>; | 1605 template class InstARM32UnaryopGPR<InstARM32::Sxt, true>; |
1594 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; | 1606 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; |
1595 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; | 1607 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; |
1596 | 1608 |
1597 template class InstARM32CmpLike<InstARM32::Cmp>; | 1609 template class InstARM32CmpLike<InstARM32::Cmp>; |
1598 template class InstARM32CmpLike<InstARM32::Tst>; | 1610 template class InstARM32CmpLike<InstARM32::Tst>; |
1599 | 1611 |
1600 } // end of namespace Ice | 1612 } // end of namespace Ice |
OLD | NEW |