[llvm-commits] [llvm] r60608 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86Subtarget.cpp lib/Transforms/Scalar/LoopStrengthReduce.cpp test/CodeGen/X86/loop-strength-reduce-2.ll test/CodeGen/X86/loop-strength-reduce-3.ll test/CodeGen/X86/loop-strength-reduce.ll
Anton Korobeynikov
anton at korobeynikov.info
Fri Dec 5 14:01:20 PST 2008
Hi, Dale
>
> +/// True if accessing the GV requires a register. This is a
> superset of the
> +/// cases where GVRequiresExtraLoad is true. Some variations of
> PIC require
> +/// a register, but not an extra load.
> +bool X86Subtarget::GVRequiresRegister(const GlobalValue *GV,
> + const TargetMachine& TM,
> + bool isDirectCall) const
> +{
> + if (GVRequiresExtraLoad(GV, TM, isDirectCall))
> + return true;
> + // Code below here need only consider cases where
> GVRequiresExtraLoad
> + // returns false.
> + if (TM.getRelocationModel() == Reloc::PIC_)
> + return !isDirectCall &&
> + (GV->hasInternalLinkage() || GV->hasExternalLinkage());
I don't understand this. Why only internal and external linkage?
Actually for PIC on Linux (32 bit only) access to every symbols,
except ones with internal linkage or hidden visibility requires a GOT
register access. There was even special hook inside
X86ISelLowering.cpp (incomplete in general, but usable -
CallRequiresGOTPtrInReg() and another one around) for this sort of
thing. Please consider using it. We've just ended with 3 hooks used
for more or less similar stuff.
It will be nice to have all this in one place and in consistent state...
---
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
More information about the llvm-commits
mailing list