| OLD | NEW |
| 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering 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 skeleton of the TargetLowering class, | 11 /// This file implements the skeleton of the TargetLowering class, |
| 12 /// specifically invoking the appropriate lowering method for a given | 12 /// specifically invoking the appropriate lowering method for a given |
| 13 /// instruction kind and driving global register allocation. It also | 13 /// instruction kind and driving global register allocation. It also |
| 14 /// implements the non-deleted instruction iteration in | 14 /// implements the non-deleted instruction iteration in |
| 15 /// LoweringContext. | 15 /// LoweringContext. |
| 16 /// | 16 /// |
| 17 //===----------------------------------------------------------------------===// | 17 //===----------------------------------------------------------------------===// |
| 18 | 18 |
| 19 #include "IceTargetLowering.h" | 19 #include "IceTargetLowering.h" |
| 20 | 20 |
| 21 #include "IceAssemblerARM32.h" | 21 #include "IceAssemblerARM32.h" |
| 22 #include "IceAssemblerMIPS32.h" | 22 #include "IceAssemblerMIPS32.h" |
| 23 #include "IceAssemblerX8632.h" | 23 #include "IceAssemblerX8632.h" |
| 24 #include "IceAssemblerX8664.h" | 24 #include "IceAssemblerX8664.h" |
| 25 #include "IceCfg.h" // setError() | 25 #include "IceCfg.h" // setError() |
| 26 #include "IceCfgNode.h" | 26 #include "IceCfgNode.h" |
| 27 #include "IceGlobalInits.h" | 27 #include "IceGlobalInits.h" |
| 28 #include "IceInstVarIter.h" |
| 28 #include "IceOperand.h" | 29 #include "IceOperand.h" |
| 29 #include "IceRegAlloc.h" | 30 #include "IceRegAlloc.h" |
| 30 #include "IceTargetLoweringARM32.h" | 31 #include "IceTargetLoweringARM32.h" |
| 31 #include "IceTargetLoweringMIPS32.h" | 32 #include "IceTargetLoweringMIPS32.h" |
| 32 #include "IceTargetLoweringX8632.h" | 33 #include "IceTargetLoweringX8632.h" |
| 33 #include "IceTargetLoweringX8664.h" | 34 #include "IceTargetLoweringX8664.h" |
| 34 | 35 |
| 35 namespace Ice { | 36 namespace Ice { |
| 36 | 37 |
| 37 void LoweringContext::init(CfgNode *N) { | 38 void LoweringContext::init(CfgNode *N) { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 uint32_t *SpillAreaAlignmentBytes, uint32_t *LocalsSlotsAlignmentBytes, | 283 uint32_t *SpillAreaAlignmentBytes, uint32_t *LocalsSlotsAlignmentBytes, |
| 283 std::function<bool(Variable *)> TargetVarHook) { | 284 std::function<bool(Variable *)> TargetVarHook) { |
| 284 const VariablesMetadata *VMetadata = Func->getVMetadata(); | 285 const VariablesMetadata *VMetadata = Func->getVMetadata(); |
| 285 llvm::BitVector IsVarReferenced(Func->getNumVariables()); | 286 llvm::BitVector IsVarReferenced(Func->getNumVariables()); |
| 286 for (CfgNode *Node : Func->getNodes()) { | 287 for (CfgNode *Node : Func->getNodes()) { |
| 287 for (Inst &Inst : Node->getInsts()) { | 288 for (Inst &Inst : Node->getInsts()) { |
| 288 if (Inst.isDeleted()) | 289 if (Inst.isDeleted()) |
| 289 continue; | 290 continue; |
| 290 if (const Variable *Var = Inst.getDest()) | 291 if (const Variable *Var = Inst.getDest()) |
| 291 IsVarReferenced[Var->getIndex()] = true; | 292 IsVarReferenced[Var->getIndex()] = true; |
| 292 for (SizeT I = 0; I < Inst.getSrcSize(); ++I) { | 293 FOREACH_VAR_IN_INST(Var, Inst) { |
| 293 Operand *Src = Inst.getSrc(I); | 294 IsVarReferenced[Var->getIndex()] = true; |
| 294 SizeT NumVars = Src->getNumVars(); | |
| 295 for (SizeT J = 0; J < NumVars; ++J) { | |
| 296 const Variable *Var = Src->getVar(J); | |
| 297 IsVarReferenced[Var->getIndex()] = true; | |
| 298 } | |
| 299 } | 295 } |
| 300 } | 296 } |
| 301 } | 297 } |
| 302 | 298 |
| 303 // If SimpleCoalescing is false, each variable without a register | 299 // If SimpleCoalescing is false, each variable without a register |
| 304 // gets its own unique stack slot, which leads to large stack | 300 // gets its own unique stack slot, which leads to large stack |
| 305 // frames. If SimpleCoalescing is true, then each "global" variable | 301 // frames. If SimpleCoalescing is true, then each "global" variable |
| 306 // without a register gets its own slot, but "local" variable slots | 302 // without a register gets its own slot, but "local" variable slots |
| 307 // are reused across basic blocks. E.g., if A and B are local to | 303 // are reused across basic blocks. E.g., if A and B are local to |
| 308 // block 1 and C is local to block 2, then C may share a slot with A or B. | 304 // block 1 and C is local to block 2, then C may share a slot with A or B. |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 if (Target == Target_##X) \ | 594 if (Target == Target_##X) \ |
| 599 return TargetHeader##X::create(Ctx); | 595 return TargetHeader##X::create(Ctx); |
| 600 #include "llvm/Config/SZTargets.def" | 596 #include "llvm/Config/SZTargets.def" |
| 601 | 597 |
| 602 llvm::report_fatal_error("Unsupported target header lowering"); | 598 llvm::report_fatal_error("Unsupported target header lowering"); |
| 603 } | 599 } |
| 604 | 600 |
| 605 TargetHeaderLowering::~TargetHeaderLowering() = default; | 601 TargetHeaderLowering::~TargetHeaderLowering() = default; |
| 606 | 602 |
| 607 } // end of namespace Ice | 603 } // end of namespace Ice |
| OLD | NEW |