| 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 // This file implements the TargetLoweringX86Base class, which | 10 // This file implements the TargetLoweringX86Base class, which |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "IceDefs.h" | 22 #include "IceDefs.h" |
| 23 #include "IceELFObjectWriter.h" | 23 #include "IceELFObjectWriter.h" |
| 24 #include "IceGlobalInits.h" | 24 #include "IceGlobalInits.h" |
| 25 #include "IceInstX8632.h" | 25 #include "IceInstX8632.h" |
| 26 #include "IceLiveness.h" | 26 #include "IceLiveness.h" |
| 27 #include "IceOperand.h" | 27 #include "IceOperand.h" |
| 28 #include "IceRegistersX8632.h" | 28 #include "IceRegistersX8632.h" |
| 29 #include "IceTargetLoweringX8632.def" | 29 #include "IceTargetLoweringX8632.def" |
| 30 #include "IceTargetLoweringX8632.h" | 30 #include "IceTargetLoweringX8632.h" |
| 31 #include "IceUtils.h" | 31 #include "IceUtils.h" |
| 32 |
| 33 #pragma clang diagnostic push |
| 34 #pragma clang diagnostic ignored "-Wunused-parameter" |
| 35 #pragma clang diagnostic ignored "-Wshadow" |
| 32 #include "llvm/Support/MathExtras.h" | 36 #include "llvm/Support/MathExtras.h" |
| 37 #pragma clang diagnostic pop |
| 33 | 38 |
| 34 namespace Ice { | 39 namespace Ice { |
| 35 namespace X86Internal { | 40 namespace X86Internal { |
| 36 | 41 |
| 37 // A helper class to ease the settings of RandomizationPoolingPause | 42 // A helper class to ease the settings of RandomizationPoolingPause |
| 38 // to disable constant blinding or pooling for some translation phases. | 43 // to disable constant blinding or pooling for some translation phases. |
| 39 class BoolFlagSaver { | 44 class BoolFlagSaver { |
| 40 BoolFlagSaver() = delete; | 45 BoolFlagSaver() = delete; |
| 41 BoolFlagSaver(const BoolFlagSaver &) = delete; | 46 BoolFlagSaver(const BoolFlagSaver &) = delete; |
| 42 BoolFlagSaver &operator=(const BoolFlagSaver &) = delete; | 47 BoolFlagSaver &operator=(const BoolFlagSaver &) = delete; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 && Var // only instructions with an actual dest var | 196 && Var // only instructions with an actual dest var |
| 192 && Var->getType() == IceType_i1 // only bool-type dest vars | 197 && Var->getType() == IceType_i1 // only bool-type dest vars |
| 193 && getProducerKind(&Instr) != PK_None) { // white-listed instructions | 198 && getProducerKind(&Instr) != PK_None) { // white-listed instructions |
| 194 Producers[Var->getIndex()] = BoolFoldingEntry<MachineTraits>(&Instr); | 199 Producers[Var->getIndex()] = BoolFoldingEntry<MachineTraits>(&Instr); |
| 195 } | 200 } |
| 196 // Check each src variable against the map. | 201 // Check each src variable against the map. |
| 197 for (SizeT I = 0; I < Instr.getSrcSize(); ++I) { | 202 for (SizeT I = 0; I < Instr.getSrcSize(); ++I) { |
| 198 Operand *Src = Instr.getSrc(I); | 203 Operand *Src = Instr.getSrc(I); |
| 199 SizeT NumVars = Src->getNumVars(); | 204 SizeT NumVars = Src->getNumVars(); |
| 200 for (SizeT J = 0; J < NumVars; ++J) { | 205 for (SizeT J = 0; J < NumVars; ++J) { |
| 201 const Variable *Var = Src->getVar(J); | 206 const Variable *V = Src->getVar(J); |
| 202 SizeT VarNum = Var->getIndex(); | 207 SizeT VarNum = V->getIndex(); |
| 203 if (containsValid(VarNum)) { | 208 if (containsValid(VarNum)) { |
| 204 if (I != 0 // All valid consumers use Var as the first source operand | 209 if (I != 0 // All valid consumers use V as the first source operand |
| 205 || getConsumerKind(&Instr) == CK_None // must be white-listed | 210 || getConsumerKind(&Instr) == CK_None // must be white-listed |
| 206 || (Producers[VarNum].IsComplex && // complex can't be multi-use | 211 || (Producers[VarNum].IsComplex && // complex can't be multi-use |
| 207 Producers[VarNum].NumUses > 0)) { | 212 Producers[VarNum].NumUses > 0)) { |
| 208 setInvalid(VarNum); | 213 setInvalid(VarNum); |
| 209 continue; | 214 continue; |
| 210 } | 215 } |
| 211 ++Producers[VarNum].NumUses; | 216 ++Producers[VarNum].NumUses; |
| 212 if (Instr.isLastUse(Var)) { | 217 if (Instr.isLastUse(V)) { |
| 213 Producers[VarNum].IsLiveOut = false; | 218 Producers[VarNum].IsLiveOut = false; |
| 214 } | 219 } |
| 215 } | 220 } |
| 216 } | 221 } |
| 217 } | 222 } |
| 218 } | 223 } |
| 219 for (auto &I : Producers) { | 224 for (auto &I : Producers) { |
| 220 // Ignore entries previously marked invalid. | 225 // Ignore entries previously marked invalid. |
| 221 if (I.second.Instr == nullptr) | 226 if (I.second.Instr == nullptr) |
| 222 continue; | 227 continue; |
| (...skipping 4500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4723 for (Inst &I : Node->getPhis()) { | 4728 for (Inst &I : Node->getPhis()) { |
| 4724 auto Phi = llvm::dyn_cast<InstPhi>(&I); | 4729 auto Phi = llvm::dyn_cast<InstPhi>(&I); |
| 4725 if (Phi->isDeleted()) | 4730 if (Phi->isDeleted()) |
| 4726 continue; | 4731 continue; |
| 4727 Variable *Dest = Phi->getDest(); | 4732 Variable *Dest = Phi->getDest(); |
| 4728 if (Dest->getType() == IceType_i64) { | 4733 if (Dest->getType() == IceType_i64) { |
| 4729 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); | 4734 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); |
| 4730 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); | 4735 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); |
| 4731 InstPhi *PhiLo = InstPhi::create(Func, Phi->getSrcSize(), DestLo); | 4736 InstPhi *PhiLo = InstPhi::create(Func, Phi->getSrcSize(), DestLo); |
| 4732 InstPhi *PhiHi = InstPhi::create(Func, Phi->getSrcSize(), DestHi); | 4737 InstPhi *PhiHi = InstPhi::create(Func, Phi->getSrcSize(), DestHi); |
| 4733 for (SizeT I = 0; I < Phi->getSrcSize(); ++I) { | 4738 for (SizeT i = 0; i < Phi->getSrcSize(); ++i) { |
| 4734 Operand *Src = Phi->getSrc(I); | 4739 Operand *Src = Phi->getSrc(i); |
| 4735 CfgNode *Label = Phi->getLabel(I); | 4740 CfgNode *Label = Phi->getLabel(i); |
| 4736 if (llvm::isa<ConstantUndef>(Src)) | 4741 if (llvm::isa<ConstantUndef>(Src)) |
| 4737 Src = Ctx->getConstantZero(Dest->getType()); | 4742 Src = Ctx->getConstantZero(Dest->getType()); |
| 4738 PhiLo->addArgument(loOperand(Src), Label); | 4743 PhiLo->addArgument(loOperand(Src), Label); |
| 4739 PhiHi->addArgument(hiOperand(Src), Label); | 4744 PhiHi->addArgument(hiOperand(Src), Label); |
| 4740 } | 4745 } |
| 4741 Node->getPhis().push_back(PhiLo); | 4746 Node->getPhis().push_back(PhiLo); |
| 4742 Node->getPhis().push_back(PhiHi); | 4747 Node->getPhis().push_back(PhiHi); |
| 4743 Phi->setDeleted(); | 4748 Phi->setDeleted(); |
| 4744 } | 4749 } |
| 4745 } | 4750 } |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5496 } | 5501 } |
| 5497 // the offset is not eligible for blinding or pooling, return the original | 5502 // the offset is not eligible for blinding or pooling, return the original |
| 5498 // mem operand | 5503 // mem operand |
| 5499 return MemOperand; | 5504 return MemOperand; |
| 5500 } | 5505 } |
| 5501 | 5506 |
| 5502 } // end of namespace X86Internal | 5507 } // end of namespace X86Internal |
| 5503 } // end of namespace Ice | 5508 } // end of namespace Ice |
| 5504 | 5509 |
| 5505 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 5510 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |