mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-16 08:08:01 +00: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/MCStreamer.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/MC/MCSectionELF.h"
|
||||
#include "llvm/Target/Mangler.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetInstrInfo.h"
|
||||
@ -49,6 +50,7 @@
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "InstPrinter/PPCInstPrinter.h"
|
||||
@ -391,13 +393,21 @@ void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
|
||||
return AsmPrinter::EmitFunctionEntryLabel();
|
||||
|
||||
// Emit an official procedure descriptor.
|
||||
// FIXME 64-bit SVR4: Use MCSection here!
|
||||
OutStreamer.EmitRawText(StringRef("\t.section\t\".opd\",\"aw\""));
|
||||
OutStreamer.EmitRawText(StringRef("\t.align 3"));
|
||||
const MCSection *Current = OutStreamer.getCurrentSection();
|
||||
const MCSectionELF *Section = OutStreamer.getContext().getELFSection(".opd",
|
||||
ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC,
|
||||
SectionKind::getReadOnly());
|
||||
OutStreamer.SwitchSection(Section);
|
||||
OutStreamer.EmitLabel(CurrentFnSym);
|
||||
OutStreamer.EmitRawText("\t.quad .L." + Twine(CurrentFnSym->getName()) +
|
||||
",.TOC.@tocbase");
|
||||
OutStreamer.EmitRawText(StringRef("\t.previous"));
|
||||
OutStreamer.EmitValueToAlignment(8);
|
||||
MCSymbol *Symbol1 =
|
||||
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(
|
||||
".L." + Twine(CurrentFnSym->getName()));
|
||||
|
@ -1,8 +1,10 @@
|
||||
; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=g5 | FileCheck %s
|
||||
|
||||
; CHECK: test1:
|
||||
; CHECK-NEXT: .quad .L.test1,.TOC.@tocbase
|
||||
; CHECK-NEXT: .previous
|
||||
; CHECK-NEXT: .align 3
|
||||
; CHECK-NEXT: .quad .L.test1
|
||||
; CHECK-NEXT: .quad .TOC.@tocbase
|
||||
; CHECK-NEXT: .text
|
||||
; CHECK-NEXT: .L.test1:
|
||||
|
||||
define i32 @test1(i32 %a) nounwind {
|
||||
|
Loading…
Reference in New Issue
Block a user