mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:50:30 +00:00
Add emitThumbSet to the arm target streamer.
This fixes the asm printer implementation and lets the parser be unaware of what .thumb_set is. llvm-svn: 207381
This commit is contained in:
parent
a34f8a713a
commit
4e775074d3
@ -121,6 +121,8 @@ public:
|
||||
|
||||
virtual void AnnotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE);
|
||||
|
||||
virtual void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value);
|
||||
|
||||
void finish() override;
|
||||
|
||||
/// Callback used to implement the ldr= pseudo.
|
||||
|
@ -9372,36 +9372,7 @@ bool ARMAsmParser::parseDirectiveThumbSet(SMLoc L) {
|
||||
Lex();
|
||||
|
||||
MCSymbol *Alias = getContext().GetOrCreateSymbol(Name);
|
||||
if (const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(Value)) {
|
||||
MCSymbol *Sym = getContext().LookupSymbol(SRE->getSymbol().getName());
|
||||
if (!Sym->isDefined()) {
|
||||
getStreamer().EmitSymbolAttribute(Sym, MCSA_Global);
|
||||
getStreamer().EmitAssignment(Alias, Value);
|
||||
return false;
|
||||
}
|
||||
|
||||
const MCObjectFileInfo::Environment Format =
|
||||
getContext().getObjectFileInfo()->getObjectFileType();
|
||||
switch (Format) {
|
||||
case MCObjectFileInfo::IsCOFF: {
|
||||
char Type = COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT;
|
||||
getStreamer().EmitCOFFSymbolType(Type);
|
||||
// .set values are always local in COFF
|
||||
getStreamer().EmitSymbolAttribute(Alias, MCSA_Local);
|
||||
break;
|
||||
}
|
||||
case MCObjectFileInfo::IsELF:
|
||||
getStreamer().EmitSymbolAttribute(Alias, MCSA_ELF_TypeFunction);
|
||||
break;
|
||||
case MCObjectFileInfo::IsMachO:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: set the function as being a thumb function via the assembler
|
||||
getStreamer().EmitThumbFunc(Alias);
|
||||
getStreamer().EmitAssignment(Alias, Value);
|
||||
|
||||
getTargetStreamer().emitThumbSet(Alias, Value);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,7 @@ class ARMTargetAsmStreamer : public ARMTargetStreamer {
|
||||
void finishAttributeSection() override;
|
||||
|
||||
void AnnotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE) override;
|
||||
void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) override;
|
||||
|
||||
public:
|
||||
ARMTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS,
|
||||
@ -261,6 +262,10 @@ ARMTargetAsmStreamer::AnnotateTLSDescriptorSequence(const MCSymbolRefExpr *S) {
|
||||
OS << "\t.tlsdescseq\t" << S->getSymbol().getName();
|
||||
}
|
||||
|
||||
void ARMTargetAsmStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) {
|
||||
OS << "\t.thumb_set\t" << *Symbol << ", " << *Value << '\n';
|
||||
}
|
||||
|
||||
void ARMTargetAsmStreamer::emitInst(uint32_t Inst, char Suffix) {
|
||||
OS << "\t.inst";
|
||||
if (Suffix)
|
||||
@ -410,6 +415,7 @@ private:
|
||||
void emitLabel(MCSymbol *Symbol) override;
|
||||
|
||||
void AnnotateTLSDescriptorSequence(const MCSymbolRefExpr *SRE) override;
|
||||
void emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) override;
|
||||
|
||||
size_t calculateContentSize() const;
|
||||
|
||||
@ -998,6 +1004,23 @@ void
|
||||
ARMTargetELFStreamer::AnnotateTLSDescriptorSequence(const MCSymbolRefExpr *S) {
|
||||
getStreamer().EmitFixup(S, FK_Data_4);
|
||||
}
|
||||
|
||||
void ARMTargetELFStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) {
|
||||
if (const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(Value)) {
|
||||
// FIXME: Doing a lookup in here is a hack.
|
||||
MCSymbol *Sym =
|
||||
getStreamer().getContext().LookupSymbol(SRE->getSymbol().getName());
|
||||
if (!Sym->isDefined()) {
|
||||
getStreamer().EmitSymbolAttribute(Sym, MCSA_Global);
|
||||
getStreamer().EmitAssignment(Symbol, Value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
getStreamer().EmitThumbFunc(Symbol);
|
||||
getStreamer().EmitAssignment(Symbol, Value);
|
||||
}
|
||||
|
||||
void ARMTargetELFStreamer::emitInst(uint32_t Inst, char Suffix) {
|
||||
getStreamer().emitInst(Inst, Suffix);
|
||||
}
|
||||
|
@ -246,3 +246,7 @@ void ARMTargetStreamer::AnnotateTLSDescriptorSequence(
|
||||
const MCSymbolRefExpr *SRE) {
|
||||
llvm_unreachable("unimplemented");
|
||||
}
|
||||
|
||||
void ARMTargetStreamer::emitThumbSet(MCSymbol *Symbol, const MCExpr *Value) {
|
||||
llvm_unreachable("unimplemented");
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s | llvm-readobj -t \
|
||||
@ RUN: | FileCheck %s
|
||||
|
||||
@ RUN: llvm-mc -triple armv7-eabi -filetype asm -o - %s \
|
||||
@ RUN: | FileCheck --check-prefix=ASM %s
|
||||
|
||||
.syntax unified
|
||||
|
||||
.arm
|
||||
@ -11,6 +14,8 @@ arm_func:
|
||||
|
||||
.thumb_set alias_arm_func, arm_func
|
||||
|
||||
@ ASM: .thumb_set alias_arm_func, arm_func
|
||||
|
||||
.thumb
|
||||
|
||||
.type thumb_func,%function
|
||||
|
Loading…
Reference in New Issue
Block a user