summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-09 23:29:07 +0000
committerChris Lattner <sabre@nondot.org>2007-04-09 23:29:07 +0000
commit3e9690f987c687f94f4069e713c782a16e0851ed (patch)
tree54e20a7868ffee6b9e23879e1c8a32a6ab517c9e /llvm/lib/Transforms
parentf1ca1376d3d04c1229aa26b1f6eeaa93252e1b8b (diff)
downloadbcm5719-llvm-3e9690f987c687f94f4069e713c782a16e0851ed.tar.gz
bcm5719-llvm-3e9690f987c687f94f4069e713c782a16e0851ed.zip
eliminate the last uses of some TLI methods.
llvm-svn: 35844
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 91449ecb12b..ccd44a22fe8 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -536,11 +536,15 @@ static bool SinkInvariantGEPIndex(BinaryOperator *BinOp,
// Check if it is possible to fold the expression to address mode.
if (UseTy && isa<ConstantInt>(BinOp->getOperand(1))) {
- uint64_t Scale = TLI.getTargetData()->getTypeSize(UseTy);
int64_t Cst = cast<ConstantInt>(BinOp->getOperand(1))->getSExtValue();
// e.g. load (gep i32 * %P, (X+42)) => load (%P + X*4 + 168).
- if (TLI.isLegalAddressImmediate(Cst*Scale, UseTy) &&
- (Scale == 1 || TLI.isLegalAddressScale(Scale, UseTy))) {
+ TargetLowering::AddrMode AM;
+ // FIXME: This computation isn't right, scale is incorrect.
+ AM.Scale = TLI.getTargetData()->getTypeSize(UseTy);
+ // FIXME: Should should also include other fixed offsets.
+ AM.BaseOffs = Cst*AM.Scale;
+
+ if (TLI.isLegalAddressingMode(AM, UseTy)) {
DestBBs.insert(GEPIBB);
MadeChange = true;
break;
OpenPOWER on IntegriCloud