| OLD | NEW |
| 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// | 1 //===- subzero/src/IceCfg.cpp - Control flow graph 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 /// \file | 10 /// \file |
| 11 /// This file implements the Cfg class, including constant pool | 11 /// This file implements the Cfg class, including constant pool |
| 12 /// management. | 12 /// management. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #include "IceCfg.h" | 16 #include "IceCfg.h" |
| 17 | 17 |
| 18 #include "IceAssembler.h" | 18 #include "IceAssembler.h" |
| 19 #include "IceCfgNode.h" | 19 #include "IceCfgNode.h" |
| 20 #include "IceClFlags.h" | 20 #include "IceClFlags.h" |
| 21 #include "IceDefs.h" | 21 #include "IceDefs.h" |
| 22 #include "IceELFObjectWriter.h" | 22 #include "IceELFObjectWriter.h" |
| 23 #include "IceGlobalInits.h" | 23 #include "IceGlobalInits.h" |
| 24 #include "IceInst.h" | 24 #include "IceInst.h" |
| 25 #include "IceInstVarIter.h" |
| 25 #include "IceLiveness.h" | 26 #include "IceLiveness.h" |
| 26 #include "IceOperand.h" | 27 #include "IceOperand.h" |
| 27 #include "IceTargetLowering.h" | 28 #include "IceTargetLowering.h" |
| 28 | 29 |
| 29 namespace Ice { | 30 namespace Ice { |
| 30 | 31 |
| 31 ICE_TLS_DEFINE_FIELD(const Cfg *, Cfg, CurrentCfg); | 32 ICE_TLS_DEFINE_FIELD(const Cfg *, Cfg, CurrentCfg); |
| 32 | 33 |
| 33 ArenaAllocator<> *getCurrentCfgAllocator() { | 34 ArenaAllocator<> *getCurrentCfgAllocator() { |
| 34 return Cfg::getCurrentCfgAllocator(); | 35 return Cfg::getCurrentCfgAllocator(); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 Dest->getLiveRange().containsValue(InstNumber - 1, IsDest)) | 579 Dest->getLiveRange().containsValue(InstNumber - 1, IsDest)) |
| 579 Invalid = true; | 580 Invalid = true; |
| 580 if (Invalid) { | 581 if (Invalid) { |
| 581 Valid = false; | 582 Valid = false; |
| 582 Str << "Liveness error: inst " << Inst.getNumber() << " dest "; | 583 Str << "Liveness error: inst " << Inst.getNumber() << " dest "; |
| 583 Dest->dump(this); | 584 Dest->dump(this); |
| 584 Str << " live range " << Dest->getLiveRange() << "\n"; | 585 Str << " live range " << Dest->getLiveRange() << "\n"; |
| 585 } | 586 } |
| 586 } | 587 } |
| 587 } | 588 } |
| 588 for (SizeT I = 0; I < Inst.getSrcSize(); ++I) { | 589 FOREACH_VAR_IN_INST(Var, Inst) { |
| 589 Operand *Src = Inst.getSrc(I); | 590 static constexpr bool IsDest = false; |
| 590 SizeT NumVars = Src->getNumVars(); | 591 if (!Var->getIgnoreLiveness() && |
| 591 for (SizeT J = 0; J < NumVars; ++J) { | 592 !Var->getLiveRange().containsValue(InstNumber, IsDest)) { |
| 592 const Variable *Var = Src->getVar(J); | 593 Valid = false; |
| 593 const bool IsDest = false; | 594 Str << "Liveness error: inst " << Inst.getNumber() << " var "; |
| 594 if (!Var->getIgnoreLiveness() && | 595 Var->dump(this); |
| 595 !Var->getLiveRange().containsValue(InstNumber, IsDest)) { | 596 Str << " live range " << Var->getLiveRange() << "\n"; |
| 596 Valid = false; | |
| 597 Str << "Liveness error: inst " << Inst.getNumber() << " var "; | |
| 598 Var->dump(this); | |
| 599 Str << " live range " << Var->getLiveRange() << "\n"; | |
| 600 } | |
| 601 } | 597 } |
| 602 } | 598 } |
| 603 } | 599 } |
| 604 } | 600 } |
| 605 return Valid; | 601 return Valid; |
| 606 } | 602 } |
| 607 | 603 |
| 608 void Cfg::contractEmptyNodes() { | 604 void Cfg::contractEmptyNodes() { |
| 609 // If we're decorating the asm output with register liveness info, | 605 // If we're decorating the asm output with register liveness info, |
| 610 // this information may become corrupted or incorrect after | 606 // this information may become corrupted or incorrect after |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 } | 767 } |
| 772 } | 768 } |
| 773 // Print each basic block | 769 // Print each basic block |
| 774 for (CfgNode *Node : Nodes) | 770 for (CfgNode *Node : Nodes) |
| 775 Node->dump(this); | 771 Node->dump(this); |
| 776 if (isVerbose(IceV_Instructions)) | 772 if (isVerbose(IceV_Instructions)) |
| 777 Str << "}\n"; | 773 Str << "}\n"; |
| 778 } | 774 } |
| 779 | 775 |
| 780 } // end of namespace Ice | 776 } // end of namespace Ice |
| OLD | NEW |