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

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: 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
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 if (AM.Base.Reg == 0) { 581 // @LOCALMOD-START
582 AM.Base.Reg = getRegForValue(V); 582 // We can materialize into a memory address only if
583 return AM.Base.Reg != 0; 583 // no registers have been defined (and hence, we
584 } 584 // aren't modifying an existing memory reference).
585 if (AM.IndexReg == 0) { 585 if ((AM.Base.Reg == 0) && (AM.IndexReg == 0)) {
jvoung - send to chromium... 2012/07/24 21:08:35 You can avoid changing the original behavior for n
Karl 2012/07/24 22:05:30 Done.
586 assert(AM.Scale == 1 && "Scale with no index!"); 586 // Put into index register so that the NaCl rewrite pass will
587 // convert this to a 64-bit address.
587 AM.IndexReg = getRegForValue(V); 588 AM.IndexReg = getRegForValue(V);
588 return AM.IndexReg != 0; 589 return AM.IndexReg != 0;
589 } 590 }
591 // @LOCALMOD-END
590 } 592 }
591 593
592 return false; 594 return false;
593 } 595 }
594 596
595 /// X86SelectCallAddress - Attempt to fill in an address from the given value. 597 /// X86SelectCallAddress - Attempt to fill in an address from the given value.
596 /// 598 ///
597 bool X86FastISel::X86SelectCallAddress(const Value *V, X86AddressMode &AM) { 599 bool X86FastISel::X86SelectCallAddress(const Value *V, X86AddressMode &AM) {
598 const User *U = NULL; 600 const User *U = NULL;
599 unsigned Opcode = Instruction::UserOp1; 601 unsigned Opcode = Instruction::UserOp1;
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 MI->eraseFromParent(); 2202 MI->eraseFromParent();
2201 return true; 2203 return true;
2202 } 2204 }
2203 2205
2204 2206
2205 namespace llvm { 2207 namespace llvm {
2206 FastISel *X86::createFastISel(FunctionLoweringInfo &funcInfo) { 2208 FastISel *X86::createFastISel(FunctionLoweringInfo &funcInfo) {
2207 return new X86FastISel(funcInfo); 2209 return new X86FastISel(funcInfo);
2208 } 2210 }
2209 } 2211 }
OLDNEW
« no previous file with comments | « no previous file | llvm/lib/Target/X86/X86NaClRewritePass.cpp » ('j') | llvm/lib/Target/X86/X86NaClRewritePass.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698