mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
This change reverts the interesting parts of 226311 (and 227046). This change introduced two problems, and I've been convinced that an alternate approach is preferrable anyways. The bugs were: - Registery appears to require all users be within the same linkage unit. After this change, asking for "statepoint-example" in Transform/ would sometimes get you nullptr, whereas asking the same question in CodeGen would return the right GCStrategy. The correct long term fix is to get rid of the utter hack which is Registry, but I don't have time for that right now. 227046 appears to have been an attempt to fix this, but I don't believe it does so completely. - GCMetadataPrinter::finishAssembly was being called more than once per GCStrategy. Each Strategy was being added to the GCModuleInfo multiple times. Once I get time again, I'm going to split GCModuleInfo into the gc.root specific part and a GCStrategy owning Analysis pass. I'm probably also going to kill off the Registry. Once that's done, I'll move the new GCStrategyAnalysis and all built in GCStrategies into Analysis. (As original suggested by Chandler.) This will accomplish my original goal of being able to access GCStrategy from Transform/ without adding all of the builtin GCs to IR/. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227109 91177308-0d34-0410-b5e6-96231b3b80d8
65 lines
2.1 KiB
C++
65 lines
2.1 KiB
C++
//===-- llvm/CodeGen/GCMetadataPrinter.h - Prints asm GC tables -*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// The abstract base class GCMetadataPrinter supports writing GC metadata tables
|
|
// as assembly code. This is a separate class from GCStrategy in order to allow
|
|
// users of the LLVM JIT to avoid linking with the AsmWriter.
|
|
//
|
|
// Subclasses of GCMetadataPrinter must be registered using the
|
|
// GCMetadataPrinterRegistry. This is separate from the GCStrategy itself
|
|
// because these subclasses are logically plugins for the AsmWriter.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_CODEGEN_GCMETADATAPRINTER_H
|
|
#define LLVM_CODEGEN_GCMETADATAPRINTER_H
|
|
|
|
#include "llvm/CodeGen/GCMetadata.h"
|
|
#include "llvm/CodeGen/GCStrategy.h"
|
|
#include "llvm/Support/Registry.h"
|
|
|
|
namespace llvm {
|
|
|
|
class GCMetadataPrinter;
|
|
|
|
/// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
|
|
/// defaults from Registry.
|
|
typedef Registry<GCMetadataPrinter> GCMetadataPrinterRegistry;
|
|
|
|
/// GCMetadataPrinter - Emits GC metadata as assembly code. Instances are
|
|
/// created, managed, and owned by the AsmPrinter.
|
|
class GCMetadataPrinter {
|
|
private:
|
|
GCStrategy *S;
|
|
friend class AsmPrinter;
|
|
|
|
protected:
|
|
// May only be subclassed.
|
|
GCMetadataPrinter();
|
|
|
|
private:
|
|
GCMetadataPrinter(const GCMetadataPrinter &) LLVM_DELETED_FUNCTION;
|
|
GCMetadataPrinter &operator=(const GCMetadataPrinter &) LLVM_DELETED_FUNCTION;
|
|
|
|
public:
|
|
GCStrategy &getStrategy() { return *S; }
|
|
|
|
/// Called before the assembly for the module is generated by
|
|
/// the AsmPrinter (but after target specific hooks.)
|
|
virtual void beginAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) {}
|
|
/// Called after the assembly for the module is generated by
|
|
/// the AsmPrinter (but before target specific hooks)
|
|
virtual void finishAssembly(Module &M, GCModuleInfo &Info, AsmPrinter &AP) {}
|
|
|
|
virtual ~GCMetadataPrinter();
|
|
};
|
|
}
|
|
|
|
#endif
|