From 4e53e6e19874a150beb0e1ab757a840c9f5ba334 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 17 Nov 2010 05:41:32 +0000 Subject: [PATCH] tidy up llvm-svn: 119462 --- lib/Target/ARM/ARMAsmBackend.cpp | 13 +++++-------- lib/Target/ARM/ARMTargetMachine.cpp | 29 +++++++++++------------------ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/lib/Target/ARM/ARMAsmBackend.cpp b/lib/Target/ARM/ARMAsmBackend.cpp index 86b1e069a7c..75a5511e6cc 100644 --- a/lib/Target/ARM/ARMAsmBackend.cpp +++ b/lib/Target/ARM/ARMAsmBackend.cpp @@ -22,15 +22,12 @@ #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetRegistry.h" -#include "llvm/Target/TargetAsmBackend.h" using namespace llvm; namespace { class ARMAsmBackend : public TargetAsmBackend { public: - ARMAsmBackend(const Target &T) - : TargetAsmBackend(T) { - } + ARMAsmBackend(const Target &T) : TargetAsmBackend(T) {} bool MayNeedRelaxation(const MCInst &Inst) const; @@ -42,6 +39,7 @@ public: return 4; } }; +} // end anonymous namespace bool ARMAsmBackend::MayNeedRelaxation(const MCInst &Inst) const { // FIXME: Thumb targets, different move constant targets.. @@ -64,7 +62,6 @@ bool ARMAsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const { OW->Write8(0); return true; } -} // end anonymous namespace namespace { // FIXME: This should be in a separate file. @@ -105,13 +102,12 @@ void ELFARMAsmBackend::ApplyFixup(const MCFixup &Fixup, MCDataFragment &DF, assert(0 && "ELFARMAsmBackend::ApplyFixup() unimplemented"); } +namespace { // FIXME: This should be in a separate file. class DarwinARMAsmBackend : public ARMAsmBackend { MCMachOObjectFormat Format; - public: - DarwinARMAsmBackend(const Target &T) - : ARMAsmBackend(T) { + DarwinARMAsmBackend(const Target &T) : ARMAsmBackend(T) { HasScatteredSymbols = true; } @@ -140,6 +136,7 @@ public: return false; } }; +} // end anonymous namespace static unsigned getFixupKindNumBytes(unsigned Kind) { switch (Kind) { diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp index 9aa7c1f16ad..1c05ab57970 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp @@ -34,13 +34,12 @@ static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) { // This is duplicated code. Refactor this. static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, MCContext &Ctx, TargetAsmBackend &TAB, - raw_ostream &_OS, - MCCodeEmitter *_Emitter, + raw_ostream &OS, + MCCodeEmitter *Emitter, bool RelaxAll) { - Triple TheTriple(TT); - switch (TheTriple.getOS()) { + switch (Triple(TT).getOS()) { case Triple::Darwin: - return createMachOStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); + return createMachOStreamer(Ctx, TAB, OS, Emitter, RelaxAll); case Triple::MinGW32: case Triple::MinGW64: case Triple::Cygwin: @@ -48,7 +47,7 @@ static MCStreamer *createMCStreamer(const Target &T, const std::string &TT, llvm_unreachable("ARM does not support Windows COFF format"); return NULL; default: - return createELFStreamer(Ctx, TAB, _OS, _Emitter, RelaxAll); + return createELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll); } } @@ -62,22 +61,16 @@ extern "C" void LLVMInitializeARMTarget() { RegisterAsmInfoFn B(TheThumbTarget, createMCAsmInfo); // Register the MC Code Emitter - TargetRegistry::RegisterCodeEmitter(TheARMTarget, - createARMMCCodeEmitter); - TargetRegistry::RegisterCodeEmitter(TheThumbTarget, - createARMMCCodeEmitter); + TargetRegistry::RegisterCodeEmitter(TheARMTarget, createARMMCCodeEmitter); + TargetRegistry::RegisterCodeEmitter(TheThumbTarget, createARMMCCodeEmitter); // Register the asm backend. - TargetRegistry::RegisterAsmBackend(TheARMTarget, - createARMAsmBackend); - TargetRegistry::RegisterAsmBackend(TheThumbTarget, - createARMAsmBackend); + TargetRegistry::RegisterAsmBackend(TheARMTarget, createARMAsmBackend); + TargetRegistry::RegisterAsmBackend(TheThumbTarget, createARMAsmBackend); // Register the object streamer. - TargetRegistry::RegisterObjectStreamer(TheARMTarget, - createMCStreamer); - TargetRegistry::RegisterObjectStreamer(TheThumbTarget, - createMCStreamer); + TargetRegistry::RegisterObjectStreamer(TheARMTarget, createMCStreamer); + TargetRegistry::RegisterObjectStreamer(TheThumbTarget, createMCStreamer); }