llvm.org GIT mirror llvm / 653b258
add a comment, make save/restore logic more obvious. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60076 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
1 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
863863 // Worse case, the target should support [reg] addressing modes. :)
864864 if (!AddrMode.HasBaseReg) {
865865 AddrMode.HasBaseReg = true;
866 AddrMode.BaseReg = Addr;
866867 // Still check for legality in case the target supports [imm] but not [i+r].
867 if (TLI.isLegalAddressingMode(AddrMode, AccessTy)) {
868 AddrMode.BaseReg = Addr;
868 if (TLI.isLegalAddressingMode(AddrMode, AccessTy))
869869 return true;
870 }
871870 AddrMode.HasBaseReg = false;
871 AddrMode.BaseReg = 0;
872872 }
873873
874874 // If the base register is already taken, see if we can do [r+r].
875875 if (AddrMode.Scale == 0) {
876876 AddrMode.Scale = 1;
877 if (TLI.isLegalAddressingMode(AddrMode, AccessTy)) {
878 AddrMode.ScaledReg = Addr;
877 AddrMode.ScaledReg = Addr;
878 if (TLI.isLegalAddressingMode(AddrMode, AccessTy))
879879 return true;
880 }
881880 AddrMode.Scale = 0;
881 AddrMode.ScaledReg = 0;
882882 }
883883 // Couldn't match.
884884 return false;
953953 ///
954954 /// Note that this (like most of CodeGenPrepare) is just a rough heuristic. If
955955 /// X was live across 'load Z' for other reasons, we actually *would* want to
956 /// fold the addressing mode in the Z case.
956 /// fold the addressing mode in the Z case. This would make Y die earlier.
957957 bool AddressingModeMatcher::
958958 IsProfitableToFoldIntoAddressingMode(Instruction *I) {
959959 if (IgnoreProfitability || !ENABLECRAZYHACK) return true;