| 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 // This file implements the skeleton of the TargetLowering class, | 10 // This file implements the skeleton of the TargetLowering class, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 RegSetMask RegExclude = RegSet_None; | 218 RegSetMask RegExclude = RegSet_None; |
| 219 RegInclude |= RegSet_CallerSave; | 219 RegInclude |= RegSet_CallerSave; |
| 220 RegInclude |= RegSet_CalleeSave; | 220 RegInclude |= RegSet_CalleeSave; |
| 221 if (hasFramePointer()) | 221 if (hasFramePointer()) |
| 222 RegExclude |= RegSet_FramePointer; | 222 RegExclude |= RegSet_FramePointer; |
| 223 LinearScan.init(Kind); | 223 LinearScan.init(Kind); |
| 224 llvm::SmallBitVector RegMask = getRegisterSet(RegInclude, RegExclude); | 224 llvm::SmallBitVector RegMask = getRegisterSet(RegInclude, RegExclude); |
| 225 LinearScan.scan(RegMask, Ctx->getFlags().shouldRandomizeRegAlloc()); | 225 LinearScan.scan(RegMask, Ctx->getFlags().shouldRandomizeRegAlloc()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void TargetLowering::inferTwoAddress() { |
| 229 // Find two-address non-SSA instructions where Dest==Src0, and set |
| 230 // the DestNonKillable flag to keep liveness analysis consistent. |
| 231 for (auto Inst = Context.getCur(), E = Context.getNext(); Inst != E; ++Inst) { |
| 232 if (Inst->isDeleted()) |
| 233 continue; |
| 234 if (Variable *Dest = Inst->getDest()) { |
| 235 // TODO(stichnot): We may need to consider all source |
| 236 // operands, not just the first one, if using 3-address |
| 237 // instructions. |
| 238 if (Inst->getSrcSize() > 0 && Inst->getSrc(0) == Dest) |
| 239 Inst->setDestNonKillable(); |
| 240 } |
| 241 } |
| 242 } |
| 243 |
| 228 InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, | 244 InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, |
| 229 SizeT MaxSrcs) { | 245 SizeT MaxSrcs) { |
| 230 const bool HasTailCall = false; | 246 const bool HasTailCall = false; |
| 231 Constant *CallTarget = Ctx->getConstantExternSym(Name); | 247 Constant *CallTarget = Ctx->getConstantExternSym(Name); |
| 232 InstCall *Call = | 248 InstCall *Call = |
| 233 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); | 249 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); |
| 234 return Call; | 250 return Call; |
| 235 } | 251 } |
| 236 | 252 |
| 237 void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const { | 253 void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 266 return std::unique_ptr<TargetDataLowering>(TargetData##X::create(Ctx)); | 282 return std::unique_ptr<TargetDataLowering>(TargetData##X::create(Ctx)); |
| 267 #include "llvm/Config/SZTargets.def" | 283 #include "llvm/Config/SZTargets.def" |
| 268 | 284 |
| 269 llvm_unreachable("Unsupported target data lowering"); | 285 llvm_unreachable("Unsupported target data lowering"); |
| 270 return nullptr; | 286 return nullptr; |
| 271 } | 287 } |
| 272 | 288 |
| 273 TargetDataLowering::~TargetDataLowering() {} | 289 TargetDataLowering::~TargetDataLowering() {} |
| 274 | 290 |
| 275 } // end of namespace Ice | 291 } // end of namespace Ice |
| OLD | NEW |