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

Side by Side Diff: llvm/lib/Target/X86/X86NaClRewritePass.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, 5 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 | « llvm/lib/Target/X86/X86FastISel.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //=== X86NaClRewritePAss.cpp - Rewrite instructions for NaCl SFI --*- C++ -*-=// 1 //=== X86NaClRewritePAss.cpp - Rewrite instructions for NaCl SFI --*- C++ -*-=//
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 contains a pass that ensures stores and loads and stack/frame 10 // This file contains a pass that ensures stores and loads and stack/frame
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 529
530 if (AbsoluteBase && AbsoluteIndex) { 530 if (AbsoluteBase && AbsoluteIndex) {
531 llvm_unreachable("Unexpected absolute register pair"); 531 llvm_unreachable("Unexpected absolute register pair");
532 } else if (AbsoluteBase) { 532 } else if (AbsoluteBase) {
533 AddrReg = IndexReg.getReg(); 533 AddrReg = IndexReg.getReg();
534 } else if (AbsoluteIndex) { 534 } else if (AbsoluteIndex) {
535 assert(!BaseReg.getReg() && "Unexpected base register"); 535 assert(!BaseReg.getReg() && "Unexpected base register");
536 assert(Scale.getImm() == 1); 536 assert(Scale.getImm() == 1);
537 AddrReg = 0; 537 AddrReg = 0;
538 } else { 538 } else {
539 assert(!BaseReg.getReg() && "Unexpected relative register pair"); 539 if (!BaseReg.getReg()) {
540 BaseReg.setReg(UseZeroBasedSandbox ? 0 : X86::R15); 540 // No base, fill in relative.
541 AddrReg = IndexReg.getReg(); 541 BaseReg.setReg(UseZeroBasedSandbox ? 0 : X86::R15);
542 AddrReg = IndexReg.getReg();
543 } else if (!UseZeroBasedSandbox) {
544 // Switch base and index registers if index register is undefined.
545 // That is do conversions like "mov d(%r,0,0) -> mov d(%r15, %r, 1)".
546 assert (!IndexReg.getReg()
547 && "Unexpected index and base register");
548 IndexReg.setReg(BaseReg.getReg());
549 Scale.setImm(1);
550 BaseReg.setReg(X86::R15);
551 AddrReg = IndexReg.getReg();
552 } else {
553 llvm_unreachable(
554 "Unexpected index and base register");
555 }
542 } 556 }
543 557
544 if (AddrReg) { 558 if (AddrReg) {
545 assert(!SegmentReg.getReg() && "Unexpected segment register"); 559 assert(!SegmentReg.getReg() && "Unexpected segment register");
546 SegmentReg.setReg(X86::PSEUDO_NACL_SEG); 560 SegmentReg.setReg(X86::PSEUDO_NACL_SEG);
547 return true; 561 return true;
548 } 562 }
549 563
550 return false; 564 return false;
551 } 565 }
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 } 885 }
872 dbgs() << "\n"; 886 dbgs() << "\n";
873 } 887 }
874 888
875 /// createX86NaClRewritePassPass - returns an instance of the pass. 889 /// createX86NaClRewritePassPass - returns an instance of the pass.
876 namespace llvm { 890 namespace llvm {
877 FunctionPass* createX86NaClRewritePass() { 891 FunctionPass* createX86NaClRewritePass() {
878 return new X86NaClRewritePass(); 892 return new X86NaClRewritePass();
879 } 893 }
880 } 894 }
OLDNEW
« no previous file with comments | « llvm/lib/Target/X86/X86FastISel.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698