OLD | NEW |
1 //===-- ARMFastISel.cpp - ARM FastISel implementation ---------------------===// | 1 //===-- ARMFastISel.cpp - ARM 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 ARM-specific support for the FastISel class. Some | 10 // This file defines the ARM-specific support for the FastISel class. Some |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } | 485 } |
486 unsigned DestReg = createResultReg(TLI.getRegClassFor(VT)); | 486 unsigned DestReg = createResultReg(TLI.getRegClassFor(VT)); |
487 AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, | 487 AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, |
488 TII.get(Opc), DestReg).addImm(Imm)); | 488 TII.get(Opc), DestReg).addImm(Imm)); |
489 return DestReg; | 489 return DestReg; |
490 } | 490 } |
491 | 491 |
492 // Require VFP2 for loading fp constants. | 492 // Require VFP2 for loading fp constants. |
493 if (!Subtarget->hasVFP2()) return false; | 493 if (!Subtarget->hasVFP2()) return false; |
494 | 494 |
| 495 // @LOCALMOD-START |
| 496 if (!Subtarget->useConstIslands()) |
| 497 return false; |
| 498 // @LOCALMOD-END |
| 499 |
495 // MachineConstantPool wants an explicit alignment. | 500 // MachineConstantPool wants an explicit alignment. |
496 unsigned Align = DL.getPrefTypeAlignment(CFP->getType()); | 501 unsigned Align = DL.getPrefTypeAlignment(CFP->getType()); |
497 if (Align == 0) { | 502 if (Align == 0) { |
498 // TODO: Figure out if this is correct. | 503 // TODO: Figure out if this is correct. |
499 Align = DL.getTypeAllocSize(CFP->getType()); | 504 Align = DL.getTypeAllocSize(CFP->getType()); |
500 } | 505 } |
501 unsigned Idx = MCP.getConstantPoolIndex(cast<Constant>(CFP), Align); | 506 unsigned Idx = MCP.getConstantPoolIndex(cast<Constant>(CFP), Align); |
502 unsigned DestReg = createResultReg(TLI.getRegClassFor(VT)); | 507 unsigned DestReg = createResultReg(TLI.getRegClassFor(VT)); |
503 unsigned Opc = is64bit ? ARM::VLDRD : ARM::VLDRS; | 508 unsigned Opc = is64bit ? ARM::VLDRD : ARM::VLDRS; |
504 | 509 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 551 } |
547 } | 552 } |
548 | 553 |
549 unsigned ResultReg = 0; | 554 unsigned ResultReg = 0; |
550 if (Subtarget->useMovt(*FuncInfo.MF)) | 555 if (Subtarget->useMovt(*FuncInfo.MF)) |
551 ResultReg = fastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue()); | 556 ResultReg = fastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue()); |
552 | 557 |
553 if (ResultReg) | 558 if (ResultReg) |
554 return ResultReg; | 559 return ResultReg; |
555 | 560 |
| 561 // @LOCALMOD-START -- Can this just be an assert? (useMovt should be true |
| 562 // so the above code would have handled the constant). |
| 563 if (!Subtarget->useConstIslands()) |
| 564 return false; |
| 565 // @LOCALMOD-END |
| 566 |
556 // Load from constant pool. For now 32-bit only. | 567 // Load from constant pool. For now 32-bit only. |
557 if (VT != MVT::i32) | 568 if (VT != MVT::i32) |
558 return 0; | 569 return 0; |
559 | 570 |
560 // MachineConstantPool wants an explicit alignment. | 571 // MachineConstantPool wants an explicit alignment. |
561 unsigned Align = DL.getPrefTypeAlignment(C->getType()); | 572 unsigned Align = DL.getPrefTypeAlignment(C->getType()); |
562 if (Align == 0) { | 573 if (Align == 0) { |
563 // TODO: Figure out if this is correct. | 574 // TODO: Figure out if this is correct. |
564 Align = DL.getTypeAllocSize(C->getType()); | 575 Align = DL.getTypeAllocSize(C->getType()); |
565 } | 576 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 case Reloc::PIC_: | 619 case Reloc::PIC_: |
609 Opc = isThumb2 ? ARM::t2MOV_ga_pcrel : ARM::MOV_ga_pcrel; | 620 Opc = isThumb2 ? ARM::t2MOV_ga_pcrel : ARM::MOV_ga_pcrel; |
610 break; | 621 break; |
611 default: | 622 default: |
612 Opc = isThumb2 ? ARM::t2MOVi32imm : ARM::MOVi32imm; | 623 Opc = isThumb2 ? ARM::t2MOVi32imm : ARM::MOVi32imm; |
613 break; | 624 break; |
614 } | 625 } |
615 AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, | 626 AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, |
616 TII.get(Opc), DestReg).addGlobalAddress(GV, 0, TF)); | 627 TII.get(Opc), DestReg).addGlobalAddress(GV, 0, TF)); |
617 } else { | 628 } else { |
| 629 // @LOCALMOD-BEGIN |
| 630 if (!Subtarget->useConstIslands()) |
| 631 return false; |
| 632 // @LOCALMOD-END |
| 633 |
618 // MachineConstantPool wants an explicit alignment. | 634 // MachineConstantPool wants an explicit alignment. |
619 unsigned Align = DL.getPrefTypeAlignment(GV->getType()); | 635 unsigned Align = DL.getPrefTypeAlignment(GV->getType()); |
620 if (Align == 0) { | 636 if (Align == 0) { |
621 // TODO: Figure out if this is correct. | 637 // TODO: Figure out if this is correct. |
622 Align = DL.getTypeAllocSize(GV->getType()); | 638 Align = DL.getTypeAllocSize(GV->getType()); |
623 } | 639 } |
624 | 640 |
625 if (Subtarget->isTargetELF() && RelocM == Reloc::PIC_) | 641 if (Subtarget->isTargetELF() && RelocM == Reloc::PIC_) |
626 return ARMLowerPICELF(GV, Align, VT); | 642 return ARMLowerPICELF(GV, Align, VT); |
627 | 643 |
(...skipping 2449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 // iOS always has a FP for backtracking, force other targets | 3093 // iOS always has a FP for backtracking, force other targets |
3078 // to keep their FP when doing FastISel. The emitted code is | 3094 // to keep their FP when doing FastISel. The emitted code is |
3079 // currently superior, and in cases like test-suite's lencod | 3095 // currently superior, and in cases like test-suite's lencod |
3080 // FastISel isn't quite correct when FP is eliminated. | 3096 // FastISel isn't quite correct when FP is eliminated. |
3081 TM.Options.NoFramePointerElim = true; | 3097 TM.Options.NoFramePointerElim = true; |
3082 return new ARMFastISel(funcInfo, libInfo); | 3098 return new ARMFastISel(funcInfo, libInfo); |
3083 } | 3099 } |
3084 return nullptr; | 3100 return nullptr; |
3085 } | 3101 } |
3086 } | 3102 } |
OLD | NEW |