mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
GVRequiresExtraLoad is now never used for calls, simplify it based on this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75232 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
754b7650c2
commit
ed0dca6a5d
@ -301,7 +301,7 @@ static bool gvNeedsNonLazyPtr(const MachineOperand &GVOp,
|
|||||||
!TM.getSubtarget<X86Subtarget>().isTargetDarwin())
|
!TM.getSubtarget<X86Subtarget>().isTargetDarwin())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM, false);
|
return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class CodeEmitter>
|
template<class CodeEmitter>
|
||||||
|
@ -449,7 +449,7 @@ bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM) {
|
|||||||
|
|
||||||
// If the ABI doesn't require an extra load, return a direct reference to
|
// If the ABI doesn't require an extra load, return a direct reference to
|
||||||
// the global.
|
// the global.
|
||||||
if (!Subtarget->GVRequiresExtraLoad(GV, TM, false)) {
|
if (!Subtarget->GVRequiresExtraLoad(GV, TM)) {
|
||||||
if (Subtarget->isPICStyleRIPRel()) {
|
if (Subtarget->isPICStyleRIPRel()) {
|
||||||
// Use rip-relative addressing if we can. Above we verified that the
|
// Use rip-relative addressing if we can. Above we verified that the
|
||||||
// base and index registers are unused.
|
// base and index registers are unused.
|
||||||
|
@ -4554,7 +4554,7 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
|
|||||||
SelectionDAG &DAG) const {
|
SelectionDAG &DAG) const {
|
||||||
bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_;
|
bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_;
|
||||||
bool ExtraLoadRequired =
|
bool ExtraLoadRequired =
|
||||||
Subtarget->GVRequiresExtraLoad(GV, getTargetMachine(), false);
|
Subtarget->GVRequiresExtraLoad(GV, getTargetMachine());
|
||||||
|
|
||||||
// Create the TargetGlobalAddress node, folding in the constant
|
// Create the TargetGlobalAddress node, folding in the constant
|
||||||
// offset if it is legal.
|
// offset if it is legal.
|
||||||
@ -7075,7 +7075,7 @@ bool X86TargetLowering::isLegalAddressingMode(const AddrMode &AM,
|
|||||||
|
|
||||||
if (AM.BaseGV) {
|
if (AM.BaseGV) {
|
||||||
// We can only fold this if we don't need an extra load.
|
// We can only fold this if we don't need an extra load.
|
||||||
if (Subtarget->GVRequiresExtraLoad(AM.BaseGV, getTargetMachine(), false))
|
if (Subtarget->GVRequiresExtraLoad(AM.BaseGV, getTargetMachine()))
|
||||||
return false;
|
return false;
|
||||||
// If BaseGV requires a register, we cannot also have a BaseReg.
|
// If BaseGV requires a register, we cannot also have a BaseReg.
|
||||||
if (Subtarget->GVRequiresRegister(AM.BaseGV, getTargetMachine()) &&
|
if (Subtarget->GVRequiresRegister(AM.BaseGV, getTargetMachine()) &&
|
||||||
@ -8841,8 +8841,7 @@ void X86TargetLowering::LowerAsmOperandForConstraint(SDValue Op,
|
|||||||
}
|
}
|
||||||
// If we require an extra load to get this address, as in PIC mode, we
|
// If we require an extra load to get this address, as in PIC mode, we
|
||||||
// can't accept it.
|
// can't accept it.
|
||||||
if (Subtarget->GVRequiresExtraLoad(GA->getGlobal(), getTargetMachine(),
|
if (Subtarget->GVRequiresExtraLoad(GA->getGlobal(), getTargetMachine()))
|
||||||
false))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (hasMemory)
|
if (hasMemory)
|
||||||
|
@ -781,7 +781,7 @@ static bool regIsPICBase(unsigned BaseReg, const MachineRegisterInfo &MRI) {
|
|||||||
/// isGVStub - Return true if the GV requires an extra load to get the
|
/// isGVStub - Return true if the GV requires an extra load to get the
|
||||||
/// real address.
|
/// real address.
|
||||||
static inline bool isGVStub(GlobalValue *GV, X86TargetMachine &TM) {
|
static inline bool isGVStub(GlobalValue *GV, X86TargetMachine &TM) {
|
||||||
return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM, false);
|
return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CanRematLoadWithDispOperand - Return true if a load with the specified
|
/// CanRematLoadWithDispOperand - Return true if a load with the specified
|
||||||
|
@ -39,8 +39,7 @@ AsmWriterFlavor("x86-asm-syntax", cl::init(X86Subtarget::Unset),
|
|||||||
/// value of GV itself. This means that the GlobalAddress must be in the base
|
/// 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.
|
/// or index register of the address, not the GV offset field.
|
||||||
bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue *GV,
|
bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue *GV,
|
||||||
const TargetMachine &TM,
|
const TargetMachine &TM) const {
|
||||||
bool isDirectCall) const {
|
|
||||||
// Windows targets only require an extra load for DLLImport linkage values,
|
// Windows targets only require an extra load for DLLImport linkage values,
|
||||||
// and they need these regardless of whether we're in PIC mode or not.
|
// and they need these regardless of whether we're in PIC mode or not.
|
||||||
if (isTargetCygMing() || isTargetWindows())
|
if (isTargetCygMing() || isTargetWindows())
|
||||||
@ -51,8 +50,6 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue *GV,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (isTargetDarwin()) {
|
if (isTargetDarwin()) {
|
||||||
if (isDirectCall)
|
|
||||||
return false;
|
|
||||||
bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
|
bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
|
||||||
if (GV->hasHiddenVisibility() &&
|
if (GV->hasHiddenVisibility() &&
|
||||||
(Is64Bit || (!isDecl && !GV->hasCommonLinkage())))
|
(Is64Bit || (!isDecl && !GV->hasCommonLinkage())))
|
||||||
@ -60,11 +57,9 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue *GV,
|
|||||||
// target is x86-64 or the symbol is definitely defined in the current
|
// target is x86-64 or the symbol is definitely defined in the current
|
||||||
// translation unit.
|
// translation unit.
|
||||||
return false;
|
return false;
|
||||||
return !isDirectCall && (isDecl || GV->isWeakForLinker());
|
return isDecl || GV->isWeakForLinker();
|
||||||
} else if (isTargetELF()) {
|
} else if (isTargetELF()) {
|
||||||
// Extra load is needed for all externally visible.
|
// Extra load is needed for all externally visible.
|
||||||
if (isDirectCall)
|
|
||||||
return false;
|
|
||||||
if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
|
if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
@ -77,7 +72,7 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue *GV,
|
|||||||
/// a register, but not an extra load.
|
/// a register, but not an extra load.
|
||||||
bool X86Subtarget::GVRequiresRegister(const GlobalValue *GV,
|
bool X86Subtarget::GVRequiresRegister(const GlobalValue *GV,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
if (GVRequiresExtraLoad(GV, TM, false))
|
if (GVRequiresExtraLoad(GV, TM))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Code below here need only consider cases where GVRequiresExtraLoad
|
// Code below here need only consider cases where GVRequiresExtraLoad
|
||||||
|
@ -201,8 +201,7 @@ public:
|
|||||||
/// symbols are indirect, loading the value at address GV rather then the
|
/// 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
|
/// 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.
|
/// or index register of the address, not the GV offset field.
|
||||||
bool GVRequiresExtraLoad(const GlobalValue* GV, const TargetMachine &TM,
|
bool GVRequiresExtraLoad(const GlobalValue* GV, const TargetMachine &TM)const;
|
||||||
bool isDirectCall) const;
|
|
||||||
|
|
||||||
/// True if accessing the GV requires a register. This is a superset of the
|
/// True if accessing the GV requires a register. This is a superset of the
|
||||||
/// cases where GVRequiresExtraLoad is true. Some variations of PIC require
|
/// cases where GVRequiresExtraLoad is true. Some variations of PIC require
|
||||||
|
Loading…
Reference in New Issue
Block a user