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 // This file implements the Inst class, primarily the various | 10 // This file implements the Inst class, primarily the various |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 { str } \ | 56 { str } \ |
57 , | 57 , |
58 ICEINSTFCMP_TABLE | 58 ICEINSTFCMP_TABLE |
59 #undef X | 59 #undef X |
60 }; | 60 }; |
61 const size_t InstFcmpAttributesSize = llvm::array_lengthof(InstFcmpAttributes); | 61 const size_t InstFcmpAttributesSize = llvm::array_lengthof(InstFcmpAttributes); |
62 | 62 |
63 // Using non-anonymous struct so that array_lengthof works. | 63 // Using non-anonymous struct so that array_lengthof works. |
64 const struct InstIcmpAttributes_ { | 64 const struct InstIcmpAttributes_ { |
65 const char *DisplayString; | 65 const char *DisplayString; |
| 66 bool IsUnsigned; |
66 } InstIcmpAttributes[] = { | 67 } InstIcmpAttributes[] = { |
67 #define X(tag, str) \ | 68 #define X(tag, str, isunsigned) \ |
68 { str } \ | 69 { str, isunsigned } \ |
69 , | 70 , |
70 ICEINSTICMP_TABLE | 71 ICEINSTICMP_TABLE |
71 #undef X | 72 #undef X |
72 }; | 73 }; |
73 const size_t InstIcmpAttributesSize = llvm::array_lengthof(InstIcmpAttributes); | 74 const size_t InstIcmpAttributesSize = llvm::array_lengthof(InstIcmpAttributes); |
74 | 75 |
75 } // end of anonymous namespace | 76 } // end of anonymous namespace |
76 | 77 |
77 Inst::Inst(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) | 78 Inst::Inst(Cfg *Func, InstKind Kind, SizeT MaxSrcs, Variable *Dest) |
78 : Kind(Kind), Number(Func->newInstNumber()), Deleted(false), Dead(false), | 79 : Kind(Kind), Number(Func->newInstNumber()), Deleted(false), Dead(false), |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 addSource(Source2); | 275 addSource(Source2); |
275 } | 276 } |
276 | 277 |
277 InstFcmp::InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1, | 278 InstFcmp::InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1, |
278 Operand *Source2) | 279 Operand *Source2) |
279 : Inst(Func, Inst::Fcmp, 2, Dest), Condition(Condition) { | 280 : Inst(Func, Inst::Fcmp, 2, Dest), Condition(Condition) { |
280 addSource(Source1); | 281 addSource(Source1); |
281 addSource(Source2); | 282 addSource(Source2); |
282 } | 283 } |
283 | 284 |
| 285 bool InstIcmp::isUnsigned() const { |
| 286 return InstIcmpAttributes[getCondition()].IsUnsigned; |
| 287 } |
| 288 |
284 InstIcmp::InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1, | 289 InstIcmp::InstIcmp(Cfg *Func, ICond Condition, Variable *Dest, Operand *Source1, |
285 Operand *Source2) | 290 Operand *Source2) |
286 : Inst(Func, Inst::Icmp, 2, Dest), Condition(Condition) { | 291 : Inst(Func, Inst::Icmp, 2, Dest), Condition(Condition) { |
287 addSource(Source1); | 292 addSource(Source1); |
288 addSource(Source2); | 293 addSource(Source2); |
289 } | 294 } |
290 | 295 |
291 InstInsertElement::InstInsertElement(Cfg *Func, Variable *Dest, | 296 InstInsertElement::InstInsertElement(Cfg *Func, Variable *Dest, |
292 Operand *Source1, Operand *Source2, | 297 Operand *Source1, Operand *Source2, |
293 Operand *Source3) | 298 Operand *Source3) |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 764 |
760 void InstTarget::dump(const Cfg *Func) const { | 765 void InstTarget::dump(const Cfg *Func) const { |
761 Ostream &Str = Func->getContext()->getStrDump(); | 766 Ostream &Str = Func->getContext()->getStrDump(); |
762 Str << "[TARGET] "; | 767 Str << "[TARGET] "; |
763 Inst::dump(Func); | 768 Inst::dump(Func); |
764 } | 769 } |
765 | 770 |
766 void InstTarget::dumpExtras(const Cfg *Func) const { Inst::dumpExtras(Func); } | 771 void InstTarget::dumpExtras(const Cfg *Func) const { Inst::dumpExtras(Func); } |
767 | 772 |
768 } // end of namespace Ice | 773 } // end of namespace Ice |
OLD | NEW |