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

Side by Side Diff: src/IceOperand.h

Issue 652633002: Subzero: Improve performance of liveness analysis and live range construction. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove TODO Created 6 years, 2 months 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 Range.clear(); 307 Range.clear();
308 Weight.setWeight(0); 308 Weight.setWeight(0);
309 untrim(); 309 untrim();
310 IsNonpoints = false; 310 IsNonpoints = false;
311 } 311 }
312 void addSegment(InstNumberT Start, InstNumberT End); 312 void addSegment(InstNumberT Start, InstNumberT End);
313 313
314 bool endsBefore(const LiveRange &Other) const; 314 bool endsBefore(const LiveRange &Other) const;
315 bool overlaps(const LiveRange &Other, bool UseTrimmed = false) const; 315 bool overlaps(const LiveRange &Other, bool UseTrimmed = false) const;
316 bool overlapsInst(InstNumberT OtherBegin, bool UseTrimmed = false) const; 316 bool overlapsInst(InstNumberT OtherBegin, bool UseTrimmed = false) const;
317 bool containsValue(InstNumberT Value) const; 317 bool containsValue(InstNumberT Value, bool IsDest) const;
318 bool isEmpty() const { return Range.empty(); } 318 bool isEmpty() const { return Range.empty(); }
319 bool isNonpoints() const { return IsNonpoints; } 319 bool isNonpoints() const { return IsNonpoints; }
320 InstNumberT getStart() const { 320 InstNumberT getStart() const {
321 return Range.empty() ? -1 : Range.begin()->first; 321 return Range.empty() ? -1 : Range.begin()->first;
322 } 322 }
323 323
324 void untrim() { TrimmedBegin = Range.begin(); } 324 void untrim() { TrimmedBegin = Range.begin(); }
325 void trim(InstNumberT Lower); 325 void trim(InstNumberT Lower);
326 326
327 RegWeight getWeight() const { return Weight; } 327 RegWeight getWeight() const { return Weight; }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 // Make sure that the name can only be set once. 383 // Make sure that the name can only be set once.
384 assert(Name.empty()); 384 assert(Name.empty());
385 Name = NewName; 385 Name = NewName;
386 } 386 }
387 387
388 bool getIsArg() const { return IsArgument; } 388 bool getIsArg() const { return IsArgument; }
389 void setIsArg(bool Val = true) { IsArgument = Val; } 389 void setIsArg(bool Val = true) { IsArgument = Val; }
390 bool getIsImplicitArg() const { return IsImplicitArgument; } 390 bool getIsImplicitArg() const { return IsImplicitArgument; }
391 void setIsImplicitArg(bool Val = true) { IsImplicitArgument = Val; } 391 void setIsImplicitArg(bool Val = true) { IsImplicitArgument = Val; }
392 392
393 void setIgnoreLiveness() { IgnoreLiveness = true; }
394 bool getIgnoreLiveness() const { return IgnoreLiveness; }
395
393 int32_t getStackOffset() const { return StackOffset; } 396 int32_t getStackOffset() const { return StackOffset; }
394 void setStackOffset(int32_t Offset) { StackOffset = Offset; } 397 void setStackOffset(int32_t Offset) { StackOffset = Offset; }
395 398
396 static const int32_t NoRegister = -1; 399 static const int32_t NoRegister = -1;
397 bool hasReg() const { return getRegNum() != NoRegister; } 400 bool hasReg() const { return getRegNum() != NoRegister; }
398 int32_t getRegNum() const { return RegNum; } 401 int32_t getRegNum() const { return RegNum; }
399 void setRegNum(int32_t NewRegNum) { 402 void setRegNum(int32_t NewRegNum) {
400 // Regnum shouldn't be set more than once. 403 // Regnum shouldn't be set more than once.
401 assert(!hasReg() || RegNum == NewRegNum); 404 assert(!hasReg() || RegNum == NewRegNum);
402 RegNum = NewRegNum; 405 RegNum = NewRegNum;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 OperandKind Kind = Operand->getKind(); 450 OperandKind Kind = Operand->getKind();
448 return Kind >= kVariable && Kind <= kVariable_Num; 451 return Kind >= kVariable && Kind <= kVariable_Num;
449 } 452 }
450 453
451 // The destructor is public because of the asType() method. 454 // The destructor is public because of the asType() method.
452 ~Variable() override {} 455 ~Variable() override {}
453 456
454 protected: 457 protected:
455 Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name) 458 Variable(OperandKind K, Type Ty, SizeT Index, const IceString &Name)
456 : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false), 459 : Operand(K, Ty), Number(Index), Name(Name), IsArgument(false),
457 IsImplicitArgument(false), StackOffset(0), RegNum(NoRegister), 460 IsImplicitArgument(false), IgnoreLiveness(false), StackOffset(0),
458 RegNumTmp(NoRegister), Weight(1), LoVar(NULL), HiVar(NULL) { 461 RegNum(NoRegister), RegNumTmp(NoRegister), Weight(1), LoVar(NULL),
462 HiVar(NULL) {
459 Vars = VarsReal; 463 Vars = VarsReal;
460 Vars[0] = this; 464 Vars[0] = this;
461 NumVars = 1; 465 NumVars = 1;
462 } 466 }
463 // Number is unique across all variables, and is used as a 467 // Number is unique across all variables, and is used as a
464 // (bit)vector index for liveness analysis. 468 // (bit)vector index for liveness analysis.
465 const SizeT Number; 469 const SizeT Number;
466 // Name is optional. 470 // Name is optional.
467 IceString Name; 471 IceString Name;
468 bool IsArgument; 472 bool IsArgument;
469 bool IsImplicitArgument; 473 bool IsImplicitArgument;
474 // IgnoreLiveness means that the variable should be ignored when
475 // constructing and validating live ranges. This is usually
476 // reserved for the stack pointer.
477 bool IgnoreLiveness;
470 // StackOffset is the canonical location on stack (only if 478 // StackOffset is the canonical location on stack (only if
471 // RegNum==NoRegister || IsArgument). 479 // RegNum==NoRegister || IsArgument).
472 int32_t StackOffset; 480 int32_t StackOffset;
473 // RegNum is the allocated register, or NoRegister if it isn't 481 // RegNum is the allocated register, or NoRegister if it isn't
474 // register-allocated. 482 // register-allocated.
475 int32_t RegNum; 483 int32_t RegNum;
476 // RegNumTmp is the tentative assignment during register allocation. 484 // RegNumTmp is the tentative assignment during register allocation.
477 int32_t RegNumTmp; 485 int32_t RegNumTmp;
478 RegWeight Weight; // Register allocation priority 486 RegWeight Weight; // Register allocation priority
479 LiveRange Live; 487 LiveRange Live;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 const Cfg *Func; 590 const Cfg *Func;
583 std::vector<VariableTracking> Metadata; 591 std::vector<VariableTracking> Metadata;
584 const static InstDefList NoDefinitions; 592 const static InstDefList NoDefinitions;
585 VariablesMetadata(const VariablesMetadata &) = delete; 593 VariablesMetadata(const VariablesMetadata &) = delete;
586 VariablesMetadata &operator=(const VariablesMetadata &) = delete; 594 VariablesMetadata &operator=(const VariablesMetadata &) = delete;
587 }; 595 };
588 596
589 } // end of namespace Ice 597 } // end of namespace Ice
590 598
591 #endif // SUBZERO_SRC_ICEOPERAND_H 599 #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