[llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp X86Subtarget.h
Anton Korobeynikov
asl at math.spbu.ru
Thu Nov 30 14:43:10 PST 2006
Changes in directory llvm/lib/Target/X86:
X86Subtarget.cpp updated: 1.41 -> 1.42
X86Subtarget.h updated: 1.21 -> 1.22
---
Log message:
Factor out GVRequiresExtraLoad() from .h to .cpp
---
Diffs of the changes: (+19 -13)
X86Subtarget.cpp | 17 +++++++++++++++++
X86Subtarget.h | 15 ++-------------
2 files changed, 19 insertions(+), 13 deletions(-)
Index: llvm/lib/Target/X86/X86Subtarget.cpp
diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.41 llvm/lib/Target/X86/X86Subtarget.cpp:1.42
--- llvm/lib/Target/X86/X86Subtarget.cpp:1.41 Tue Nov 28 20:00:40 2006
+++ llvm/lib/Target/X86/X86Subtarget.cpp Thu Nov 30 16:42:55 2006
@@ -27,6 +27,23 @@
clEnumValEnd));
+/// 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 X86Subtarget::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;
+}
+
/// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in the
/// specified arguments. If we can't run cpuid on the host, return true.
bool X86::GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX,
Index: llvm/lib/Target/X86/X86Subtarget.h
diff -u llvm/lib/Target/X86/X86Subtarget.h:1.21 llvm/lib/Target/X86/X86Subtarget.h:1.22
--- llvm/lib/Target/X86/X86Subtarget.h:1.21 Mon Nov 20 18:01:06 2006
+++ llvm/lib/Target/X86/X86Subtarget.h Thu Nov 30 16:42:55 2006
@@ -14,13 +14,13 @@
#ifndef X86SUBTARGET_H
#define X86SUBTARGET_H
-#include "llvm/GlobalValue.h"
#include "llvm/Target/TargetSubtarget.h"
#include <string>
namespace llvm {
class Module;
+class GlobalValue;
class X86Subtarget : public TargetSubtarget {
public:
@@ -111,18 +111,7 @@
/// 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;
- }
+ bool GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const;
};
namespace X86 {
More information about the llvm-commits
mailing list