[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86Subtarget.h

Chris Lattner clattner at apple.com
Tue Nov 21 08:40:01 PST 2006


> Refactored *GVRequiresExtraLoad() to Subtarget method.

The patch looks good, but please make one minor change below.   
However, this patch was really hard to review, as your editor is  
stripping whitespace at the end of lines.  This makes the patch  
really noisy, please disable this feature.

>
> Index: llvm/lib/Target/X86/X86Subtarget.h
> diff -u llvm/lib/Target/X86/X86Subtarget.h:1.20 llvm/lib/Target/X86/ 
> X86Subtarget.h:1.21
> --- llvm/lib/Target/X86/X86Subtarget.h:1.20	Mon Oct 16 16:00:37 2006
> +++ llvm/lib/Target/X86/X86Subtarget.h	Mon Nov 20 18:01:06 2006
> @@ -14,6 +14,7 @@
>  #ifndef X86SUBTARGET_H
>  #define X86SUBTARGET_H
>
> +#include "llvm/GlobalValue.h"
>  #include "llvm/Target/TargetSubtarget.h"

...

> +
> +  /// True if accessing the GV requires an extra load. For  
> Windows, dllimported
> +  /// symbols are indirect, loading the value at address GV rather  
> then the
> +  /// value of GV itself. This means that the GlobalAddress must  
> be in the base
> +  /// or index register of the address, not the GV offset field.
> +  bool GVRequiresExtraLoad(const GlobalValue* GV, bool  
> isDirectCall) const
> +  {
> +    if (isTargetDarwin()) {
> +      return (!isDirectCall &&
> +              (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
> +               (GV->isExternal() && !GV->hasNotBeenReadFromBytecode 
> ())));
> +    } else if (isTargetCygwin() || isTargetWindows()) {
> +      return (GV->hasDLLImportLinkage());
> +    }
> +
> +    return false;
> +  }
>  };

Please move this method out-of-line to X86Subtarget.cpp so that  
X86Subtarget.h doesn't have to #include GlobalValue.h

Thanks!

-Chris



More information about the llvm-commits mailing list