diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-08-17 12:08:44 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-08-17 12:08:44 +0000 |
commit | c317a60c2714a5b90700a11ba646285cb754a5d3 (patch) | |
tree | 776b86519f67f3161e148249ea1118c0cc85260f /lib/CodeGen/OcamlCollector.cpp | |
parent | b68dc369e06f8d1666562a70bab6bc3f7d642989 (diff) |
Factor GC metadata table assembly generation out of Collector in preparation for splitting AsmPrinter into its own library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54880 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/OcamlCollector.cpp')
-rw-r--r-- | lib/CodeGen/OcamlCollector.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/CodeGen/OcamlCollector.cpp b/lib/CodeGen/OcamlCollector.cpp index 9823d24986..7f58f58c29 100644 --- a/lib/CodeGen/OcamlCollector.cpp +++ b/lib/CodeGen/OcamlCollector.cpp @@ -27,7 +27,10 @@ namespace { class VISIBILITY_HIDDEN OcamlCollector : public Collector { public: OcamlCollector(); - + }; + + class VISIBILITY_HIDDEN OcamlGCMetadataPrinter : public GCMetadataPrinter { + public: void beginAssembly(std::ostream &OS, AsmPrinter &AP, const TargetAsmInfo &TAI); @@ -40,6 +43,9 @@ namespace { static CollectorRegistry::Add<OcamlCollector> X("ocaml", "ocaml 3.10-compatible collector"); +static GCMetadataPrinterRegistry::Add<OcamlGCMetadataPrinter> +Y("ocaml", "ocaml 3.10-compatible collector"); + // ----------------------------------------------------------------------------- static void EmitCamlGlobal(const Module &M, std::ostream &OS, AsmPrinter &AP, @@ -68,10 +74,11 @@ Collector *llvm::createOcamlCollector() { OcamlCollector::OcamlCollector() { NeededSafePoints = 1 << GC::PostCall; + UsesMetadata = true; } -void OcamlCollector::beginAssembly(std::ostream &OS, AsmPrinter &AP, - const TargetAsmInfo &TAI) { +void OcamlGCMetadataPrinter::beginAssembly(std::ostream &OS, AsmPrinter &AP, + const TargetAsmInfo &TAI) { AP.SwitchToTextSection(TAI.getTextSection()); EmitCamlGlobal(getModule(), OS, AP, TAI, "code_begin"); @@ -95,8 +102,8 @@ void OcamlCollector::beginAssembly(std::ostream &OS, AsmPrinter &AP, /// (FrameSize and LiveOffsets would overflow). FrameTablePrinter will abort if /// either condition is detected in a function which uses the collector. /// -void OcamlCollector::finishAssembly(std::ostream &OS, AsmPrinter &AP, - const TargetAsmInfo &TAI) { +void OcamlGCMetadataPrinter::finishAssembly(std::ostream &OS, AsmPrinter &AP, + const TargetAsmInfo &TAI) { const char *AddressDirective; int AddressAlignLog; if (AP.TM.getTargetData()->getPointerSize() == sizeof(int32_t)) { |