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 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return nullptr; | 105 return nullptr; |
106 } | 106 } |
107 | 107 |
108 TargetLowering::TargetLowering(Cfg *Func) | 108 TargetLowering::TargetLowering(Cfg *Func) |
109 : Func(Func), Ctx(Func->getContext()), Context() {} | 109 : Func(Func), Ctx(Func->getContext()), Context() {} |
110 | 110 |
111 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target, | 111 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target, |
112 Cfg *Func) { | 112 Cfg *Func) { |
113 #define SUBZERO_TARGET(X) \ | 113 #define SUBZERO_TARGET(X) \ |
114 if (Target == Target_##X) \ | 114 if (Target == Target_##X) \ |
115 return std::unique_ptr<Assembler>(new X::Assembler##X(Func->getContext())); | 115 return std::unique_ptr<Assembler>(new X::Assembler##X()); |
116 #include "llvm/Config/SZTargets.def" | 116 #include "llvm/Config/SZTargets.def" |
117 | 117 |
118 Func->setError("Unsupported target assembler"); | 118 Func->setError("Unsupported target assembler"); |
119 return nullptr; | 119 return nullptr; |
120 } | 120 } |
121 | 121 |
122 void TargetLowering::doAddressOpt() { | 122 void TargetLowering::doAddressOpt() { |
123 if (llvm::isa<InstLoad>(*Context.getCur())) | 123 if (llvm::isa<InstLoad>(*Context.getCur())) |
124 doAddressOptLoad(); | 124 doAddressOptLoad(); |
125 else if (llvm::isa<InstStore>(*Context.getCur())) | 125 else if (llvm::isa<InstStore>(*Context.getCur())) |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 453 } |
454 if (UsesFramePointer) | 454 if (UsesFramePointer) |
455 Var->setStackOffset(-NextStackOffset); | 455 Var->setStackOffset(-NextStackOffset); |
456 else | 456 else |
457 Var->setStackOffset(SpillAreaSizeBytes - NextStackOffset); | 457 Var->setStackOffset(SpillAreaSizeBytes - NextStackOffset); |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, | 461 InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, |
462 SizeT MaxSrcs) { | 462 SizeT MaxSrcs) { |
463 const bool HasTailCall = false; | 463 constexpr bool HasTailCall = false; |
464 Constant *CallTarget = Ctx->getConstantExternSym(Name); | 464 Constant *CallTarget = Ctx->getConstantExternSym(Name); |
465 InstCall *Call = | 465 InstCall *Call = |
466 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); | 466 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); |
467 return Call; | 467 return Call; |
468 } | 468 } |
469 | 469 |
470 bool TargetLowering::shouldOptimizeMemIntrins() { | 470 bool TargetLowering::shouldOptimizeMemIntrins() { |
471 return Ctx->getFlags().getOptLevel() >= Opt_1 || | 471 return Ctx->getFlags().getOptLevel() >= Opt_1 || |
472 Ctx->getFlags().getForceMemIntrinOpt(); | 472 Ctx->getFlags().getForceMemIntrinOpt(); |
473 } | 473 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 if (Target == Target_##X) \ | 625 if (Target == Target_##X) \ |
626 return TargetHeader##X::create(Ctx); | 626 return TargetHeader##X::create(Ctx); |
627 #include "llvm/Config/SZTargets.def" | 627 #include "llvm/Config/SZTargets.def" |
628 | 628 |
629 llvm::report_fatal_error("Unsupported target header lowering"); | 629 llvm::report_fatal_error("Unsupported target header lowering"); |
630 } | 630 } |
631 | 631 |
632 TargetHeaderLowering::~TargetHeaderLowering() = default; | 632 TargetHeaderLowering::~TargetHeaderLowering() = default; |
633 | 633 |
634 } // end of namespace Ice | 634 } // end of namespace Ice |
OLD | NEW |