| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8664.cpp - x86-64 lowering -----------===// |
| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 assert(isScalarIntegerType(Src0->getType())); | 379 assert(isScalarIntegerType(Src0->getType())); |
| 380 _mov(Reg, Src0, Traits::RegisterSet::Reg_eax); | 380 _mov(Reg, Src0, Traits::RegisterSet::Reg_eax); |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 // Add a ret instruction even if sandboxing is enabled, because addEpilog | 383 // Add a ret instruction even if sandboxing is enabled, because addEpilog |
| 384 // explicitly looks for a ret instruction as a marker for where to insert the | 384 // explicitly looks for a ret instruction as a marker for where to insert the |
| 385 // frame removal instructions. | 385 // frame removal instructions. |
| 386 _ret(Reg); | 386 _ret(Reg); |
| 387 // Add a fake use of esp to make sure esp stays alive for the entire | 387 // Add a fake use of esp to make sure esp stays alive for the entire |
| 388 // function. Otherwise post-call esp adjustments get dead-code eliminated. | 388 // function. Otherwise post-call esp adjustments get dead-code eliminated. |
| 389 // TODO: Are there more places where the fake use should be inserted? E.g. | 389 keepEspLiveAtExit(); |
| 390 // "void f(int n){while(1) g(n);}" may not have a ret instruction. | |
| 391 Variable *esp = | |
| 392 Func->getTarget()->getPhysicalRegister(Traits::RegisterSet::Reg_esp); | |
| 393 Context.insert(InstFakeUse::create(Func, esp)); | |
| 394 } | 390 } |
| 395 | 391 |
| 396 void TargetX8664::addProlog(CfgNode *Node) { | 392 void TargetX8664::addProlog(CfgNode *Node) { |
| 397 // Stack frame layout: | 393 // Stack frame layout: |
| 398 // | 394 // |
| 399 // +------------------------+ | 395 // +------------------------+ |
| 400 // | 1. return address | | 396 // | 1. return address | |
| 401 // +------------------------+ | 397 // +------------------------+ |
| 402 // | 2. preserved registers | | 398 // | 2. preserved registers | |
| 403 // +------------------------+ | 399 // +------------------------+ |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 // case the high-level table has extra entries. | 966 // case the high-level table has extra entries. |
| 971 #define X(tag, sizeLog2, align, elts, elty, str) \ | 967 #define X(tag, sizeLog2, align, elts, elty, str) \ |
| 972 static_assert(_table1_##tag == _table2_##tag, \ | 968 static_assert(_table1_##tag == _table2_##tag, \ |
| 973 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); | 969 "Inconsistency between ICETYPEX8664_TABLE and ICETYPE_TABLE"); |
| 974 ICETYPE_TABLE | 970 ICETYPE_TABLE |
| 975 #undef X | 971 #undef X |
| 976 } // end of namespace dummy3 | 972 } // end of namespace dummy3 |
| 977 } // end of anonymous namespace | 973 } // end of anonymous namespace |
| 978 | 974 |
| 979 } // end of namespace Ice | 975 } // end of namespace Ice |
| OLD | NEW |