Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: llvm/lib/Target/X86/X86FastISel.cpp

Issue 10808110: Fix cases where fast instruction selection generated both base and index registers (Closed)
Patch Set: Conditionalize code based on nacl target Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | llvm/lib/Target/X86/X86NaClRewritePass.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | llvm/lib/Target/X86/X86NaClRewritePass.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698