Chromium Code Reviews| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 | 301 |
| 302 TargetLowering::AutoBundle::~AutoBundle() { | 302 TargetLowering::AutoBundle::~AutoBundle() { |
| 303 assert(Target->AutoBundling); | 303 assert(Target->AutoBundling); |
| 304 Target->AutoBundling = false; | 304 Target->AutoBundling = false; |
| 305 if (NeedSandboxing) { | 305 if (NeedSandboxing) { |
| 306 Target->_bundle_unlock(); | 306 Target->_bundle_unlock(); |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 void TargetLowering::genTargetHelperCalls() { | 310 void TargetLowering::genTargetHelperCalls() { |
| 311 GeneratingTargetHelpers = true; | |
|
Jim Stichnoth
2016/02/12 02:32:50
It would be nice to use a RAII helper object for t
Eric Holk
2016/02/12 18:38:15
Done.
| |
| 311 for (CfgNode *Node : Func->getNodes()) { | 312 for (CfgNode *Node : Func->getNodes()) { |
| 312 Context.init(Node); | 313 Context.init(Node); |
| 313 while (!Context.atEnd()) { | 314 while (!Context.atEnd()) { |
| 314 PostIncrLoweringContext _(Context); | 315 PostIncrLoweringContext _(Context); |
| 315 genTargetHelperCallFor(Context.getCur()); | 316 genTargetHelperCallFor(Context.getCur()); |
| 316 } | 317 } |
| 317 } | 318 } |
| 319 GeneratingTargetHelpers = false; | |
| 318 } | 320 } |
| 319 | 321 |
| 320 void TargetLowering::doAddressOpt() { | 322 void TargetLowering::doAddressOpt() { |
| 321 if (llvm::isa<InstLoad>(*Context.getCur())) | 323 if (llvm::isa<InstLoad>(*Context.getCur())) |
| 322 doAddressOptLoad(); | 324 doAddressOptLoad(); |
| 323 else if (llvm::isa<InstStore>(*Context.getCur())) | 325 else if (llvm::isa<InstStore>(*Context.getCur())) |
| 324 doAddressOptStore(); | 326 doAddressOptStore(); |
| 325 Context.advanceCur(); | 327 Context.advanceCur(); |
| 326 Context.advanceNext(); | 328 Context.advanceNext(); |
| 327 } | 329 } |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 | 701 |
| 700 bool TargetLowering::shouldOptimizeMemIntrins() { | 702 bool TargetLowering::shouldOptimizeMemIntrins() { |
| 701 return Ctx->getFlags().getOptLevel() >= Opt_1 || | 703 return Ctx->getFlags().getOptLevel() >= Opt_1 || |
| 702 Ctx->getFlags().getForceMemIntrinOpt(); | 704 Ctx->getFlags().getForceMemIntrinOpt(); |
| 703 } | 705 } |
| 704 | 706 |
| 705 void TargetLowering::scalarizeArithmetic(InstArithmetic::OpKind Kind, | 707 void TargetLowering::scalarizeArithmetic(InstArithmetic::OpKind Kind, |
| 706 Variable *Dest, Operand *Src0, | 708 Variable *Dest, Operand *Src0, |
| 707 Operand *Src1) { | 709 Operand *Src1) { |
| 708 scalarizeInstruction( | 710 scalarizeInstruction( |
| 709 Dest, Src0, Src1, | 711 Dest, [this, Kind](Variable *Dest, Operand *Src0, Operand *Src1) { |
| 710 [this, Kind](Variable *Dest, Variable *Src0, Variable *Src1) { | |
| 711 return Context.insert<InstArithmetic>(Kind, Dest, Src0, Src1); | 712 return Context.insert<InstArithmetic>(Kind, Dest, Src0, Src1); |
| 712 }); | 713 }, Src0, Src1); |
| 713 } | 714 } |
| 714 | 715 |
| 715 void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C, | 716 void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C, |
| 716 const char *Suffix) const { | 717 const char *Suffix) const { |
| 717 if (!BuildDefs::dump()) | 718 if (!BuildDefs::dump()) |
| 718 return; | 719 return; |
| 719 Ostream &Str = Ctx->getStrEmit(); | 720 Ostream &Str = Ctx->getStrEmit(); |
| 720 const IceString &EmitStr = C->getEmitString(); | 721 const IceString &EmitStr = C->getEmitString(); |
| 721 if (!EmitStr.empty()) { | 722 if (!EmitStr.empty()) { |
| 722 // C has a custom emit string, so we use it instead of the canonical | 723 // C has a custom emit string, so we use it instead of the canonical |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 case Target_##X: \ | 876 case Target_##X: \ |
| 876 return ::X::createTargetHeaderLowering(Ctx); | 877 return ::X::createTargetHeaderLowering(Ctx); |
| 877 #include "llvm/Config/SZTargets.def" | 878 #include "llvm/Config/SZTargets.def" |
| 878 #undef SUBZERO_TARGET | 879 #undef SUBZERO_TARGET |
| 879 } | 880 } |
| 880 } | 881 } |
| 881 | 882 |
| 882 TargetHeaderLowering::~TargetHeaderLowering() = default; | 883 TargetHeaderLowering::~TargetHeaderLowering() = default; |
| 883 | 884 |
| 884 } // end of namespace Ice | 885 } // end of namespace Ice |
| OLD | NEW |