/// 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());
- }
+ if (GenerateExtraLoadsForGVs)
+ if (isTargetDarwin()) {
+ return (!isDirectCall &&
+ (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
+ (GV->isExternal() && !GV->hasNotBeenReadFromBytecode())));
+ } else if (isTargetCygwin() || isTargetWindows()) {
+ return (GV->hasDLLImportLinkage());
+ }
return false;
}
}
}
+/// SetJITMode - This is called to inform the subtarget info that we are
+/// producing code for the JIT.
+void X86Subtarget::SetJITMode() {
+ // JIT mode doesn't want extra loads for dllimported symbols, it knows exactly
+ // where everything is.
+ if (isTargetCygwin())
+ GenerateExtraLoadsForGVs = false;
+}
+
X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
: AsmFlavor(AsmWriterFlavor)
, X86SSELevel(NoMMXSSE)
// FIXME: this is a known good value for Yonah. How about others?
, MinRepStrSizeThreshold(128)
, Is64Bit(is64Bit)
+ , GenerateExtraLoadsForGVs(true)
, TargetType(isELF) { // Default to ELF unless otherwise specified.
// Determine default and user specified characteristics
/// pointer size is 64 bit.
bool Is64Bit;
+ /// GenerateExtraLoadsForGVs - True if we should generate extra loads for
+ /// indirect symbols (e.g. dllimported symbols on windows).
+ bool GenerateExtraLoadsForGVs;
public:
enum {
isELF, isCygwin, isDarwin, isWindows
/// 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;
+
+ /// SetJITMode - This is called to inform the subtarget info that we are
+ /// producing code for the JIT.
+ void SetJITMode();
};
namespace X86 {