OLD | NEW |
1 //===- subzero/src/IceInst.cpp - High-level instruction implementation ----===// | 1 //===- subzero/src/IceInst.cpp - High-level 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 X(Store, "store"); | 105 X(Store, "store"); |
106 X(Switch, "switch"); | 106 X(Switch, "switch"); |
107 X(Assign, "assign"); | 107 X(Assign, "assign"); |
108 X(Breakpoint, "break"); | 108 X(Breakpoint, "break"); |
109 X(BundleLock, "bundlelock"); | 109 X(BundleLock, "bundlelock"); |
110 X(BundleUnlock, "bundleunlock"); | 110 X(BundleUnlock, "bundleunlock"); |
111 X(FakeDef, "fakedef"); | 111 X(FakeDef, "fakedef"); |
112 X(FakeUse, "fakeuse"); | 112 X(FakeUse, "fakeuse"); |
113 X(FakeKill, "fakekill"); | 113 X(FakeKill, "fakekill"); |
114 X(JumpTable, "jumptable"); | 114 X(JumpTable, "jumptable"); |
| 115 X(ShuffleVector, "shufflevector"); |
115 #undef X | 116 #undef X |
116 default: | 117 default: |
117 assert(Kind >= Target); | 118 assert(Kind >= Target); |
118 return "target"; | 119 return "target"; |
119 } | 120 } |
120 } | 121 } |
121 | 122 |
122 // Assign the instruction a new number. | 123 // Assign the instruction a new number. |
123 void Inst::renumber(Cfg *Func) { | 124 void Inst::renumber(Cfg *Func) { |
124 Number = isDeleted() ? NumberDeleted : Func->newInstNumber(); | 125 Number = isDeleted() ? NumberDeleted : Func->newInstNumber(); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src, uint32_t Weight) | 568 InstFakeUse::InstFakeUse(Cfg *Func, Variable *Src, uint32_t Weight) |
568 : InstHighLevel(Func, Inst::FakeUse, Weight, nullptr) { | 569 : InstHighLevel(Func, Inst::FakeUse, Weight, nullptr) { |
569 assert(Src); | 570 assert(Src); |
570 for (uint32_t i = 0; i < Weight; ++i) | 571 for (uint32_t i = 0; i < Weight; ++i) |
571 addSource(Src); | 572 addSource(Src); |
572 } | 573 } |
573 | 574 |
574 InstFakeKill::InstFakeKill(Cfg *Func, const Inst *Linked) | 575 InstFakeKill::InstFakeKill(Cfg *Func, const Inst *Linked) |
575 : InstHighLevel(Func, Inst::FakeKill, 0, nullptr), Linked(Linked) {} | 576 : InstHighLevel(Func, Inst::FakeKill, 0, nullptr), Linked(Linked) {} |
576 | 577 |
| 578 InstShuffleVector::InstShuffleVector(Cfg *Func, Variable *Dest, Variable *Src0, |
| 579 Variable *Src1) |
| 580 : InstHighLevel(Func, Inst::ShuffleVector, 2, Dest), |
| 581 NumIndexes(typeNumElements(Dest->getType())) { |
| 582 addSource(Src0); |
| 583 addSource(Src1); |
| 584 Indexes = Func->allocateArrayOf<ConstantInteger32 *>(NumIndexes); |
| 585 } |
| 586 |
577 namespace { | 587 namespace { |
578 GlobalString makeName(Cfg *Func, const SizeT Id) { | 588 GlobalString makeName(Cfg *Func, const SizeT Id) { |
579 const auto FuncName = Func->getFunctionName(); | 589 const auto FuncName = Func->getFunctionName(); |
580 auto *Ctx = Func->getContext(); | 590 auto *Ctx = Func->getContext(); |
581 if (FuncName.hasStdString()) | 591 if (FuncName.hasStdString()) |
582 return GlobalString::createWithString( | 592 return GlobalString::createWithString( |
583 Ctx, ".L" + FuncName.toString() + "$jumptable$__" + std::to_string(Id)); | 593 Ctx, ".L" + FuncName.toString() + "$jumptable$__" + std::to_string(Id)); |
584 return GlobalString::createWithString( | 594 return GlobalString::createWithString( |
585 Ctx, "$J" + std::to_string(FuncName.getID()) + "_" + std::to_string(Id)); | 595 Ctx, "$J" + std::to_string(FuncName.getID()) + "_" + std::to_string(Id)); |
586 } | 596 } |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 | 1035 |
1026 void InstFakeKill::dump(const Cfg *Func) const { | 1036 void InstFakeKill::dump(const Cfg *Func) const { |
1027 if (!BuildDefs::dump()) | 1037 if (!BuildDefs::dump()) |
1028 return; | 1038 return; |
1029 Ostream &Str = Func->getContext()->getStrDump(); | 1039 Ostream &Str = Func->getContext()->getStrDump(); |
1030 if (Linked->isDeleted()) | 1040 if (Linked->isDeleted()) |
1031 Str << "// "; | 1041 Str << "// "; |
1032 Str << "kill.pseudo scratch_regs"; | 1042 Str << "kill.pseudo scratch_regs"; |
1033 } | 1043 } |
1034 | 1044 |
| 1045 void InstShuffleVector::dump(const Cfg *Func) const { |
| 1046 if (!BuildDefs::dump()) |
| 1047 return; |
| 1048 Ostream &Str = Func->getContext()->getStrDump(); |
| 1049 Str << "shufflevector "; |
| 1050 dumpDest(Func); |
| 1051 Str << " = "; |
| 1052 dumpSources(Func); |
| 1053 for (SizeT I = 0; I < NumIndexes; ++I) { |
| 1054 Str << ", "; |
| 1055 Indexes[I]->dump(Func); |
| 1056 } |
| 1057 Str << "\n"; |
| 1058 } |
| 1059 |
1035 void InstJumpTable::dump(const Cfg *Func) const { | 1060 void InstJumpTable::dump(const Cfg *Func) const { |
1036 if (!BuildDefs::dump()) | 1061 if (!BuildDefs::dump()) |
1037 return; | 1062 return; |
1038 Ostream &Str = Func->getContext()->getStrDump(); | 1063 Ostream &Str = Func->getContext()->getStrDump(); |
1039 Str << "jump table ["; | 1064 Str << "jump table ["; |
1040 for (SizeT I = 0; I < NumTargets; ++I) | 1065 for (SizeT I = 0; I < NumTargets; ++I) |
1041 Str << "\n " << Targets[I]->getName(); | 1066 Str << "\n " << Targets[I]->getName(); |
1042 Str << "\n ]"; | 1067 Str << "\n ]"; |
1043 } | 1068 } |
1044 | 1069 |
(...skipping 17 matching lines...) Expand all Loading... |
1062 // upper 32 bits of rax. We need to recognize and preserve these. | 1087 // upper 32 bits of rax. We need to recognize and preserve these. |
1063 return true; | 1088 return true; |
1064 } | 1089 } |
1065 if (!Dest->hasReg() && !SrcVar->hasReg() && | 1090 if (!Dest->hasReg() && !SrcVar->hasReg() && |
1066 Dest->getStackOffset() == SrcVar->getStackOffset()) | 1091 Dest->getStackOffset() == SrcVar->getStackOffset()) |
1067 return true; | 1092 return true; |
1068 return false; | 1093 return false; |
1069 } | 1094 } |
1070 | 1095 |
1071 } // end of namespace Ice | 1096 } // end of namespace Ice |
OLD | NEW |