Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: src/IceOperand.h

Issue 680733002: Subzero: Allow delaying Phi lowering until after register allocation. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix vector const undef lowering for phis. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceLiveness.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// 1 //===- subzero/src/IceOperand.h - High-level operands -----------*- 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 Operand class and its target-independent 10 // This file declares the Operand class and its target-independent
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 bool getIsArg() const { return IsArgument; } 393 bool getIsArg() const { return IsArgument; }
394 void setIsArg(bool Val = true) { IsArgument = Val; } 394 void setIsArg(bool Val = true) { IsArgument = Val; }
395 bool getIsImplicitArg() const { return IsImplicitArgument; } 395 bool getIsImplicitArg() const { return IsImplicitArgument; }
396 void setIsImplicitArg(bool Val = true) { IsImplicitArgument = Val; } 396 void setIsImplicitArg(bool Val = true) { IsImplicitArgument = Val; }
397 397
398 void setIgnoreLiveness() { IgnoreLiveness = true; } 398 void setIgnoreLiveness() { IgnoreLiveness = true; }
399 bool getIgnoreLiveness() const { return IgnoreLiveness; } 399 bool getIgnoreLiveness() const { return IgnoreLiveness; }
400 400
401 bool needsStackSlot() const { return NeedsStackSlot; }
402 void setNeedsStackSlot() { NeedsStackSlot = true; }
401 int32_t getStackOffset() const { return StackOffset; } 403 int32_t getStackOffset() const { return StackOffset; }
402 void setStackOffset(int32_t Offset) { StackOffset = Offset; } 404 void setStackOffset(int32_t Offset) { StackOffset = Offset; }
403 405
404 static const int32_t NoRegister = -1; 406 static const int32_t NoRegister = -1;
405 bool hasReg() const { return getRegNum() != NoRegister; } 407 bool hasReg() const { return getRegNum() != NoRegister; }
406 int32_t getRegNum() const { return RegNum; } 408 int32_t getRegNum() const { return RegNum; }
407 void setRegNum(int32_t NewRegNum) { 409 void setRegNum(int32_t NewRegNum) {
408 // Regnum shouldn't be set more than once. 410 // Regnum shouldn't be set more than once.
409 assert(!hasReg() || RegNum == NewRegNum); 411 assert(!hasReg() || RegNum == NewRegNum);
410 RegNum = NewRegNum; 412 RegNum = NewRegNum;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 OperandKind Kind = Operand->getKind(); 469 OperandKind Kind = Operand->getKind();
468 return Kind >= kVariable && Kind <= kVariable_Num; 470 return Kind >= kVariable && Kind <= kVariable_Num;
469 } 471 }
470 472
471 // The destructor is public because of the asType() method. 473 // The destructor is public because of the asType() method.
472 ~Variable() override {} 474 ~Variable() override {}
473 475
474 protected: 476 protected:
475 Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name) 477 Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name)
476 : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false), 478 : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false),
477 IsImplicitArgument(false), IgnoreLiveness(false), StackOffset(0), 479 IsImplicitArgument(false), IgnoreLiveness(false), NeedsStackSlot(false),
478 RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), LoVar(NULL), 480 StackOffset(0), RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1),
479 HiVar(NULL) { 481 LoVar(NULL), HiVar(NULL) {
480 Vars = VarsReal; 482 Vars = VarsReal;
481 Vars[0] = this; 483 Vars[0] = this;
482 NumVars = 1; 484 NumVars = 1;
483 } 485 }
484 // Number is unique across all variables, and is used as a 486 // Number is unique across all variables, and is used as a
485 // (bit)vector index for liveness analysis. 487 // (bit)vector index for liveness analysis.
486 const SizeT Number; 488 const SizeT Number;
487 // Name is optional. 489 // Name is optional.
488 IceString Name; 490 IceString Name;
489 bool IsArgument; 491 bool IsArgument;
490 bool IsImplicitArgument; 492 bool IsImplicitArgument;
491 // IgnoreLiveness means that the variable should be ignored when 493 // IgnoreLiveness means that the variable should be ignored when
492 // constructing and validating live ranges. This is usually 494 // constructing and validating live ranges. This is usually
493 // reserved for the stack pointer. 495 // reserved for the stack pointer.
494 bool IgnoreLiveness; 496 bool IgnoreLiveness;
497 // NeedsStackSlot starts out false, and is set to true once we know
498 // for sure that the variable needs a stack slot.
499 bool NeedsStackSlot;
495 // StackOffset is the canonical location on stack (only if 500 // StackOffset is the canonical location on stack (only if
496 // RegNum==NoRegister || IsArgument). 501 // RegNum==NoRegister || IsArgument).
497 int32_t StackOffset; 502 int32_t StackOffset;
498 // RegNum is the allocated register, or NoRegister if it isn't 503 // RegNum is the allocated register, or NoRegister if it isn't
499 // register-allocated. 504 // register-allocated.
500 int32_t RegNum; 505 int32_t RegNum;
501 // RegNumTmp is the tentative assignment during register allocation. 506 // RegNumTmp is the tentative assignment during register allocation.
502 int32_t RegNumTmp; 507 int32_t RegNumTmp;
503 RegWeight Weight; // Register allocation priority 508 RegWeight Weight; // Register allocation priority
504 LiveRange Live; 509 LiveRange Live;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // complete set of Variables. 576 // complete set of Variables.
572 class VariablesMetadata { 577 class VariablesMetadata {
573 VariablesMetadata(const VariablesMetadata &) = delete; 578 VariablesMetadata(const VariablesMetadata &) = delete;
574 VariablesMetadata &operator=(const VariablesMetadata &) = delete; 579 VariablesMetadata &operator=(const VariablesMetadata &) = delete;
575 580
576 public: 581 public:
577 VariablesMetadata(const Cfg *Func) : Func(Func) {} 582 VariablesMetadata(const Cfg *Func) : Func(Func) {}
578 // Initialize the state by traversing all instructions/variables in 583 // Initialize the state by traversing all instructions/variables in
579 // the CFG. 584 // the CFG.
580 void init(MetadataKind TrackingKind); 585 void init(MetadataKind TrackingKind);
586 // Add a single node. This is called by init(), and can be called
587 // incrementally from elsewhere, e.g. after edge-splitting.
588 void addNode(CfgNode *Node);
581 // Returns whether the given Variable is tracked in this object. It 589 // Returns whether the given Variable is tracked in this object. It
582 // should only return false if changes were made to the CFG after 590 // should only return false if changes were made to the CFG after
583 // running init(), in which case the state is stale and the results 591 // running init(), in which case the state is stale and the results
584 // shouldn't be trusted (but it may be OK e.g. for dumping). 592 // shouldn't be trusted (but it may be OK e.g. for dumping).
585 bool isTracked(const Variable *Var) const { 593 bool isTracked(const Variable *Var) const {
586 return Var->getIndex() < Metadata.size(); 594 return Var->getIndex() < Metadata.size();
587 } 595 }
588 596
589 // Returns whether the given Variable has multiple definitions. 597 // Returns whether the given Variable has multiple definitions.
590 bool isMultiDef(const Variable *Var) const; 598 bool isMultiDef(const Variable *Var) const;
(...skipping 27 matching lines...) Expand all
618 private: 626 private:
619 const Cfg *Func; 627 const Cfg *Func;
620 MetadataKind Kind; 628 MetadataKind Kind;
621 std::vector<VariableTracking> Metadata; 629 std::vector<VariableTracking> Metadata;
622 const static InstDefList NoDefinitions; 630 const static InstDefList NoDefinitions;
623 }; 631 };
624 632
625 } // end of namespace Ice 633 } // end of namespace Ice
626 634
627 #endif // SUBZERO_SRC_ICEOPERAND_H 635 #endif // SUBZERO_SRC_ICEOPERAND_H
OLDNEW
« no previous file with comments | « src/IceLiveness.cpp ('k') | src/IceOperand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698