2011-10-21 17:35:52 -07:00
|
|
|
//===- RustGCStrategy.cpp - Rust garbage collection strategy ----*- C++ -*-===
|
2011-08-11 21:14:08 -07:00
|
|
|
//
|
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
|
//
|
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
|
//
|
2011-10-21 17:35:52 -07:00
|
|
|
//===----------------------------------------------------------------------===
|
2011-08-11 21:14:08 -07:00
|
|
|
//
|
|
|
|
|
// This file defines the garbage collection strategy for Rust.
|
|
|
|
|
//
|
2011-10-21 17:35:52 -07:00
|
|
|
//===----------------------------------------------------------------------===
|
2011-08-11 21:14:08 -07:00
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/GCs.h"
|
|
|
|
|
#include "llvm/CodeGen/GCStrategy.h"
|
|
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
2011-08-17 19:11:01 -07:00
|
|
|
class RustGCStrategy : public GCStrategy {
|
|
|
|
|
public:
|
|
|
|
|
RustGCStrategy() {
|
|
|
|
|
NeededSafePoints = 1 << GC::PostCall;
|
|
|
|
|
UsesMetadata = true;
|
|
|
|
|
InitRoots = false; // LLVM crashes with this on due to bitcasts.
|
|
|
|
|
}
|
|
|
|
|
};
|
2011-08-11 21:14:08 -07:00
|
|
|
|
|
|
|
|
static GCRegistry::Add<RustGCStrategy>
|
2011-08-17 19:11:01 -07:00
|
|
|
RustGCStrategyRegistration("rust", "Rust GC");
|
2011-08-11 21:14:08 -07:00
|
|
|
|
|
|
|
|
|