Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceInstX8632.h - Low-level x86 instructions --*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.h - Low-level x86 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 InstX8632 and OperandX8632 classes and | 10 // This file declares the InstX8632 and OperandX8632 classes and |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 | 267 |
| 268 protected: | 268 protected: |
| 269 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) | 269 InstX8632(Cfg *Func, InstKindX8632 Kind, SizeT Maxsrcs, Variable *Dest) |
| 270 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} | 270 : InstTarget(Func, static_cast<InstKind>(Kind), Maxsrcs, Dest) {} |
| 271 ~InstX8632() override {} | 271 ~InstX8632() override {} |
| 272 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { | 272 static bool isClassof(const Inst *Inst, InstKindX8632 MyKind) { |
| 273 return Inst->getKind() == static_cast<InstKind>(MyKind); | 273 return Inst->getKind() == static_cast<InstKind>(MyKind); |
| 274 } | 274 } |
| 275 }; | 275 }; |
| 276 | 276 |
| 277 // InstX8632Label represents an intra-block label that is the | 277 // InstX8632Label represents an intra-block label that is the |
|
Jim Stichnoth
2014/10/22 18:01:14
Document the assumption about short branches to la
jvoung (off chromium)
2014/10/22 20:43:58
Done.
| |
| 278 // target of an intra-block branch. These are used for lowering i1 | 278 // target of an intra-block branch. These are used for lowering i1 |
| 279 // calculations, Select instructions, and 64-bit compares on a 32-bit | 279 // calculations, Select instructions, and 64-bit compares on a 32-bit |
| 280 // architecture, without basic block splitting. Basic block splitting | 280 // architecture, without basic block splitting. Basic block splitting |
| 281 // is not so desirable for several reasons, one of which is the impact | 281 // is not so desirable for several reasons, one of which is the impact |
| 282 // on decisions based on whether a variable's live range spans | 282 // on decisions based on whether a variable's live range spans |
| 283 // multiple basic blocks. | 283 // multiple basic blocks. |
| 284 // | 284 // |
| 285 // Intra-block control flow must be used with caution. Consider the | 285 // Intra-block control flow must be used with caution. Consider the |
| 286 // sequence for "c = (a >= b ? x : y)". | 286 // sequence for "c = (a >= b ? x : y)". |
| 287 // cmp a, b | 287 // cmp a, b |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 315 InstX8632Label(const InstX8632Label &) = delete; | 315 InstX8632Label(const InstX8632Label &) = delete; |
| 316 InstX8632Label &operator=(const InstX8632Label &) = delete; | 316 InstX8632Label &operator=(const InstX8632Label &) = delete; |
| 317 | 317 |
| 318 public: | 318 public: |
| 319 static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) { | 319 static InstX8632Label *create(Cfg *Func, TargetX8632 *Target) { |
| 320 return new (Func->allocate<InstX8632Label>()) InstX8632Label(Func, Target); | 320 return new (Func->allocate<InstX8632Label>()) InstX8632Label(Func, Target); |
| 321 } | 321 } |
| 322 uint32_t getEmitInstCount() const override { return 0; } | 322 uint32_t getEmitInstCount() const override { return 0; } |
| 323 IceString getName(const Cfg *Func) const; | 323 IceString getName(const Cfg *Func) const; |
| 324 void emit(const Cfg *Func) const override; | 324 void emit(const Cfg *Func) const override; |
| 325 // TODO(jvoung): Filler in. | 325 void emitIAS(const Cfg *Func) const override; |
| 326 void emitIAS(const Cfg *Func) const override { emit(Func); } | |
| 327 void dump(const Cfg *Func) const override; | 326 void dump(const Cfg *Func) const override; |
| 327 x86::Label *getAsmLabel() const { return &AsmLabel; } | |
| 328 | 328 |
| 329 private: | 329 private: |
| 330 InstX8632Label(Cfg *Func, TargetX8632 *Target); | 330 InstX8632Label(Cfg *Func, TargetX8632 *Target); |
| 331 ~InstX8632Label() override {} | 331 ~InstX8632Label() override {} |
| 332 SizeT Number; // used only for unique label string generation | 332 SizeT Number; // used only for unique label string generation |
| 333 mutable x86::Label AsmLabel; // modified by emitIAS. | |
|
Jim Stichnoth
2014/10/22 18:01:14
Is the mutable aspect "permanent", or just a stop-
jvoung (off chromium)
2014/10/22 20:43:58
Unfortunately, it is permanent. I wasn't sure of a
Jim Stichnoth
2014/10/22 21:50:08
I think that would be a cleaner approach, maybe a
jvoung (off chromium)
2014/10/23 18:05:27
Okay I agree it's cleaner. It adds a bit of indire
| |
| 333 }; | 334 }; |
| 334 | 335 |
| 335 // Conditional and unconditional branch instruction. | 336 // Conditional and unconditional branch instruction. |
| 336 class InstX8632Br : public InstX8632 { | 337 class InstX8632Br : public InstX8632 { |
| 337 InstX8632Br(const InstX8632Br &) = delete; | 338 InstX8632Br(const InstX8632Br &) = delete; |
| 338 InstX8632Br &operator=(const InstX8632Br &) = delete; | 339 InstX8632Br &operator=(const InstX8632Br &) = delete; |
| 339 | 340 |
| 340 public: | 341 public: |
| 341 // Create a conditional branch to a node. | 342 // Create a conditional branch to a node. |
| 342 static InstX8632Br *create(Cfg *Func, CfgNode *TargetTrue, | 343 static InstX8632Br *create(Cfg *Func, CfgNode *TargetTrue, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 uint32_t Sum = 0; | 379 uint32_t Sum = 0; |
| 379 if (Label) | 380 if (Label) |
| 380 ++Sum; | 381 ++Sum; |
| 381 if (getTargetTrue()) | 382 if (getTargetTrue()) |
| 382 ++Sum; | 383 ++Sum; |
| 383 if (getTargetFalse()) | 384 if (getTargetFalse()) |
| 384 ++Sum; | 385 ++Sum; |
| 385 return Sum; | 386 return Sum; |
| 386 } | 387 } |
| 387 void emit(const Cfg *Func) const override; | 388 void emit(const Cfg *Func) const override; |
| 388 // TODO(jvoung): Filler in. | 389 void emitIAS(const Cfg *Func) const override; |
| 389 void emitIAS(const Cfg *Func) const override { emit(Func); } | |
| 390 void dump(const Cfg *Func) const override; | 390 void dump(const Cfg *Func) const override; |
| 391 static bool classof(const Inst *Inst) { return isClassof(Inst, Br); } | 391 static bool classof(const Inst *Inst) { return isClassof(Inst, Br); } |
| 392 | 392 |
| 393 private: | 393 private: |
| 394 InstX8632Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse, | 394 InstX8632Br(Cfg *Func, const CfgNode *TargetTrue, const CfgNode *TargetFalse, |
| 395 const InstX8632Label *Label, CondX86::BrCond Condition); | 395 const InstX8632Label *Label, CondX86::BrCond Condition); |
| 396 ~InstX8632Br() override {} | 396 ~InstX8632Br() override {} |
| 397 CondX86::BrCond Condition; | 397 CondX86::BrCond Condition; |
| 398 const CfgNode *TargetTrue; | 398 const CfgNode *TargetTrue; |
| 399 const CfgNode *TargetFalse; | 399 const CfgNode *TargetFalse; |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1544 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; | 1544 template <> void InstX8632Pinsr::emitIAS(const Cfg *Func) const; |
| 1545 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; | 1545 template <> void InstX8632Movsx::emitIAS(const Cfg *Func) const; |
| 1546 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; | 1546 template <> void InstX8632Movzx::emitIAS(const Cfg *Func) const; |
| 1547 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; | 1547 template <> void InstX8632Pmull::emitIAS(const Cfg *Func) const; |
| 1548 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; | 1548 template <> void InstX8632Pshufd::emitIAS(const Cfg *Func) const; |
| 1549 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; | 1549 template <> void InstX8632Shufps::emitIAS(const Cfg *Func) const; |
| 1550 | 1550 |
| 1551 } // end of namespace Ice | 1551 } // end of namespace Ice |
| 1552 | 1552 |
| 1553 #endif // SUBZERO_SRC_ICEINSTX8632_H | 1553 #endif // SUBZERO_SRC_ICEINSTX8632_H |
| OLD | NEW |