mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Reapply r151278 with fixes.
MCize function entry label emission on PowerPC64 properly. llvm-svn: 151547
This commit is contained in:
parent
ff495392fa
commit
200acf8e6e
@ -39,6 +39,7 @@
|
|||||||
#include "llvm/MC/MCSectionMachO.h"
|
#include "llvm/MC/MCSectionMachO.h"
|
||||||
#include "llvm/MC/MCStreamer.h"
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
|
#include "llvm/MC/MCSectionELF.h"
|
||||||
#include "llvm/Target/Mangler.h"
|
#include "llvm/Target/Mangler.h"
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
@ -49,6 +50,7 @@
|
|||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
#include "llvm/Support/TargetRegistry.h"
|
#include "llvm/Support/TargetRegistry.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
#include "llvm/Support/ELF.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "InstPrinter/PPCInstPrinter.h"
|
#include "InstPrinter/PPCInstPrinter.h"
|
||||||
@ -391,13 +393,21 @@ void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
|
|||||||
return AsmPrinter::EmitFunctionEntryLabel();
|
return AsmPrinter::EmitFunctionEntryLabel();
|
||||||
|
|
||||||
// Emit an official procedure descriptor.
|
// Emit an official procedure descriptor.
|
||||||
// FIXME 64-bit SVR4: Use MCSection here!
|
const MCSection *Current = OutStreamer.getCurrentSection();
|
||||||
OutStreamer.EmitRawText(StringRef("\t.section\t\".opd\",\"aw\""));
|
const MCSectionELF *Section = OutStreamer.getContext().getELFSection(".opd",
|
||||||
OutStreamer.EmitRawText(StringRef("\t.align 3"));
|
ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC,
|
||||||
|
SectionKind::getReadOnly());
|
||||||
|
OutStreamer.SwitchSection(Section);
|
||||||
OutStreamer.EmitLabel(CurrentFnSym);
|
OutStreamer.EmitLabel(CurrentFnSym);
|
||||||
OutStreamer.EmitRawText("\t.quad .L." + Twine(CurrentFnSym->getName()) +
|
OutStreamer.EmitValueToAlignment(8);
|
||||||
",.TOC.@tocbase");
|
MCSymbol *Symbol1 =
|
||||||
OutStreamer.EmitRawText(StringRef("\t.previous"));
|
OutContext.GetOrCreateSymbol(".L." + Twine(CurrentFnSym->getName()));
|
||||||
|
MCSymbol *Symbol2 = OutContext.GetOrCreateSymbol(StringRef(".TOC.@tocbase"));
|
||||||
|
OutStreamer.EmitValue(MCSymbolRefExpr::Create(Symbol1, OutContext),
|
||||||
|
Subtarget.isPPC64() ? 8 : 4/*size*/, 0/*addrspace*/);
|
||||||
|
OutStreamer.EmitValue(MCSymbolRefExpr::Create(Symbol2, OutContext),
|
||||||
|
Subtarget.isPPC64() ? 8 : 4/*size*/, 0/*addrspace*/);
|
||||||
|
OutStreamer.SwitchSection(Current);
|
||||||
|
|
||||||
MCSymbol *RealFnSym = OutContext.GetOrCreateSymbol(
|
MCSymbol *RealFnSym = OutContext.GetOrCreateSymbol(
|
||||||
".L." + Twine(CurrentFnSym->getName()));
|
".L." + Twine(CurrentFnSym->getName()));
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=g5 | FileCheck %s
|
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=g5 | FileCheck %s
|
||||||
|
|
||||||
; CHECK: test1:
|
; CHECK: test1:
|
||||||
; CHECK-NEXT: .quad .L.test1,.TOC.@tocbase
|
; CHECK-NEXT: .align 3
|
||||||
; CHECK-NEXT: .previous
|
; CHECK-NEXT: .quad .L.test1
|
||||||
|
; CHECK-NEXT: .quad .TOC.@tocbase
|
||||||
|
; CHECK-NEXT: .text
|
||||||
; CHECK-NEXT: .L.test1:
|
; CHECK-NEXT: .L.test1:
|
||||||
|
|
||||||
define i32 @test1(i32 %a) nounwind {
|
define i32 @test1(i32 %a) nounwind {
|
||||||
|
Loading…
Reference in New Issue
Block a user