about summary refs log tree commit diff
path: root/src/rustllvm/RustGCStrategy.cpp
blob: 4949760072557d98e2459dcf2c3a75e6fe7e801e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//===- RustGCStrategy.cpp - Rust garbage collection strategy ----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the garbage collection strategy for Rust.
//
//===----------------------------------------------------------------------===//

#include "llvm/CodeGen/GCs.h"
#include "llvm/CodeGen/GCStrategy.h"

using namespace llvm;

class RustGCStrategy : public GCStrategy {
public:
  RustGCStrategy() {
    NeededSafePoints = 1 << GC::PostCall;
    UsesMetadata = true;
    InitRoots = false;  // LLVM crashes with this on due to bitcasts.
  }
};

static GCRegistry::Add<RustGCStrategy>
RustGCStrategyRegistration("rust", "Rust GC");