| 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 "IceLiveness.h" | 26 #include "IceLiveness.h" |
| 27 #include "IceOperand.h" | 27 #include "IceOperand.h" |
| 28 #include "IceUtils.h" | 28 #include "IceUtils.h" |
| 29 |
| 30 #pragma clang diagnostic push |
| 31 #pragma clang diagnostic ignored "-Wunused-parameter" |
| 32 #pragma clang diagnostic ignored "-Wshadow" |
| 29 #include "llvm/Support/MathExtras.h" | 33 #include "llvm/Support/MathExtras.h" |
| 34 #pragma clang diagnostic pop |
| 30 | 35 |
| 31 namespace Ice { | 36 namespace Ice { |
| 32 namespace X86Internal { | 37 namespace X86Internal { |
| 33 | 38 |
| 34 /// A helper class to ease the settings of RandomizationPoolingPause to disable | 39 /// A helper class to ease the settings of RandomizationPoolingPause to disable |
| 35 /// constant blinding or pooling for some translation phases. | 40 /// constant blinding or pooling for some translation phases. |
| 36 class BoolFlagSaver { | 41 class BoolFlagSaver { |
| 37 BoolFlagSaver() = delete; | 42 BoolFlagSaver() = delete; |
| 38 BoolFlagSaver(const BoolFlagSaver &) = delete; | 43 BoolFlagSaver(const BoolFlagSaver &) = delete; |
| 39 BoolFlagSaver &operator=(const BoolFlagSaver &) = delete; | 44 BoolFlagSaver &operator=(const BoolFlagSaver &) = delete; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 && Var // only instructions with an actual dest var | 191 && Var // only instructions with an actual dest var |
| 187 && Var->getType() == IceType_i1 // only bool-type dest vars | 192 && Var->getType() == IceType_i1 // only bool-type dest vars |
| 188 && getProducerKind(&Instr) != PK_None) { // white-listed instructions | 193 && getProducerKind(&Instr) != PK_None) { // white-listed instructions |
| 189 Producers[Var->getIndex()] = BoolFoldingEntry<MachineTraits>(&Instr); | 194 Producers[Var->getIndex()] = BoolFoldingEntry<MachineTraits>(&Instr); |
| 190 } | 195 } |
| 191 // Check each src variable against the map. | 196 // Check each src variable against the map. |
| 192 for (SizeT I = 0; I < Instr.getSrcSize(); ++I) { | 197 for (SizeT I = 0; I < Instr.getSrcSize(); ++I) { |
| 193 Operand *Src = Instr.getSrc(I); | 198 Operand *Src = Instr.getSrc(I); |
| 194 SizeT NumVars = Src->getNumVars(); | 199 SizeT NumVars = Src->getNumVars(); |
| 195 for (SizeT J = 0; J < NumVars; ++J) { | 200 for (SizeT J = 0; J < NumVars; ++J) { |
| 196 const Variable *Var = Src->getVar(J); | 201 const Variable *V = Src->getVar(J); |
| 197 SizeT VarNum = Var->getIndex(); | 202 SizeT VarNum = V->getIndex(); |
| 198 if (containsValid(VarNum)) { | 203 if (containsValid(VarNum)) { |
| 199 if (I != 0 // All valid consumers use Var as the first source operand | 204 if (I != 0 // All valid consumers use V as the first source operand |
| 200 || getConsumerKind(&Instr) == CK_None // must be white-listed | 205 || getConsumerKind(&Instr) == CK_None // must be white-listed |
| 201 || (Producers[VarNum].IsComplex && // complex can't be multi-use | 206 || (Producers[VarNum].IsComplex && // complex can't be multi-use |
| 202 Producers[VarNum].NumUses > 0)) { | 207 Producers[VarNum].NumUses > 0)) { |
| 203 setInvalid(VarNum); | 208 setInvalid(VarNum); |
| 204 continue; | 209 continue; |
| 205 } | 210 } |
| 206 ++Producers[VarNum].NumUses; | 211 ++Producers[VarNum].NumUses; |
| 207 if (Instr.isLastUse(Var)) { | 212 if (Instr.isLastUse(V)) { |
| 208 Producers[VarNum].IsLiveOut = false; | 213 Producers[VarNum].IsLiveOut = false; |
| 209 } | 214 } |
| 210 } | 215 } |
| 211 } | 216 } |
| 212 } | 217 } |
| 213 } | 218 } |
| 214 for (auto &I : Producers) { | 219 for (auto &I : Producers) { |
| 215 // Ignore entries previously marked invalid. | 220 // Ignore entries previously marked invalid. |
| 216 if (I.second.Instr == nullptr) | 221 if (I.second.Instr == nullptr) |
| 217 continue; | 222 continue; |
| (...skipping 4480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4698 for (Inst &I : Node->getPhis()) { | 4703 for (Inst &I : Node->getPhis()) { |
| 4699 auto Phi = llvm::dyn_cast<InstPhi>(&I); | 4704 auto Phi = llvm::dyn_cast<InstPhi>(&I); |
| 4700 if (Phi->isDeleted()) | 4705 if (Phi->isDeleted()) |
| 4701 continue; | 4706 continue; |
| 4702 Variable *Dest = Phi->getDest(); | 4707 Variable *Dest = Phi->getDest(); |
| 4703 if (Dest->getType() == IceType_i64) { | 4708 if (Dest->getType() == IceType_i64) { |
| 4704 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); | 4709 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest)); |
| 4705 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); | 4710 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest)); |
| 4706 InstPhi *PhiLo = InstPhi::create(Func, Phi->getSrcSize(), DestLo); | 4711 InstPhi *PhiLo = InstPhi::create(Func, Phi->getSrcSize(), DestLo); |
| 4707 InstPhi *PhiHi = InstPhi::create(Func, Phi->getSrcSize(), DestHi); | 4712 InstPhi *PhiHi = InstPhi::create(Func, Phi->getSrcSize(), DestHi); |
| 4708 for (SizeT I = 0; I < Phi->getSrcSize(); ++I) { | 4713 for (SizeT i = 0; i < Phi->getSrcSize(); ++i) { |
| 4709 Operand *Src = Phi->getSrc(I); | 4714 Operand *Src = Phi->getSrc(i); |
| 4710 CfgNode *Label = Phi->getLabel(I); | 4715 CfgNode *Label = Phi->getLabel(i); |
| 4711 if (llvm::isa<ConstantUndef>(Src)) | 4716 if (llvm::isa<ConstantUndef>(Src)) |
| 4712 Src = Ctx->getConstantZero(Dest->getType()); | 4717 Src = Ctx->getConstantZero(Dest->getType()); |
| 4713 PhiLo->addArgument(loOperand(Src), Label); | 4718 PhiLo->addArgument(loOperand(Src), Label); |
| 4714 PhiHi->addArgument(hiOperand(Src), Label); | 4719 PhiHi->addArgument(hiOperand(Src), Label); |
| 4715 } | 4720 } |
| 4716 Node->getPhis().push_back(PhiLo); | 4721 Node->getPhis().push_back(PhiLo); |
| 4717 Node->getPhis().push_back(PhiHi); | 4722 Node->getPhis().push_back(PhiHi); |
| 4718 Phi->setDeleted(); | 4723 Phi->setDeleted(); |
| 4719 } | 4724 } |
| 4720 } | 4725 } |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5417 } | 5422 } |
| 5418 // the offset is not eligible for blinding or pooling, return the original | 5423 // the offset is not eligible for blinding or pooling, return the original |
| 5419 // mem operand | 5424 // mem operand |
| 5420 return MemOperand; | 5425 return MemOperand; |
| 5421 } | 5426 } |
| 5422 | 5427 |
| 5423 } // end of namespace X86Internal | 5428 } // end of namespace X86Internal |
| 5424 } // end of namespace Ice | 5429 } // end of namespace Ice |
| 5425 | 5430 |
| 5426 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 5431 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |