[llvm] r232658 - Add a default implementation of createObjectStreamer.
Justin Bogner
mail at justinbogner.com
Wed Mar 18 15:23:05 PDT 2015
Rafael Espindola <rafael.espindola at gmail.com> writes:
> Author: rafael
> Date: Wed Mar 18 14:08:20 2015
> New Revision: 232658
>
> URL: http://llvm.org/viewvc/llvm-project?rev=232658&view=rev
> Log:
> Add a default implementation of createObjectStreamer.
>
> This removes duplicated code from backends that don't need to do anything
> fancy.
Some tests seem to failing after this change:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/6469/
> Modified:
> llvm/trunk/include/llvm/Support/TargetRegistry.h
> llvm/trunk/lib/MC/MCObjectStreamer.cpp
> llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
> llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCTargetDesc.cpp
> llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
>
> Modified: llvm/trunk/include/llvm/Support/TargetRegistry.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetRegistry.h?rev=232658&r1=232657&r2=232658&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/TargetRegistry.h (original)
> +++ llvm/trunk/include/llvm/Support/TargetRegistry.h Wed Mar 18 14:08:20 2015
> @@ -58,6 +58,10 @@ namespace llvm {
> bool isVerboseAsm, bool useDwarfDirectory,
> MCInstPrinter *InstPrint, MCCodeEmitter *CE,
> MCAsmBackend *TAB, bool ShowInst);
> + MCStreamer *createObjectStreamer(const Triple &T, MCContext &Ctx,
> + MCAsmBackend &TAB, raw_ostream &OS,
> + MCCodeEmitter *Emitter,
> + const MCSubtargetInfo &STI, bool RelaxAll);
>
> MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx);
>
> @@ -419,7 +423,8 @@ namespace llvm {
> const MCSubtargetInfo &STI,
> bool RelaxAll) const {
> if (!MCObjectStreamerCtorFn)
> - return nullptr;
> + return llvm::createObjectStreamer(T, Ctx, TAB, OS, Emitter, STI,
> + RelaxAll);
> return MCObjectStreamerCtorFn(T, Ctx, TAB, OS, Emitter, STI, RelaxAll);
> }
>
>
> Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=232658&r1=232657&r2=232658&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
> +++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Wed Mar 18 14:08:20 2015
> @@ -20,6 +20,7 @@
> #include "llvm/MC/MCSection.h"
> #include "llvm/MC/MCSymbol.h"
> #include "llvm/Support/ErrorHandling.h"
> +#include "llvm/Support/TargetRegistry.h"
> using namespace llvm;
>
> MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB,
> @@ -422,3 +423,16 @@ void MCObjectStreamer::FinishImpl() {
> flushPendingLabels(nullptr);
> getAssembler().Finish();
> }
> +
> +MCStreamer *llvm::createObjectStreamer(const Triple &T, MCContext &Ctx,
> + MCAsmBackend &TAB, raw_ostream &OS,
> + MCCodeEmitter *Emitter,
> + const MCSubtargetInfo &STI,
> + bool RelaxAll) {
> + switch (T.getObjectFormat()) {
> + default:
> + return nullptr;
> + case Triple::ELF:
> + return createELFStreamer(Ctx, TAB, OS, Emitter, RelaxAll);
> + }
> +}
>
> Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp?rev=232658&r1=232657&r2=232658&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp (original)
> +++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp Wed Mar 18 14:08:20 2015
> @@ -47,15 +47,6 @@ static MCRegisterInfo *createHexagonMCRe
> return X;
> }
>
> -static MCStreamer *
> -createHexagonELFStreamer(MCContext &Context, MCAsmBackend &MAB,
> - raw_ostream &OS, MCCodeEmitter *CE,
> - bool RelaxAll) {
> - MCELFStreamer *ES = new MCELFStreamer(Context, MAB, OS, CE);
> - return ES;
> -}
> -
> -
> static MCSubtargetInfo *
> createHexagonMCSubtargetInfo(StringRef TT, StringRef CPU, StringRef FS) {
> MCSubtargetInfo *X = new MCSubtargetInfo();
> @@ -75,16 +66,6 @@ static MCAsmInfo *createHexagonMCAsmInfo
> return MAI;
> }
>
> -static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
> - MCAsmBackend &MAB, raw_ostream &OS,
> - MCCodeEmitter *Emitter,
> - MCSubtargetInfo const &STI, bool RelaxAll) {
> - MCStreamer *ES = createHexagonELFStreamer(Context, MAB, OS, Emitter, RelaxAll);
> - new MCTargetStreamer(*ES);
> - return ES;
> -}
> -
> -
> static MCCodeGenInfo *createHexagonMCCodeGenInfo(StringRef TT, Reloc::Model RM,
> CodeModel::Model CM,
> CodeGenOpt::Level OL) {
> @@ -135,7 +116,4 @@ extern "C" void LLVMInitializeHexagonTar
> // Register the asm backend
> TargetRegistry::RegisterMCAsmBackend(TheHexagonTarget,
> createHexagonAsmBackend);
> -
> - // Register the obj streamer
> - TargetRegistry::RegisterMCObjectStreamer(TheHexagonTarget, createMCStreamer);
> }
>
> Modified: llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCTargetDesc.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCTargetDesc.cpp?rev=232658&r1=232657&r2=232658&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCTargetDesc.cpp (original)
> +++ llvm/trunk/lib/Target/R600/MCTargetDesc/AMDGPUMCTargetDesc.cpp Wed Mar 18 14:08:20 2015
> @@ -73,13 +73,6 @@ static MCInstPrinter *createAMDGPUMCInst
> return new AMDGPUInstPrinter(MAI, MII, MRI);
> }
>
> -static MCStreamer *createMCStreamer(const Triple &T, MCContext &Ctx,
> - MCAsmBackend &MAB, raw_ostream &OS,
> - MCCodeEmitter *Emitter,
> - const MCSubtargetInfo &STI, bool RelaxAll) {
> - return createELFStreamer(Ctx, MAB, OS, Emitter, false);
> -}
> -
> extern "C" void LLVMInitializeR600TargetMC() {
>
> RegisterMCAsmInfo<AMDGPUMCAsmInfo> Y(TheAMDGPUTarget);
> @@ -105,7 +98,4 @@ extern "C" void LLVMInitializeR600Target
>
> TargetRegistry::RegisterMCAsmBackend(TheAMDGPUTarget, createAMDGPUAsmBackend);
> TargetRegistry::RegisterMCAsmBackend(TheGCNTarget, createAMDGPUAsmBackend);
> -
> - TargetRegistry::RegisterMCObjectStreamer(TheAMDGPUTarget, createMCStreamer);
> - TargetRegistry::RegisterMCObjectStreamer(TheGCNTarget, createMCStreamer);
> }
>
> Modified: llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp?rev=232658&r1=232657&r2=232658&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp (original)
> +++ llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp Wed Mar 18 14:08:20 2015
> @@ -181,12 +181,6 @@ static MCInstPrinter *createSystemZMCIns
> return new SystemZInstPrinter(MAI, MII, MRI);
> }
>
> -static MCStreamer *createSystemZMCObjectStreamer(
> - const Triple &T, MCContext &Ctx, MCAsmBackend &MAB, raw_ostream &OS,
> - MCCodeEmitter *Emitter, const MCSubtargetInfo &STI, bool RelaxAll) {
> - return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
> -}
> -
> extern "C" void LLVMInitializeSystemZTargetMC() {
> // Register the MCAsmInfo.
> TargetRegistry::RegisterMCAsmInfo(TheSystemZTarget,
> @@ -219,8 +213,4 @@ extern "C" void LLVMInitializeSystemZTar
> // Register the MCInstPrinter.
> TargetRegistry::RegisterMCInstPrinter(TheSystemZTarget,
> createSystemZMCInstPrinter);
> -
> - // Register the MCObjectStreamer;
> - TargetRegistry::RegisterMCObjectStreamer(TheSystemZTarget,
> - createSystemZMCObjectStreamer);
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list