mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
[PPC] Use alias symbols in address computation.
This seems to match what gcc does for ppc and what every other llvm backend does. This is a fixed version of r209638. The difference is to avoid any change in behavior for functions. The logic for using constant pools for function addresseses is spread over a few places and we have to keep them in sync. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209821 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -380,15 +380,12 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
bool IsAvailExt = false;
|
||||
|
||||
if (MO.isGlobal()) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
||||
const GlobalValue *RealGValue = GAlias ? GAlias->getAliasee() : GValue;
|
||||
MOSymbol = getSymbol(RealGValue);
|
||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
||||
IsExternal = GVar && !GVar->hasInitializer();
|
||||
IsCommon = GVar && RealGValue->hasCommonLinkage();
|
||||
IsFunction = !GVar;
|
||||
IsAvailExt = GVar && RealGValue->hasAvailableExternallyLinkage();
|
||||
const GlobalValue *GV = MO.getGlobal();
|
||||
MOSymbol = getSymbol(GV);
|
||||
IsExternal = GV->isDeclaration();
|
||||
IsCommon = GV->hasCommonLinkage();
|
||||
IsFunction = GV->getType()->getElementType()->isFunctionTy();
|
||||
IsAvailExt = GV->hasAvailableExternallyLinkage();
|
||||
} else if (MO.isCPI())
|
||||
MOSymbol = GetCPISymbol(MO.getIndex());
|
||||
else if (MO.isJTI())
|
||||
@ -427,13 +424,10 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
}
|
||||
else if (MO.isGlobal()) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
||||
const GlobalValue *RealGValue = GAlias ? GAlias->getAliasee() : GValue;
|
||||
MOSymbol = getSymbol(RealGValue);
|
||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
||||
|
||||
if (!GVar || !GVar->hasInitializer() || RealGValue->hasCommonLinkage() ||
|
||||
RealGValue->hasAvailableExternallyLinkage() ||
|
||||
MOSymbol = getSymbol(GValue);
|
||||
if (GValue->getType()->getElementType()->isFunctionTy() ||
|
||||
GValue->isDeclaration() || GValue->hasCommonLinkage() ||
|
||||
GValue->hasAvailableExternallyLinkage() ||
|
||||
TM.getCodeModel() == CodeModel::Large)
|
||||
MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
|
||||
}
|
||||
@ -460,13 +454,10 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
bool IsFunction = false;
|
||||
|
||||
if (MO.isGlobal()) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
const GlobalAlias *GAlias = dyn_cast<GlobalAlias>(GValue);
|
||||
const GlobalValue *RealGValue = GAlias ? GAlias->getAliasee() : GValue;
|
||||
MOSymbol = getSymbol(RealGValue);
|
||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(RealGValue);
|
||||
IsExternal = GVar && !GVar->hasInitializer();
|
||||
IsFunction = !GVar;
|
||||
const GlobalValue *GV = MO.getGlobal();
|
||||
MOSymbol = getSymbol(GV);
|
||||
IsExternal = GV->isDeclaration();
|
||||
IsFunction = GV->getType()->getElementType()->isFunctionTy();
|
||||
} else if (MO.isCPI())
|
||||
MOSymbol = GetCPISymbol(MO.getIndex());
|
||||
|
||||
|
Reference in New Issue
Block a user