| 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 startNextInst(Func); | 835 startNextInst(Func); |
| 836 Str << "\n\t" | 836 Str << "\n\t" |
| 837 << "b" | 837 << "b" |
| 838 << "\t" << getTargetFalse()->getAsmName(); | 838 << "\t" << getTargetFalse()->getAsmName(); |
| 839 } | 839 } |
| 840 } | 840 } |
| 841 } | 841 } |
| 842 } | 842 } |
| 843 | 843 |
| 844 void InstARM32Br::emitIAS(const Cfg *Func) const { | 844 void InstARM32Br::emitIAS(const Cfg *Func) const { |
| 845 if (!Func->getContext()->getFlags().getAllowUnsafeIas()) | |
| 846 return emitUsingTextFixup(Func); | |
| 847 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 845 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 848 if (Label) { | 846 if (Label) { |
| 849 Asm->b(Asm->getOrCreateLocalLabel(Label->getNumber()), getPredicate()); | 847 Asm->b(Asm->getOrCreateLocalLabel(Label->getNumber()), getPredicate()); |
| 850 } else if (isUnconditionalBranch()) { | 848 } else if (isUnconditionalBranch()) { |
| 851 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex()), | 849 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetFalse()->getIndex()), |
| 852 getPredicate()); | 850 getPredicate()); |
| 853 } else { | 851 } else { |
| 854 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetTrue()->getIndex()), | 852 Asm->b(Asm->getOrCreateCfgNodeLabel(getTargetTrue()->getIndex()), |
| 855 getPredicate()); | 853 getPredicate()); |
| 856 if (const CfgNode *False = getTargetFalse()) | 854 if (const CfgNode *False = getTargetFalse()) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 dumpDest(Func); | 914 dumpDest(Func); |
| 917 Str << " = "; | 915 Str << " = "; |
| 918 } | 916 } |
| 919 Str << "call "; | 917 Str << "call "; |
| 920 getCallTarget()->dump(Func); | 918 getCallTarget()->dump(Func); |
| 921 } | 919 } |
| 922 | 920 |
| 923 void InstARM32Label::emit(const Cfg *Func) const { | 921 void InstARM32Label::emit(const Cfg *Func) const { |
| 924 if (!BuildDefs::dump()) | 922 if (!BuildDefs::dump()) |
| 925 return; | 923 return; |
| 924 // A label is not really an instruction. Hence, we need to fix the |
| 925 // emitted text size. |
| 926 if (auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>()) |
| 927 Asm->decEmitTextSize(InstSize); |
| 926 Ostream &Str = Func->getContext()->getStrEmit(); | 928 Ostream &Str = Func->getContext()->getStrEmit(); |
| 927 Str << getName(Func) << ":"; | 929 Str << getName(Func) << ":"; |
| 928 } | 930 } |
| 929 | 931 |
| 930 void InstARM32Label::emitIAS(const Cfg *Func) const { | 932 void InstARM32Label::emitIAS(const Cfg *Func) const { |
| 931 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 933 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 932 Asm->bindLocalLabel(Func, this, Number); | 934 Asm->bindLocalLabel(Func, this, Number); |
| 933 if (Asm->needsTextFixup()) | 935 if (Asm->needsTextFixup()) |
| 934 emitUsingTextFixup(Func); | 936 emitUsingTextFixup(Func); |
| 935 } | 937 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 Constant *Src0 = llvm::cast<Constant>(getSrc(0)); | 1020 Constant *Src0 = llvm::cast<Constant>(getSrc(0)); |
| 1019 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) { | 1021 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) { |
| 1020 Str << "#:lower16:"; | 1022 Str << "#:lower16:"; |
| 1021 CR->emitWithoutPrefix(Func->getTarget()); | 1023 CR->emitWithoutPrefix(Func->getTarget()); |
| 1022 } else { | 1024 } else { |
| 1023 Src0->emit(Func); | 1025 Src0->emit(Func); |
| 1024 } | 1026 } |
| 1025 } | 1027 } |
| 1026 | 1028 |
| 1027 template <> void InstARM32Movw::emitIAS(const Cfg *Func) const { | 1029 template <> void InstARM32Movw::emitIAS(const Cfg *Func) const { |
| 1028 if (!Func->getContext()->getFlags().getAllowUnsafeIas()) | |
| 1029 return emitUsingTextFixup(Func); | |
| 1030 assert(getSrcSize() == 1); | 1030 assert(getSrcSize() == 1); |
| 1031 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 1031 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 1032 Asm->movw(getDest(), getSrc(0), getPredicate()); | 1032 Asm->movw(getDest(), getSrc(0), getPredicate()); |
| 1033 if (Asm->needsTextFixup()) | 1033 if (Asm->needsTextFixup()) |
| 1034 emitUsingTextFixup(Func); | 1034 emitUsingTextFixup(Func); |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 template <> void InstARM32Movt::emit(const Cfg *Func) const { | 1037 template <> void InstARM32Movt::emit(const Cfg *Func) const { |
| 1038 if (!BuildDefs::dump()) | 1038 if (!BuildDefs::dump()) |
| 1039 return; | 1039 return; |
| 1040 Ostream &Str = Func->getContext()->getStrEmit(); | 1040 Ostream &Str = Func->getContext()->getStrEmit(); |
| 1041 assert(getSrcSize() == 2); | 1041 assert(getSrcSize() == 2); |
| 1042 Variable *Dest = getDest(); | 1042 Variable *Dest = getDest(); |
| 1043 Constant *Src1 = llvm::cast<Constant>(getSrc(1)); | 1043 Constant *Src1 = llvm::cast<Constant>(getSrc(1)); |
| 1044 Str << "\t" << Opcode << getPredicate() << "\t"; | 1044 Str << "\t" << Opcode << getPredicate() << "\t"; |
| 1045 Dest->emit(Func); | 1045 Dest->emit(Func); |
| 1046 Str << ", "; | 1046 Str << ", "; |
| 1047 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { | 1047 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { |
| 1048 Str << "#:upper16:"; | 1048 Str << "#:upper16:"; |
| 1049 CR->emitWithoutPrefix(Func->getTarget()); | 1049 CR->emitWithoutPrefix(Func->getTarget()); |
| 1050 } else { | 1050 } else { |
| 1051 Src1->emit(Func); | 1051 Src1->emit(Func); |
| 1052 } | 1052 } |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 template <> void InstARM32Movt::emitIAS(const Cfg *Func) const { | 1055 template <> void InstARM32Movt::emitIAS(const Cfg *Func) const { |
| 1056 if (!Func->getContext()->getFlags().getAllowUnsafeIas()) | |
| 1057 return emitUsingTextFixup(Func); | |
| 1058 assert(getSrcSize() == 2); | 1056 assert(getSrcSize() == 2); |
| 1059 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 1057 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 1060 Asm->movt(getDest(), getSrc(1), getPredicate()); | 1058 Asm->movt(getDest(), getSrc(1), getPredicate()); |
| 1061 if (Asm->needsTextFixup()) | 1059 if (Asm->needsTextFixup()) |
| 1062 emitUsingTextFixup(Func); | 1060 emitUsingTextFixup(Func); |
| 1063 } | 1061 } |
| 1064 | 1062 |
| 1065 void InstARM32Pop::emit(const Cfg *Func) const { | 1063 void InstARM32Pop::emit(const Cfg *Func) const { |
| 1066 // TODO(jpp): Improve FP register save/restore. | 1064 // TODO(jpp): Improve FP register save/restore. |
| 1067 if (!BuildDefs::dump()) | 1065 if (!BuildDefs::dump()) |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; | 1625 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; |
| 1628 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; | 1626 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; |
| 1629 | 1627 |
| 1630 template class InstARM32FourAddrGPR<InstARM32::Mla>; | 1628 template class InstARM32FourAddrGPR<InstARM32::Mla>; |
| 1631 template class InstARM32FourAddrGPR<InstARM32::Mls>; | 1629 template class InstARM32FourAddrGPR<InstARM32::Mls>; |
| 1632 | 1630 |
| 1633 template class InstARM32CmpLike<InstARM32::Cmp>; | 1631 template class InstARM32CmpLike<InstARM32::Cmp>; |
| 1634 template class InstARM32CmpLike<InstARM32::Tst>; | 1632 template class InstARM32CmpLike<InstARM32::Tst>; |
| 1635 | 1633 |
| 1636 } // end of namespace Ice | 1634 } // end of namespace Ice |
| OLD | NEW |