| OLD | NEW |
| 1 //===- subzero/src/IceInst.h - High-level instructions ----------*- C++ -*-===// | 1 //===- subzero/src/IceInst.h - High-level instructions ----------*- C++ -*-===// |
| 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 declares the Inst class and its target-independent | 10 // This file declares the Inst class and its target-independent |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 // Binary arithmetic instruction. The source operands are captured in | 156 // Binary arithmetic instruction. The source operands are captured in |
| 157 // getSrc(0) and getSrc(1). | 157 // getSrc(0) and getSrc(1). |
| 158 class InstArithmetic : public Inst { | 158 class InstArithmetic : public Inst { |
| 159 public: | 159 public: |
| 160 enum OpKind { | 160 enum OpKind { |
| 161 #define X(tag, str, commutative) tag, | 161 #define X(tag, str, commutative) tag, |
| 162 ICEINSTARITHMETIC_TABLE | 162 ICEINSTARITHMETIC_TABLE |
| 163 #undef X | 163 #undef X |
| 164 _num |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 static InstArithmetic *create(Cfg *Func, OpKind Op, Variable *Dest, | 167 static InstArithmetic *create(Cfg *Func, OpKind Op, Variable *Dest, |
| 167 Operand *Source1, Operand *Source2) { | 168 Operand *Source1, Operand *Source2) { |
| 168 return new (Func->allocateInst<InstArithmetic>()) | 169 return new (Func->allocateInst<InstArithmetic>()) |
| 169 InstArithmetic(Func, Op, Dest, Source1, Source2); | 170 InstArithmetic(Func, Op, Dest, Source1, Source2); |
| 170 } | 171 } |
| 171 OpKind getOp() const { return Op; } | 172 OpKind getOp() const { return Op; } |
| 172 bool isCommutative() const; | 173 bool isCommutative() const; |
| 173 virtual void dump(const Cfg *Func) const; | 174 virtual void dump(const Cfg *Func) const; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 virtual ~InstCall() {} | 281 virtual ~InstCall() {} |
| 281 }; | 282 }; |
| 282 | 283 |
| 283 // Cast instruction (a.k.a. conversion operation). | 284 // Cast instruction (a.k.a. conversion operation). |
| 284 class InstCast : public Inst { | 285 class InstCast : public Inst { |
| 285 public: | 286 public: |
| 286 enum OpKind { | 287 enum OpKind { |
| 287 #define X(tag, str) tag, | 288 #define X(tag, str) tag, |
| 288 ICEINSTCAST_TABLE | 289 ICEINSTCAST_TABLE |
| 289 #undef X | 290 #undef X |
| 291 _num |
| 290 }; | 292 }; |
| 291 | 293 |
| 292 static InstCast *create(Cfg *Func, OpKind CastKind, Variable *Dest, | 294 static InstCast *create(Cfg *Func, OpKind CastKind, Variable *Dest, |
| 293 Operand *Source) { | 295 Operand *Source) { |
| 294 return new (Func->allocateInst<InstCast>()) | 296 return new (Func->allocateInst<InstCast>()) |
| 295 InstCast(Func, CastKind, Dest, Source); | 297 InstCast(Func, CastKind, Dest, Source); |
| 296 } | 298 } |
| 297 OpKind getCastKind() const { return CastKind; } | 299 OpKind getCastKind() const { return CastKind; } |
| 298 virtual void dump(const Cfg *Func) const; | 300 virtual void dump(const Cfg *Func) const; |
| 299 static bool classof(const Inst *Inst) { return Inst->getKind() == Cast; } | 301 static bool classof(const Inst *Inst) { return Inst->getKind() == Cast; } |
| 300 | 302 |
| 301 private: | 303 private: |
| 302 InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source); | 304 InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source); |
| 303 InstCast(const InstCast &) LLVM_DELETED_FUNCTION; | 305 InstCast(const InstCast &) LLVM_DELETED_FUNCTION; |
| 304 InstCast &operator=(const InstCast &) LLVM_DELETED_FUNCTION; | 306 InstCast &operator=(const InstCast &) LLVM_DELETED_FUNCTION; |
| 305 virtual ~InstCast() {} | 307 virtual ~InstCast() {} |
| 306 const OpKind CastKind; | 308 const OpKind CastKind; |
| 307 }; | 309 }; |
| 308 | 310 |
| 309 // Floating-point comparison instruction. The source operands are | 311 // Floating-point comparison instruction. The source operands are |
| 310 // captured in getSrc(0) and getSrc(1). | 312 // captured in getSrc(0) and getSrc(1). |
| 311 class InstFcmp : public Inst { | 313 class InstFcmp : public Inst { |
| 312 public: | 314 public: |
| 313 enum FCond { | 315 enum FCond { |
| 314 #define X(tag, str) tag, | 316 #define X(tag, str) tag, |
| 315 ICEINSTFCMP_TABLE | 317 ICEINSTFCMP_TABLE |
| 316 #undef X | 318 #undef X |
| 319 _num |
| 317 }; | 320 }; |
| 318 | 321 |
| 319 static InstFcmp *create(Cfg *Func, FCond Condition, Variable *Dest, | 322 static InstFcmp *create(Cfg *Func, FCond Condition, Variable *Dest, |
| 320 Operand *Source1, Operand *Source2) { | 323 Operand *Source1, Operand *Source2) { |
| 321 return new (Func->allocateInst<InstFcmp>()) | 324 return new (Func->allocateInst<InstFcmp>()) |
| 322 InstFcmp(Func, Condition, Dest, Source1, Source2); | 325 InstFcmp(Func, Condition, Dest, Source1, Source2); |
| 323 } | 326 } |
| 324 FCond getCondition() const { return Condition; } | 327 FCond getCondition() const { return Condition; } |
| 325 virtual void dump(const Cfg *Func) const; | 328 virtual void dump(const Cfg *Func) const; |
| 326 static bool classof(const Inst *Inst) { return Inst->getKind() == Fcmp; } | 329 static bool classof(const Inst *Inst) { return Inst->getKind() == Fcmp; } |
| 327 | 330 |
| 328 private: | 331 private: |
| 329 InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1, | 332 InstFcmp(Cfg *Func, FCond Condition, Variable *Dest, Operand *Source1, |
| 330 Operand *Source2); | 333 Operand *Source2); |
| 331 InstFcmp(const InstFcmp &) LLVM_DELETED_FUNCTION; | 334 InstFcmp(const InstFcmp &) LLVM_DELETED_FUNCTION; |
| 332 InstFcmp &operator=(const InstFcmp &) LLVM_DELETED_FUNCTION; | 335 InstFcmp &operator=(const InstFcmp &) LLVM_DELETED_FUNCTION; |
| 333 virtual ~InstFcmp() {} | 336 virtual ~InstFcmp() {} |
| 334 const FCond Condition; | 337 const FCond Condition; |
| 335 }; | 338 }; |
| 336 | 339 |
| 337 // Integer comparison instruction. The source operands are captured | 340 // Integer comparison instruction. The source operands are captured |
| 338 // in getSrc(0) and getSrc(1). | 341 // in getSrc(0) and getSrc(1). |
| 339 class InstIcmp : public Inst { | 342 class InstIcmp : public Inst { |
| 340 public: | 343 public: |
| 341 enum ICond { | 344 enum ICond { |
| 342 #define X(tag, str) tag, | 345 #define X(tag, str) tag, |
| 343 ICEINSTICMP_TABLE | 346 ICEINSTICMP_TABLE |
| 344 #undef X | 347 #undef X |
| 348 _num |
| 345 }; | 349 }; |
| 346 | 350 |
| 347 static InstIcmp *create(Cfg *Func, ICond Condition, Variable *Dest, | 351 static InstIcmp *create(Cfg *Func, ICond Condition, Variable *Dest, |
| 348 Operand *Source1, Operand *Source2) { | 352 Operand *Source1, Operand *Source2) { |
| 349 return new (Func->allocateInst<InstIcmp>()) | 353 return new (Func->allocateInst<InstIcmp>()) |
| 350 InstIcmp(Func, Condition, Dest, Source1, Source2); | 354 InstIcmp(Func, Condition, Dest, Source1, Source2); |
| 351 } | 355 } |
| 352 ICond getCondition() const { return Condition; } | 356 ICond getCondition() const { return Condition; } |
| 353 virtual void dump(const Cfg *Func) const; | 357 virtual void dump(const Cfg *Func) const; |
| 354 static bool classof(const Inst *Inst) { return Inst->getKind() == Icmp; } | 358 static bool classof(const Inst *Inst) { return Inst->getKind() == Icmp; } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 assert(Kind >= Target); | 634 assert(Kind >= Target); |
| 631 } | 635 } |
| 632 InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION; | 636 InstTarget(const InstTarget &) LLVM_DELETED_FUNCTION; |
| 633 InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION; | 637 InstTarget &operator=(const InstTarget &) LLVM_DELETED_FUNCTION; |
| 634 virtual ~InstTarget() {} | 638 virtual ~InstTarget() {} |
| 635 }; | 639 }; |
| 636 | 640 |
| 637 } // end of namespace Ice | 641 } // end of namespace Ice |
| 638 | 642 |
| 639 #endif // SUBZERO_SRC_ICEINST_H | 643 #endif // SUBZERO_SRC_ICEINST_H |
| OLD | NEW |