mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Implement initial-exec TLS for PPC32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197824 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -301,6 +301,7 @@ MCSymbol *PPCAsmPrinter::lookUpOrCreateTOCEntry(MCSymbol *Sym) {
|
||||
///
|
||||
void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
MCInst TmpInst;
|
||||
bool isPPC64 = Subtarget.isPPC64();
|
||||
|
||||
// Lower multi-instruction pseudo operations.
|
||||
switch (MI->getOpcode()) {
|
||||
@@ -494,12 +495,13 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
.addExpr(SymGotTprel));
|
||||
return;
|
||||
}
|
||||
case PPC::LDgotTprelL: {
|
||||
case PPC::LDgotTprelL:
|
||||
case PPC::LDgotTprelL32: {
|
||||
// Transform %Xd = LDgotTprelL <ga:@sym>, %Xs
|
||||
LowerPPCMachineInstrToMCInst(MI, TmpInst, *this, Subtarget.isDarwin());
|
||||
|
||||
// Change the opcode to LD.
|
||||
TmpInst.setOpcode(PPC::LD);
|
||||
TmpInst.setOpcode(isPPC64 ? PPC::LD : PPC::LWZ);
|
||||
const MachineOperand &MO = MI->getOperand(1);
|
||||
const GlobalValue *GValue = MO.getGlobal();
|
||||
MCSymbol *MOSymbol = getSymbol(GValue);
|
||||
@@ -510,6 +512,24 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
OutStreamer.EmitInstruction(TmpInst);
|
||||
return;
|
||||
}
|
||||
|
||||
case PPC::PPC32GOT: {
|
||||
MCSymbol *GOTSymbol = OutContext.GetOrCreateSymbol(StringRef("_GLOBAL_OFFSET_TABLE_"));
|
||||
const MCExpr *SymGotTlsL =
|
||||
MCSymbolRefExpr::Create(GOTSymbol, MCSymbolRefExpr::VK_PPC_LO,
|
||||
OutContext);
|
||||
const MCExpr *SymGotTlsHA =
|
||||
MCSymbolRefExpr::Create(GOTSymbol, MCSymbolRefExpr::VK_PPC_HA,
|
||||
OutContext);
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::LI)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
.addExpr(SymGotTlsL));
|
||||
OutStreamer.EmitInstruction(MCInstBuilder(PPC::ADDIS)
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
.addReg(MI->getOperand(0).getReg())
|
||||
.addExpr(SymGotTlsHA));
|
||||
return;
|
||||
}
|
||||
case PPC::ADDIStlsgdHA: {
|
||||
// Transform: %Xd = ADDIStlsgdHA %X2, <ga:@sym>
|
||||
// Into: %Xd = ADDIS8 %X2, sym@got@tlsgd@ha
|
||||
|
||||
Reference in New Issue
Block a user