| 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 | 
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 191     // TODO(jpp): this is fragile, at best. Figure out a better way of | 191     // TODO(jpp): this is fragile, at best. Figure out a better way of | 
| 192     // detecting exit functions. | 192     // detecting exit functions. | 
| 193     if (GlobalContext::matchSymbolName(getFunctionName(), "exit")) { | 193     if (GlobalContext::matchSymbolName(getFunctionName(), "exit")) { | 
| 194       addCallToProfileSummary(); | 194       addCallToProfileSummary(); | 
| 195     } | 195     } | 
| 196     dump("Profiled CFG"); | 196     dump("Profiled CFG"); | 
| 197   } | 197   } | 
| 198 | 198 | 
| 199   // Create the Hi and Lo variables where a split was needed | 199   // Create the Hi and Lo variables where a split was needed | 
| 200   for (Variable *Var : Variables) | 200   for (Variable *Var : Variables) | 
| 201     if (auto Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) | 201     if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var)) | 
| 202       Var64On32->initHiLo(this); | 202       Var64On32->initHiLo(this); | 
| 203 | 203 | 
| 204   // Figure out which alloca instructions result in storage at known stack frame | 204   // Figure out which alloca instructions result in storage at known stack frame | 
| 205   // offsets.  If this is true for all alloca instructions, then a stack pointer | 205   // offsets.  If this is true for all alloca instructions, then a stack pointer | 
| 206   // can still be used instead of a frame pointer, freeing up the frame pointer | 206   // can still be used instead of a frame pointer, freeing up the frame pointer | 
| 207   // for normal register allocation.  Additionally, for each such alloca, its | 207   // for normal register allocation.  Additionally, for each such alloca, its | 
| 208   // address could be rematerialized at each use in terms of the stack/frame | 208   // address could be rematerialized at each use in terms of the stack/frame | 
| 209   // pointer, saving a stack slot and a load from that stack slot. | 209   // pointer, saving a stack slot and a load from that stack slot. | 
| 210   // | 210   // | 
| 211   // This simple implementation is limited to alloca instructions at the start | 211   // This simple implementation is limited to alloca instructions at the start | 
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 600     Inst *FirstInst = nullptr; | 600     Inst *FirstInst = nullptr; | 
| 601     for (Inst &Inst : Node->getInsts()) { | 601     for (Inst &Inst : Node->getInsts()) { | 
| 602       if (Inst.isDeleted()) | 602       if (Inst.isDeleted()) | 
| 603         continue; | 603         continue; | 
| 604       if (FirstInst == nullptr) | 604       if (FirstInst == nullptr) | 
| 605         FirstInst = &Inst; | 605         FirstInst = &Inst; | 
| 606       InstNumberT InstNumber = Inst.getNumber(); | 606       InstNumberT InstNumber = Inst.getNumber(); | 
| 607       if (Variable *Dest = Inst.getDest()) { | 607       if (Variable *Dest = Inst.getDest()) { | 
| 608         if (!Dest->getIgnoreLiveness()) { | 608         if (!Dest->getIgnoreLiveness()) { | 
| 609           bool Invalid = false; | 609           bool Invalid = false; | 
| 610           const bool IsDest = true; | 610           constexpr bool IsDest = true; | 
| 611           if (!Dest->getLiveRange().containsValue(InstNumber, IsDest)) | 611           if (!Dest->getLiveRange().containsValue(InstNumber, IsDest)) | 
| 612             Invalid = true; | 612             Invalid = true; | 
| 613           // Check that this instruction actually *begins* Dest's live range, | 613           // Check that this instruction actually *begins* Dest's live range, | 
| 614           // by checking that Dest is not live in the previous instruction. As | 614           // by checking that Dest is not live in the previous instruction. As | 
| 615           // a special exception, we don't check this for the first instruction | 615           // a special exception, we don't check this for the first instruction | 
| 616           // of the block, because a Phi temporary may be live at the end of | 616           // of the block, because a Phi temporary may be live at the end of | 
| 617           // the previous block, and if it is also assigned in the first | 617           // the previous block, and if it is also assigned in the first | 
| 618           // instruction of this block, the adjacent live ranges get merged. | 618           // instruction of this block, the adjacent live ranges get merged. | 
| 619           if (static_cast<class Inst *>(&Inst) != FirstInst && | 619           if (static_cast<class Inst *>(&Inst) != FirstInst && | 
| 620               !Inst.isDestRedefined() && | 620               !Inst.isDestRedefined() && | 
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 832     } | 832     } | 
| 833   } | 833   } | 
| 834   // Print each basic block | 834   // Print each basic block | 
| 835   for (CfgNode *Node : Nodes) | 835   for (CfgNode *Node : Nodes) | 
| 836     Node->dump(this); | 836     Node->dump(this); | 
| 837   if (isVerbose(IceV_Instructions)) | 837   if (isVerbose(IceV_Instructions)) | 
| 838     Str << "}\n"; | 838     Str << "}\n"; | 
| 839 } | 839 } | 
| 840 | 840 | 
| 841 } // end of namespace Ice | 841 } // end of namespace Ice | 
| OLD | NEW | 
|---|