OcamlGC.cpp revision 5a29c9eed157af51a8d338b5a225b146881819e8
176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman//===-- OcamlCollector.cpp - Ocaml frametable emitter ---------------------===// 276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// 376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// The LLVM Compiler Infrastructure 476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// 576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// This file is distributed under the University of Illinois Open Source 676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// License. See LICENSE.TXT for details. 776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// 876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman//===----------------------------------------------------------------------===// 976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// 1076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// This file implements lowering for the llvm.gc* intrinsics compatible with 1176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// Objective Caml 3.10.0, which uses a liveness-accurate static stack map. 1276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman// 1376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman//===----------------------------------------------------------------------===// 1476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 1576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "llvm/CodeGen/GCs.h" 1676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "llvm/CodeGen/AsmPrinter.h" 1776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "llvm/CodeGen/GCStrategy.h" 1876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "llvm/Module.h" 1976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "llvm/Target/TargetAsmInfo.h" 2076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "llvm/Target/TargetData.h" 2176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "llvm/Target/TargetMachine.h" 2276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 2376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanusing namespace llvm; 2476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 2576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermannamespace { 2676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 2776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman class VISIBILITY_HIDDEN OcamlCollector : public Collector { 2876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman public: 2976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman OcamlCollector(); 3076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman }; 3176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 32d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman} 33d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath 34d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstatic CollectorRegistry::Add<OcamlCollector> 356afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrathX("ocaml", "ocaml 3.10-compatible collector"); 366afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath 376afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath// ----------------------------------------------------------------------------- 386afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath 396afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrathCollector *llvm::createOcamlCollector() { 406afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath return new OcamlCollector(); 416afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath} 4276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 43a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. LevinOcamlCollector::OcamlCollector() { 4476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman NeededSafePoints = 1 << GC::PostCall; 45a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin UsesMetadata = true; 46a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin} 4776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman