blob: 48db200c513cd2a54d6767d017848e97d5e03897 [file] [log] [blame]
Gordon Henriksen1aed5992008-08-17 18:44:35 +00001//===-- OcamlGC.cpp - Ocaml frametable GC strategy ------------------------===//
Gordon Henriksenf194af22008-08-17 12:56:54 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements lowering for the llvm.gc* intrinsics compatible with
11// Objective Caml 3.10.0, which uses a liveness-accurate static stack map.
Mikhail Glushenkov26e9aed2009-01-16 06:53:46 +000012//
Gordon Henriksen1aed5992008-08-17 18:44:35 +000013// The frametable emitter is in OcamlGCPrinter.cpp.
Gordon Henriksenf194af22008-08-17 12:56:54 +000014//
15//===----------------------------------------------------------------------===//
Mikhail Glushenkov26e9aed2009-01-16 06:53:46 +000016
Gordon Henriksenf194af22008-08-17 12:56:54 +000017#include "llvm/CodeGen/GCs.h"
Gordon Henriksenf194af22008-08-17 12:56:54 +000018#include "llvm/CodeGen/GCStrategy.h"
Gordon Henriksenf194af22008-08-17 12:56:54 +000019
20using namespace llvm;
21
22namespace {
Nick Lewycky492d06e2009-10-25 06:33:48 +000023 class OcamlGC : public GCStrategy {
Gordon Henriksenf194af22008-08-17 12:56:54 +000024 public:
Gordon Henriksen1aed5992008-08-17 18:44:35 +000025 OcamlGC();
Gordon Henriksenf194af22008-08-17 12:56:54 +000026 };
Gordon Henriksenf194af22008-08-17 12:56:54 +000027}
28
Gordon Henriksen1aed5992008-08-17 18:44:35 +000029static GCRegistry::Add<OcamlGC>
30X("ocaml", "ocaml 3.10-compatible GC");
Gordon Henriksenf194af22008-08-17 12:56:54 +000031
Gordon Henriksen1aed5992008-08-17 18:44:35 +000032void llvm::linkOcamlGC() { }
Gordon Henriksenf194af22008-08-17 12:56:54 +000033
Gordon Henriksen1aed5992008-08-17 18:44:35 +000034OcamlGC::OcamlGC() {
Gordon Henriksenf194af22008-08-17 12:56:54 +000035 NeededSafePoints = 1 << GC::PostCall;
36 UsesMetadata = true;
37}