[llvm-commits] GEP's too?

Reid Spencer rspencer at reidspencer.com
Tue Feb 27 18:52:39 PST 2007


Chris,

How far do we want to go with conversion to APInt? Does this include GEP
indices too? For example, consider this code from
lib/Analysis/ConstantFolding.cpp

>    if (isFoldableGEP) {
>       uint64_t Offset = TD->getIndexedOffset(Ptr->getType(),
>                                              (Value**)Ops+1, NumOps-1);
>       Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset);
>       return ConstantExpr::getIntToPtr(C, ResultTy);
>     }

The TargetData class could be altered to return an APInt value instead
of a uint64_t. This would then be used to construct the ConstantInt.
This would allow addressing beyond 64-bits but it seems like overkill to
me.

Your thoughts?

Reid.




More information about the llvm-commits mailing list