OLD | NEW |
1 //===-- X86FastISel.cpp - X86 FastISel implementation ---------------------===// | 1 //===-- X86FastISel.cpp - X86 FastISel implementation ---------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
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 defines the X86-specific support for the FastISel class. Much | 10 // This file defines the X86-specific support for the FastISel class. Much |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // Now construct the final address. Note that the Disp, Scale, | 571 // Now construct the final address. Note that the Disp, Scale, |
572 // and Index values may already be set here. | 572 // and Index values may already be set here. |
573 AM.Base.Reg = LoadReg; | 573 AM.Base.Reg = LoadReg; |
574 AM.GV = 0; | 574 AM.GV = 0; |
575 return true; | 575 return true; |
576 } | 576 } |
577 } | 577 } |
578 | 578 |
579 // If all else fails, try to materialize the value in a register. | 579 // If all else fails, try to materialize the value in a register. |
580 if (!AM.GV || !Subtarget->isPICStyleRIPRel()) { | 580 if (!AM.GV || !Subtarget->isPICStyleRIPRel()) { |
| 581 // @LOCALMOD-START |
| 582 if (Subtarget->isTargetNaCl()) { |
| 583 // We can materialize into a memory address only if |
| 584 // no registers have been defined (and hence, we |
| 585 // aren't modifying an existing memory reference). |
| 586 if ((AM.Base.Reg == 0) && (AM.IndexReg == 0)) { |
| 587 // Put into index register so that the NaCl rewrite pass will |
| 588 // convert this to a 64-bit address. |
| 589 AM.IndexReg = getRegForValue(V); |
| 590 return AM.IndexReg != 0; |
| 591 } |
| 592 return false; |
| 593 } |
| 594 // @LOCALMOD-END |
581 if (AM.Base.Reg == 0) { | 595 if (AM.Base.Reg == 0) { |
582 AM.Base.Reg = getRegForValue(V); | 596 AM.Base.Reg = getRegForValue(V); |
583 return AM.Base.Reg != 0; | 597 return AM.Base.Reg != 0; |
584 } | 598 } |
585 if (AM.IndexReg == 0) { | 599 if (AM.IndexReg == 0) { |
586 assert(AM.Scale == 1 && "Scale with no index!"); | 600 assert(AM.Scale == 1 && "Scale with no index!"); |
587 AM.IndexReg = getRegForValue(V); | 601 AM.IndexReg = getRegForValue(V); |
588 return AM.IndexReg != 0; | 602 return AM.IndexReg != 0; |
589 } | 603 } |
590 } | 604 } |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 MI->eraseFromParent(); | 2214 MI->eraseFromParent(); |
2201 return true; | 2215 return true; |
2202 } | 2216 } |
2203 | 2217 |
2204 | 2218 |
2205 namespace llvm { | 2219 namespace llvm { |
2206 FastISel *X86::createFastISel(FunctionLoweringInfo &funcInfo) { | 2220 FastISel *X86::createFastISel(FunctionLoweringInfo &funcInfo) { |
2207 return new X86FastISel(funcInfo); | 2221 return new X86FastISel(funcInfo); |
2208 } | 2222 } |
2209 } | 2223 } |
OLD | NEW |