| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// | 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- 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 /// \file | 10 /// \file |
| 11 /// This file implements the TargetLoweringX86Base class, which | 11 /// This file implements the TargetLoweringX86Base class, which |
| 12 /// consists almost entirely of the lowering sequence for each | 12 /// consists almost entirely of the lowering sequence for each |
| 13 /// high-level instruction. | 13 /// high-level instruction. |
| 14 /// | 14 /// |
| 15 //===----------------------------------------------------------------------===// | 15 //===----------------------------------------------------------------------===// |
| 16 | 16 |
| 17 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 17 #ifndef SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| 18 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 18 #define SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| 19 | 19 |
| 20 #include "IceCfg.h" | 20 #include "IceCfg.h" |
| 21 #include "IceCfgNode.h" | 21 #include "IceCfgNode.h" |
| 22 #include "IceClFlags.h" | 22 #include "IceClFlags.h" |
| 23 #include "IceDefs.h" | 23 #include "IceDefs.h" |
| 24 #include "IceELFObjectWriter.h" | 24 #include "IceELFObjectWriter.h" |
| 25 #include "IceGlobalInits.h" | 25 #include "IceGlobalInits.h" |
| 26 #include "IceInstVarIter.h" |
| 26 #include "IceLiveness.h" | 27 #include "IceLiveness.h" |
| 27 #include "IceOperand.h" | 28 #include "IceOperand.h" |
| 28 #include "IcePhiLoweringImpl.h" | 29 #include "IcePhiLoweringImpl.h" |
| 29 #include "IceUtils.h" | 30 #include "IceUtils.h" |
| 30 #include "llvm/Support/MathExtras.h" | 31 #include "llvm/Support/MathExtras.h" |
| 31 | 32 |
| 32 #include <stack> | 33 #include <stack> |
| 33 | 34 |
| 34 namespace Ice { | 35 namespace Ice { |
| 35 namespace X86Internal { | 36 namespace X86Internal { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 for (Inst &Instr : Node->getInsts()) { | 187 for (Inst &Instr : Node->getInsts()) { |
| 187 // Check whether Instr is a valid producer. | 188 // Check whether Instr is a valid producer. |
| 188 Variable *Var = Instr.getDest(); | 189 Variable *Var = Instr.getDest(); |
| 189 if (!Instr.isDeleted() // only consider non-deleted instructions | 190 if (!Instr.isDeleted() // only consider non-deleted instructions |
| 190 && Var // only instructions with an actual dest var | 191 && Var // only instructions with an actual dest var |
| 191 && Var->getType() == IceType_i1 // only bool-type dest vars | 192 && Var->getType() == IceType_i1 // only bool-type dest vars |
| 192 && getProducerKind(&Instr) != PK_None) { // white-listed instructions | 193 && getProducerKind(&Instr) != PK_None) { // white-listed instructions |
| 193 Producers[Var->getIndex()] = BoolFoldingEntry<MachineTraits>(&Instr); | 194 Producers[Var->getIndex()] = BoolFoldingEntry<MachineTraits>(&Instr); |
| 194 } | 195 } |
| 195 // Check each src variable against the map. | 196 // Check each src variable against the map. |
| 196 for (SizeT I = 0; I < Instr.getSrcSize(); ++I) { | 197 FOREACH_VAR_IN_INST(Var, Instr) { |
| 197 Operand *Src = Instr.getSrc(I); | 198 SizeT VarNum = Var->getIndex(); |
| 198 SizeT NumVars = Src->getNumVars(); | 199 if (containsValid(VarNum)) { |
| 199 for (SizeT J = 0; J < NumVars; ++J) { | 200 if (IndexOfVarOperandInInst(Var) != |
| 200 const Variable *Var = Src->getVar(J); | 201 0 // All valid consumers use Var as the first source operand |
| 201 SizeT VarNum = Var->getIndex(); | 202 || |
| 202 if (containsValid(VarNum)) { | 203 getConsumerKind(&Instr) == CK_None // must be white-listed |
| 203 if (I != 0 // All valid consumers use Var as the first source operand | 204 || (Producers[VarNum].IsComplex && // complex can't be multi-use |
| 204 || getConsumerKind(&Instr) == CK_None // must be white-listed | 205 Producers[VarNum].NumUses > 0)) { |
| 205 || (Producers[VarNum].IsComplex && // complex can't be multi-use | 206 setInvalid(VarNum); |
| 206 Producers[VarNum].NumUses > 0)) { | 207 continue; |
| 207 setInvalid(VarNum); | 208 } |
| 208 continue; | 209 ++Producers[VarNum].NumUses; |
| 209 } | 210 if (Instr.isLastUse(Var)) { |
| 210 ++Producers[VarNum].NumUses; | 211 Producers[VarNum].IsLiveOut = false; |
| 211 if (Instr.isLastUse(Var)) { | |
| 212 Producers[VarNum].IsLiveOut = false; | |
| 213 } | |
| 214 } | 212 } |
| 215 } | 213 } |
| 216 } | 214 } |
| 217 } | 215 } |
| 218 for (auto &I : Producers) { | 216 for (auto &I : Producers) { |
| 219 // Ignore entries previously marked invalid. | 217 // Ignore entries previously marked invalid. |
| 220 if (I.second.Instr == nullptr) | 218 if (I.second.Instr == nullptr) |
| 221 continue; | 219 continue; |
| 222 // Disable the producer if its dest may be live beyond this block. | 220 // Disable the producer if its dest may be live beyond this block. |
| 223 if (I.second.IsLiveOut) { | 221 if (I.second.IsLiveOut) { |
| (...skipping 5140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5364 } | 5362 } |
| 5365 // the offset is not eligible for blinding or pooling, return the original | 5363 // the offset is not eligible for blinding or pooling, return the original |
| 5366 // mem operand | 5364 // mem operand |
| 5367 return MemOperand; | 5365 return MemOperand; |
| 5368 } | 5366 } |
| 5369 | 5367 |
| 5370 } // end of namespace X86Internal | 5368 } // end of namespace X86Internal |
| 5371 } // end of namespace Ice | 5369 } // end of namespace Ice |
| 5372 | 5370 |
| 5373 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 5371 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |