mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
[PowerPC] Rename some more VK_PPC_ enums
This renames more VK_PPC_ enums, to make them more closely reflect the @modifier string they represent. This also prepares for adding a bunch of new VK_PPC_ enums in upcoming patches. For consistency, some MO_ flags related to VK_PPC_ enums are likewise renamed. No change in behaviour. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184547 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e0026d00f9
commit
92cfa61c50
@ -171,24 +171,24 @@ public:
|
||||
VK_ARM_TARGET2,
|
||||
VK_ARM_PREL31,
|
||||
|
||||
VK_PPC_ADDR16_HA, // symbol@ha
|
||||
VK_PPC_ADDR16_LO, // symbol@l
|
||||
VK_PPC_LO, // symbol@l
|
||||
VK_PPC_HA, // symbol@ha
|
||||
VK_PPC_TOCBASE, // symbol@tocbase
|
||||
VK_PPC_TOC16, // symbol@toc
|
||||
VK_PPC_TOC16_HA, // symbol@toc@ha
|
||||
VK_PPC_TOC16_LO, // symbol@toc@l
|
||||
VK_PPC_TPREL16_HA, // symbol@tprel@ha
|
||||
VK_PPC_TPREL16_LO, // symbol@tprel@l
|
||||
VK_PPC_DTPREL16_HA, // symbol@dtprel@ha
|
||||
VK_PPC_DTPREL16_LO, // symbol@dtprel@l
|
||||
VK_PPC_GOT_TPREL16_HA, // symbol@got@tprel@ha
|
||||
VK_PPC_GOT_TPREL16_LO, // symbol@got@tprel@l
|
||||
VK_PPC_TOC, // symbol@toc
|
||||
VK_PPC_TOC_LO, // symbol@toc@l
|
||||
VK_PPC_TOC_HA, // symbol@toc@ha
|
||||
VK_PPC_TPREL_LO, // symbol@tprel@l
|
||||
VK_PPC_TPREL_HA, // symbol@tprel@ha
|
||||
VK_PPC_DTPREL_LO, // symbol@dtprel@l
|
||||
VK_PPC_DTPREL_HA, // symbol@dtprel@ha
|
||||
VK_PPC_GOT_TPREL_LO, // symbol@got@tprel@l
|
||||
VK_PPC_GOT_TPREL_HA, // symbol@got@tprel@ha
|
||||
VK_PPC_TLS, // symbol@tls
|
||||
VK_PPC_GOT_TLSGD16_HA, // symbol@got@tlsgd@ha
|
||||
VK_PPC_GOT_TLSGD16_LO, // symbol@got@tlsgd@l
|
||||
VK_PPC_GOT_TLSGD_LO, // symbol@got@tlsgd@l
|
||||
VK_PPC_GOT_TLSGD_HA, // symbol@got@tlsgd@ha
|
||||
VK_PPC_TLSGD, // symbol@tlsgd
|
||||
VK_PPC_GOT_TLSLD16_HA, // symbol@got@tlsld@ha
|
||||
VK_PPC_GOT_TLSLD16_LO, // symbol@got@tlsld@l
|
||||
VK_PPC_GOT_TLSLD_LO, // symbol@got@tlsld@l
|
||||
VK_PPC_GOT_TLSLD_HA, // symbol@got@tlsld@ha
|
||||
VK_PPC_TLSLD, // symbol@tlsld
|
||||
|
||||
VK_Mips_GPREL,
|
||||
|
@ -363,18 +363,18 @@ void MCELFStreamer::fixSymbolsInTLSFixups(const MCExpr *expr) {
|
||||
case MCSymbolRefExpr::VK_Mips_GOTTPREL:
|
||||
case MCSymbolRefExpr::VK_Mips_TPREL_HI:
|
||||
case MCSymbolRefExpr::VK_Mips_TPREL_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_TPREL16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_TPREL16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_DTPREL16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_DTPREL16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TPREL16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TPREL16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_TPREL_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_TPREL_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_DTPREL_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_DTPREL_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_TLS:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_TLSGD:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_TLSLD:
|
||||
break;
|
||||
}
|
||||
|
@ -196,24 +196,24 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
|
||||
case VK_ARM_TARGET1: return "(target1)";
|
||||
case VK_ARM_TARGET2: return "(target2)";
|
||||
case VK_ARM_PREL31: return "(prel31)";
|
||||
case VK_PPC_ADDR16_HA: return "ha";
|
||||
case VK_PPC_ADDR16_LO: return "l";
|
||||
case VK_PPC_LO: return "l";
|
||||
case VK_PPC_HA: return "ha";
|
||||
case VK_PPC_TOCBASE: return "tocbase";
|
||||
case VK_PPC_TOC16: return "toc";
|
||||
case VK_PPC_TOC16_HA: return "toc@ha";
|
||||
case VK_PPC_TOC16_LO: return "toc@l";
|
||||
case VK_PPC_TPREL16_HA: return "tprel@ha";
|
||||
case VK_PPC_TPREL16_LO: return "tprel@l";
|
||||
case VK_PPC_DTPREL16_HA: return "dtprel@ha";
|
||||
case VK_PPC_DTPREL16_LO: return "dtprel@l";
|
||||
case VK_PPC_GOT_TPREL16_HA: return "got@tprel@ha";
|
||||
case VK_PPC_GOT_TPREL16_LO: return "got@tprel@l";
|
||||
case VK_PPC_TOC: return "toc";
|
||||
case VK_PPC_TOC_LO: return "toc@l";
|
||||
case VK_PPC_TOC_HA: return "toc@ha";
|
||||
case VK_PPC_TPREL_LO: return "tprel@l";
|
||||
case VK_PPC_TPREL_HA: return "tprel@ha";
|
||||
case VK_PPC_DTPREL_LO: return "dtprel@l";
|
||||
case VK_PPC_DTPREL_HA: return "dtprel@ha";
|
||||
case VK_PPC_GOT_TPREL_LO: return "got@tprel@l";
|
||||
case VK_PPC_GOT_TPREL_HA: return "got@tprel@ha";
|
||||
case VK_PPC_TLS: return "tls";
|
||||
case VK_PPC_GOT_TLSGD16_HA: return "got@tlsgd@ha";
|
||||
case VK_PPC_GOT_TLSGD16_LO: return "got@tlsgd@l";
|
||||
case VK_PPC_GOT_TLSLD16_HA: return "got@tlsld@ha";
|
||||
case VK_PPC_GOT_TLSLD16_LO: return "got@tlsld@l";
|
||||
case VK_PPC_GOT_TLSGD_LO: return "got@tlsgd@l";
|
||||
case VK_PPC_GOT_TLSGD_HA: return "got@tlsgd@ha";
|
||||
case VK_PPC_TLSGD: return "tlsgd";
|
||||
case VK_PPC_GOT_TLSLD_LO: return "got@tlsld@l";
|
||||
case VK_PPC_GOT_TLSLD_HA: return "got@tlsld@ha";
|
||||
case VK_PPC_TLSLD: return "tlsld";
|
||||
case VK_Mips_GPREL: return "GPREL";
|
||||
case VK_Mips_GOT_CALL: return "GOT_CALL";
|
||||
@ -279,40 +279,40 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
|
||||
.Case("imgrel", VK_COFF_IMGREL32)
|
||||
.Case("SECREL32", VK_SECREL)
|
||||
.Case("secrel32", VK_SECREL)
|
||||
.Case("HA", VK_PPC_ADDR16_HA)
|
||||
.Case("ha", VK_PPC_ADDR16_HA)
|
||||
.Case("L", VK_PPC_ADDR16_LO)
|
||||
.Case("l", VK_PPC_ADDR16_LO)
|
||||
.Case("L", VK_PPC_LO)
|
||||
.Case("l", VK_PPC_LO)
|
||||
.Case("HA", VK_PPC_HA)
|
||||
.Case("ha", VK_PPC_HA)
|
||||
.Case("TOCBASE", VK_PPC_TOCBASE)
|
||||
.Case("tocbase", VK_PPC_TOCBASE)
|
||||
.Case("TOC", VK_PPC_TOC16)
|
||||
.Case("toc", VK_PPC_TOC16)
|
||||
.Case("TOC@HA", VK_PPC_TOC16_HA)
|
||||
.Case("toc@ha", VK_PPC_TOC16_HA)
|
||||
.Case("TOC@L", VK_PPC_TOC16_LO)
|
||||
.Case("toc@l", VK_PPC_TOC16_LO)
|
||||
.Case("TOC", VK_PPC_TOC)
|
||||
.Case("toc", VK_PPC_TOC)
|
||||
.Case("TOC@L", VK_PPC_TOC_LO)
|
||||
.Case("toc@l", VK_PPC_TOC_LO)
|
||||
.Case("TOC@HA", VK_PPC_TOC_HA)
|
||||
.Case("toc@ha", VK_PPC_TOC_HA)
|
||||
.Case("TLS", VK_PPC_TLS)
|
||||
.Case("tls", VK_PPC_TLS)
|
||||
.Case("TPREL@HA", VK_PPC_TPREL16_HA)
|
||||
.Case("tprel@ha", VK_PPC_TPREL16_HA)
|
||||
.Case("TPREL@L", VK_PPC_TPREL16_LO)
|
||||
.Case("tprel@l", VK_PPC_TPREL16_LO)
|
||||
.Case("DTPREL@HA", VK_PPC_DTPREL16_HA)
|
||||
.Case("dtprel@ha", VK_PPC_DTPREL16_HA)
|
||||
.Case("DTPREL@L", VK_PPC_DTPREL16_LO)
|
||||
.Case("dtprel@l", VK_PPC_DTPREL16_LO)
|
||||
.Case("GOT@TPREL@HA", VK_PPC_GOT_TPREL16_HA)
|
||||
.Case("got@tprel@ha", VK_PPC_GOT_TPREL16_HA)
|
||||
.Case("GOT@TPREL@L", VK_PPC_GOT_TPREL16_LO)
|
||||
.Case("got@tprel@l", VK_PPC_GOT_TPREL16_LO)
|
||||
.Case("GOT@TLSGD@HA", VK_PPC_GOT_TLSGD16_HA)
|
||||
.Case("got@tlsgd@ha", VK_PPC_GOT_TLSGD16_HA)
|
||||
.Case("GOT@TLSGD@L", VK_PPC_GOT_TLSGD16_LO)
|
||||
.Case("got@tlsgd@l", VK_PPC_GOT_TLSGD16_LO)
|
||||
.Case("GOT@TLSLD@HA", VK_PPC_GOT_TLSLD16_HA)
|
||||
.Case("got@tlsld@ha", VK_PPC_GOT_TLSLD16_HA)
|
||||
.Case("GOT@TLSLD@L", VK_PPC_GOT_TLSLD16_LO)
|
||||
.Case("got@tlsld@l", VK_PPC_GOT_TLSLD16_LO)
|
||||
.Case("TPREL@L", VK_PPC_TPREL_LO)
|
||||
.Case("tprel@l", VK_PPC_TPREL_LO)
|
||||
.Case("TPREL@HA", VK_PPC_TPREL_HA)
|
||||
.Case("tprel@ha", VK_PPC_TPREL_HA)
|
||||
.Case("DTPREL@L", VK_PPC_DTPREL_LO)
|
||||
.Case("dtprel@l", VK_PPC_DTPREL_LO)
|
||||
.Case("DTPREL@HA", VK_PPC_DTPREL_HA)
|
||||
.Case("dtprel@ha", VK_PPC_DTPREL_HA)
|
||||
.Case("GOT@TPREL@L", VK_PPC_GOT_TPREL_LO)
|
||||
.Case("got@tprel@l", VK_PPC_GOT_TPREL_LO)
|
||||
.Case("GOT@TPREL@HA", VK_PPC_GOT_TPREL_HA)
|
||||
.Case("got@tprel@ha", VK_PPC_GOT_TPREL_HA)
|
||||
.Case("GOT@TLSGD@L", VK_PPC_GOT_TLSGD_LO)
|
||||
.Case("got@tlsgd@l", VK_PPC_GOT_TLSGD_LO)
|
||||
.Case("GOT@TLSGD@HA", VK_PPC_GOT_TLSGD_HA)
|
||||
.Case("got@tlsgd@ha", VK_PPC_GOT_TLSGD_HA)
|
||||
.Case("GOT@TLSLD@L", VK_PPC_GOT_TLSLD_LO)
|
||||
.Case("got@tlsld@l", VK_PPC_GOT_TLSLD_LO)
|
||||
.Case("GOT@TLSLD@HA", VK_PPC_GOT_TLSLD_HA)
|
||||
.Case("got@tlsld@ha", VK_PPC_GOT_TLSLD_HA)
|
||||
.Default(VK_Invalid);
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) {
|
||||
}
|
||||
|
||||
/// Extract @l/@ha modifier from expression. Recursively scan
|
||||
/// the expression and check for VK_PPC_ADDR16_HA/VK_PPC_ADDR16_LO
|
||||
/// the expression and check for VK_PPC_LO / VK_PPC_HA
|
||||
/// symbol variants. If all symbols with modifier use the same
|
||||
/// variant, return the corresponding PPCMCExpr::VariantKind,
|
||||
/// and a modified expression using the default symbol variant.
|
||||
@ -566,11 +566,11 @@ ExtractModifierFromExpr(const MCExpr *E,
|
||||
const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(E);
|
||||
|
||||
switch (SRE->getKind()) {
|
||||
case MCSymbolRefExpr::VK_PPC_ADDR16_HA:
|
||||
Variant = PPCMCExpr::VK_PPC_HA16;
|
||||
case MCSymbolRefExpr::VK_PPC_LO:
|
||||
Variant = PPCMCExpr::VK_PPC_LO;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_ADDR16_LO:
|
||||
Variant = PPCMCExpr::VK_PPC_LO16;
|
||||
case MCSymbolRefExpr::VK_PPC_HA:
|
||||
Variant = PPCMCExpr::VK_PPC_HA;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -87,46 +87,46 @@ unsigned PPCELFObjectWriter::getRelocTypeInner(const MCValue &Target,
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_PPC_ADDR16;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_ADDR16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_LO:
|
||||
Type = ELF::R_PPC_ADDR16_LO;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_ADDR16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_HA:
|
||||
Type = ELF::R_PPC_ADDR16_HA;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_TOC16:
|
||||
case MCSymbolRefExpr::VK_PPC_TOC:
|
||||
Type = ELF::R_PPC64_TOC16;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_TOC16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_TOC_LO:
|
||||
Type = ELF::R_PPC64_TOC16_LO;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_TOC16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_TOC_HA:
|
||||
Type = ELF::R_PPC64_TOC16_HA;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_TPREL16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_TPREL_LO:
|
||||
Type = ELF::R_PPC_TPREL16_LO;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_TPREL16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_TPREL_HA:
|
||||
Type = ELF::R_PPC_TPREL16_HA;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_DTPREL16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_DTPREL_LO:
|
||||
Type = ELF::R_PPC64_DTPREL16_LO;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_DTPREL16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_DTPREL_HA:
|
||||
Type = ELF::R_PPC64_DTPREL16_HA;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO:
|
||||
Type = ELF::R_PPC64_GOT_TLSGD16_LO;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA:
|
||||
Type = ELF::R_PPC64_GOT_TLSGD16_HA;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO:
|
||||
Type = ELF::R_PPC64_GOT_TLSLD16_LO;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA:
|
||||
Type = ELF::R_PPC64_GOT_TLSLD16_HA;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TPREL16_HA:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA:
|
||||
Type = ELF::R_PPC64_GOT_TPREL16_HA;
|
||||
break;
|
||||
}
|
||||
@ -137,16 +137,16 @@ unsigned PPCELFObjectWriter::getRelocTypeInner(const MCValue &Target,
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_PPC64_ADDR16_DS;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_ADDR16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_LO:
|
||||
Type = ELF::R_PPC64_ADDR16_LO_DS;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_TOC16:
|
||||
case MCSymbolRefExpr::VK_PPC_TOC:
|
||||
Type = ELF::R_PPC64_TOC16_DS;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_TOC16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_TOC_LO:
|
||||
Type = ELF::R_PPC64_TOC16_LO_DS;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TPREL16_LO:
|
||||
case MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO:
|
||||
Type = ELF::R_PPC64_GOT_TPREL16_LO_DS;
|
||||
break;
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ void PPCMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
if (isDarwinSyntax()) {
|
||||
switch (Kind) {
|
||||
default: llvm_unreachable("Invalid kind!");
|
||||
case VK_PPC_HA16: OS << "ha16"; break;
|
||||
case VK_PPC_LO16: OS << "lo16"; break;
|
||||
case VK_PPC_LO: OS << "lo16"; break;
|
||||
case VK_PPC_HA: OS << "ha16"; break;
|
||||
}
|
||||
|
||||
OS << '(';
|
||||
@ -38,8 +38,8 @@ void PPCMCExpr::PrintImpl(raw_ostream &OS) const {
|
||||
|
||||
switch (Kind) {
|
||||
default: llvm_unreachable("Invalid kind!");
|
||||
case VK_PPC_HA16: OS << "@ha"; break;
|
||||
case VK_PPC_LO16: OS << "@l"; break;
|
||||
case VK_PPC_LO: OS << "@l"; break;
|
||||
case VK_PPC_HA: OS << "@ha"; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,12 +57,12 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
switch (Kind) {
|
||||
default:
|
||||
llvm_unreachable("Invalid kind!");
|
||||
case VK_PPC_HA16:
|
||||
Result = ((Result >> 16) + ((Result & 0x8000) ? 1 : 0)) & 0xffff;
|
||||
break;
|
||||
case VK_PPC_LO16:
|
||||
case VK_PPC_LO:
|
||||
Result = Result & 0xffff;
|
||||
break;
|
||||
case VK_PPC_HA:
|
||||
Result = ((Result >> 16) + ((Result & 0x8000) ? 1 : 0)) & 0xffff;
|
||||
break;
|
||||
}
|
||||
Res = MCValue::get(Result);
|
||||
} else {
|
||||
@ -74,11 +74,11 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
||||
switch (Kind) {
|
||||
default:
|
||||
llvm_unreachable("Invalid kind!");
|
||||
case VK_PPC_HA16:
|
||||
Modifier = MCSymbolRefExpr::VK_PPC_ADDR16_HA;
|
||||
case VK_PPC_LO:
|
||||
Modifier = MCSymbolRefExpr::VK_PPC_LO;
|
||||
break;
|
||||
case VK_PPC_LO16:
|
||||
Modifier = MCSymbolRefExpr::VK_PPC_ADDR16_LO;
|
||||
case VK_PPC_HA:
|
||||
Modifier = MCSymbolRefExpr::VK_PPC_HA;
|
||||
break;
|
||||
}
|
||||
Sym = MCSymbolRefExpr::Create(&Sym->getSymbol(), Modifier, Context);
|
||||
|
@ -20,8 +20,8 @@ class PPCMCExpr : public MCTargetExpr {
|
||||
public:
|
||||
enum VariantKind {
|
||||
VK_PPC_None,
|
||||
VK_PPC_HA16,
|
||||
VK_PPC_LO16
|
||||
VK_PPC_LO,
|
||||
VK_PPC_HA
|
||||
};
|
||||
|
||||
private:
|
||||
@ -40,12 +40,12 @@ public:
|
||||
static const PPCMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
|
||||
MCContext &Ctx);
|
||||
|
||||
static const PPCMCExpr *CreateHa16(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(VK_PPC_HA16, Expr, Ctx);
|
||||
static const PPCMCExpr *CreateLo(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(VK_PPC_LO, Expr, Ctx);
|
||||
}
|
||||
|
||||
static const PPCMCExpr *CreateLo16(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(VK_PPC_LO16, Expr, Ctx);
|
||||
static const PPCMCExpr *CreateHa(const MCExpr *Expr, MCContext &Ctx) {
|
||||
return Create(VK_PPC_HA, Expr, Ctx);
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
@ -74,18 +74,18 @@ namespace llvm {
|
||||
/// The next are not flags but distinct values.
|
||||
MO_ACCESS_MASK = 0xf0,
|
||||
|
||||
/// MO_LO16, MO_HA16 - lo16(symbol) and ha16(symbol)
|
||||
MO_LO16 = 1 << 4,
|
||||
MO_HA16 = 2 << 4,
|
||||
/// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
|
||||
MO_LO = 1 << 4,
|
||||
MO_HA = 2 << 4,
|
||||
|
||||
MO_TPREL16_HA = 3 << 4,
|
||||
MO_TPREL16_LO = 4 << 4,
|
||||
MO_TPREL_LO = 4 << 4,
|
||||
MO_TPREL_HA = 3 << 4,
|
||||
|
||||
/// These values identify relocations on immediates folded
|
||||
/// into memory operations.
|
||||
MO_DTPREL16_LO = 5 << 4,
|
||||
MO_TLSLD16_LO = 6 << 4,
|
||||
MO_TOC16_LO = 7 << 4
|
||||
MO_DTPREL_LO = 5 << 4,
|
||||
MO_TLSLD_LO = 6 << 4,
|
||||
MO_TOC_LO = 7 << 4
|
||||
};
|
||||
} // end namespace PPCII
|
||||
|
||||
|
@ -372,7 +372,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MCSymbol *TOCEntry = lookUpOrCreateTOCEntry(MOSymbol);
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(TOCEntry, MCSymbolRefExpr::VK_PPC_TOC16,
|
||||
MCSymbolRefExpr::Create(TOCEntry, MCSymbolRefExpr::VK_PPC_TOC,
|
||||
OutContext);
|
||||
TmpInst.getOperand(1) = MCOperand::CreateExpr(Exp);
|
||||
OutStreamer.EmitInstruction(TmpInst);
|
||||
@ -417,7 +417,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC16_HA,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_HA,
|
||||
OutContext);
|
||||
TmpInst.getOperand(2) = MCOperand::CreateExpr(Exp);
|
||||
OutStreamer.EmitInstruction(TmpInst);
|
||||
@ -454,7 +454,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
}
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC16_LO,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_LO,
|
||||
OutContext);
|
||||
TmpInst.getOperand(1) = MCOperand::CreateExpr(Exp);
|
||||
OutStreamer.EmitInstruction(TmpInst);
|
||||
@ -490,7 +490,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MOSymbol = lookUpOrCreateTOCEntry(MOSymbol);
|
||||
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC16_LO,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_TOC_LO,
|
||||
OutContext);
|
||||
TmpInst.getOperand(2) = MCOperand::CreateExpr(Exp);
|
||||
OutStreamer.EmitInstruction(TmpInst);
|
||||
@ -504,7 +504,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
||||
const MCExpr *SymGotTprel =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL16_HA,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_HA,
|
||||
OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDIS8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -522,7 +522,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
||||
const MCExpr *Exp =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL16_LO,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO,
|
||||
OutContext);
|
||||
TmpInst.getOperand(1) = MCOperand::CreateExpr(Exp);
|
||||
OutStreamer.EmitInstruction(TmpInst);
|
||||
@ -536,7 +536,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
||||
const MCExpr *SymGotTlsGD =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD16_HA,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_HA,
|
||||
OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDIS8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -552,7 +552,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
||||
const MCExpr *SymGotTlsGD =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD16_LO,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO,
|
||||
OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDI8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -588,7 +588,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
||||
const MCExpr *SymGotTlsLD =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD16_HA,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_HA,
|
||||
OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDIS8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -604,7 +604,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
||||
const MCExpr *SymGotTlsLD =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD16_LO,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO,
|
||||
OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDI8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -640,7 +640,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
||||
const MCExpr *SymDtprel =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL16_HA,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_HA,
|
||||
OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDIS8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -656,7 +656,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = Mang->getSymbol(GValue);
|
||||
const MCExpr *SymDtprel =
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL16_LO,
|
||||
MCSymbolRefExpr::Create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_LO,
|
||||
OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDI8)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
@ -891,7 +891,7 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
// mflr r11
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::MFLR).addReg(PPC::R11));
|
||||
// addis r11, r11, ha16(LazyPtr - AnonSymbol)
|
||||
const MCExpr *SubHa16 = PPCMCExpr::CreateHa16(Sub, OutContext);
|
||||
const MCExpr *SubHa16 = PPCMCExpr::CreateHa(Sub, OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDIS)
|
||||
.addReg(PPC::R11)
|
||||
.addReg(PPC::R11)
|
||||
@ -901,7 +901,7 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
|
||||
// ldu r12, lo16(LazyPtr - AnonSymbol)(r11)
|
||||
// lwzu r12, lo16(LazyPtr - AnonSymbol)(r11)
|
||||
const MCExpr *SubLo16 = PPCMCExpr::CreateLo16(Sub, OutContext);
|
||||
const MCExpr *SubLo16 = PPCMCExpr::CreateLo(Sub, OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(isPPC64 ? PPC::LDU : PPC::LWZU)
|
||||
.addReg(PPC::R12)
|
||||
.addExpr(SubLo16).addExpr(SubLo16)
|
||||
@ -946,14 +946,14 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
||||
OutStreamer.EmitSymbolAttribute(RawSym, MCSA_IndirectSymbol);
|
||||
|
||||
// lis r11, ha16(LazyPtr)
|
||||
const MCExpr *LazyPtrHa16 = PPCMCExpr::CreateHa16(LazyPtrExpr, OutContext);
|
||||
const MCExpr *LazyPtrHa16 = PPCMCExpr::CreateHa(LazyPtrExpr, OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::LIS)
|
||||
.addReg(PPC::R11)
|
||||
.addExpr(LazyPtrHa16));
|
||||
|
||||
// ldu r12, lo16(LazyPtr)(r11)
|
||||
// lwzu r12, lo16(LazyPtr)(r11)
|
||||
const MCExpr *LazyPtrLo16 = PPCMCExpr::CreateLo16(LazyPtrExpr, OutContext);
|
||||
const MCExpr *LazyPtrLo16 = PPCMCExpr::CreateLo(LazyPtrExpr, OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(isPPC64 ? PPC::LDU : PPC::LWZU)
|
||||
.addReg(PPC::R12)
|
||||
.addExpr(LazyPtrLo16).addExpr(LazyPtrLo16)
|
||||
|
@ -201,8 +201,8 @@ unsigned PPCCodeEmitter::getS16ImmEncoding(const MachineInstr &MI,
|
||||
unsigned RelocID;
|
||||
switch (MO.getTargetFlags() & PPCII::MO_ACCESS_MASK) {
|
||||
default: llvm_unreachable("Unsupported target operand flags!");
|
||||
case PPCII::MO_HA16: RelocID = PPC::reloc_absolute_high; break;
|
||||
case PPCII::MO_LO16: RelocID = PPC::reloc_absolute_low; break;
|
||||
case PPCII::MO_LO: RelocID = PPC::reloc_absolute_low; break;
|
||||
case PPCII::MO_HA: RelocID = PPC::reloc_absolute_high; break;
|
||||
}
|
||||
|
||||
MCE.addRelocation(GetRelocation(MO, RelocID));
|
||||
|
@ -1502,13 +1502,13 @@ void PPCDAGToDAGISel::PostprocessISelDAG() {
|
||||
continue;
|
||||
break;
|
||||
case PPC::ADDIdtprelL:
|
||||
Flags = PPCII::MO_DTPREL16_LO;
|
||||
Flags = PPCII::MO_DTPREL_LO;
|
||||
break;
|
||||
case PPC::ADDItlsldL:
|
||||
Flags = PPCII::MO_TLSLD16_LO;
|
||||
Flags = PPCII::MO_TLSLD_LO;
|
||||
break;
|
||||
case PPC::ADDItocL:
|
||||
Flags = PPCII::MO_TOC16_LO;
|
||||
Flags = PPCII::MO_TOC_LO;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1236,8 +1236,8 @@ bool PPCTargetLowering::getPreIndexedAddressParts(SDNode *N, SDValue &Base,
|
||||
/// PICBase, set the HiOpFlags and LoOpFlags to the target MO flags.
|
||||
static bool GetLabelAccessInfo(const TargetMachine &TM, unsigned &HiOpFlags,
|
||||
unsigned &LoOpFlags, const GlobalValue *GV = 0) {
|
||||
HiOpFlags = PPCII::MO_HA16;
|
||||
LoOpFlags = PPCII::MO_LO16;
|
||||
HiOpFlags = PPCII::MO_HA;
|
||||
LoOpFlags = PPCII::MO_LO;
|
||||
|
||||
// Don't use the pic base if not in PIC relocation model. Or if we are on a
|
||||
// non-darwin platform. We don't support PIC on other platforms yet.
|
||||
@ -1350,9 +1350,9 @@ SDValue PPCTargetLowering::LowerGlobalTLSAddress(SDValue Op,
|
||||
|
||||
if (Model == TLSModel::LocalExec) {
|
||||
SDValue TGAHi = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0,
|
||||
PPCII::MO_TPREL16_HA);
|
||||
PPCII::MO_TPREL_HA);
|
||||
SDValue TGALo = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0,
|
||||
PPCII::MO_TPREL16_LO);
|
||||
PPCII::MO_TPREL_LO);
|
||||
SDValue TLSReg = DAG.getRegister(is64bit ? PPC::X13 : PPC::R2,
|
||||
is64bit ? MVT::i64 : MVT::i32);
|
||||
SDValue Hi = DAG.getNode(PPCISD::Hi, dl, PtrVT, TGAHi, TLSReg);
|
||||
|
@ -112,20 +112,20 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
|
||||
unsigned access = MO.getTargetFlags() & PPCII::MO_ACCESS_MASK;
|
||||
|
||||
switch (access) {
|
||||
case PPCII::MO_TPREL16_HA:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_TPREL16_HA;
|
||||
case PPCII::MO_TPREL_LO:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_TPREL_LO;
|
||||
break;
|
||||
case PPCII::MO_TPREL16_LO:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_TPREL16_LO;
|
||||
case PPCII::MO_TPREL_HA:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_TPREL_HA;
|
||||
break;
|
||||
case PPCII::MO_DTPREL16_LO:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_DTPREL16_LO;
|
||||
case PPCII::MO_DTPREL_LO:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_DTPREL_LO;
|
||||
break;
|
||||
case PPCII::MO_TLSLD16_LO:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_GOT_TLSLD16_LO;
|
||||
case PPCII::MO_TLSLD_LO:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO;
|
||||
break;
|
||||
case PPCII::MO_TOC16_LO:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_TOC16_LO;
|
||||
case PPCII::MO_TOC_LO:
|
||||
RefKind = MCSymbolRefExpr::VK_PPC_TOC_LO;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -146,11 +146,11 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
|
||||
|
||||
// Add ha16() / lo16() markers if required.
|
||||
switch (access) {
|
||||
case PPCII::MO_HA16:
|
||||
Expr = PPCMCExpr::CreateHa16(Expr, Ctx);
|
||||
case PPCII::MO_LO:
|
||||
Expr = PPCMCExpr::CreateLo(Expr, Ctx);
|
||||
break;
|
||||
case PPCII::MO_LO16:
|
||||
Expr = PPCMCExpr::CreateLo16(Expr, Ctx);
|
||||
case PPCII::MO_HA:
|
||||
Expr = PPCMCExpr::CreateHa(Expr, Ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user