rt: Stub Rust GC metadata printer and Rust GC strategy modules

This commit is contained in:
Patrick Walton 2011-08-11 21:14:08 -07:00
parent 0a22f91c9c
commit e8d170beae
3 changed files with 81 additions and 1 deletions

View File

@ -2,7 +2,8 @@
# rustc LLVM-extensions (C++) library variables and rules
######################################################################
RUSTLLVM_OBJS_CS := $(addprefix rustllvm/, RustWrapper.cpp)
RUSTLLVM_OBJS_CS := $(addprefix rustllvm/, RustGCMetadataPrinter.cpp \
RustGCStrategy.cpp RustWrapper.cpp)
RUSTLLVM_DEF := rustllvm/rustllvm$(CFG_DEF_SUFFIX)

View File

@ -0,0 +1,45 @@
//===-- RustGCPrinter.cpp - Rust garbage collection map printer -----------===//
//
// 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 emitter for the Rust garbage collection stack maps.
//
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/GCs.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/Module.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/Mangler.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include <cctype>
using namespace llvm;
namespace {
class RustGCMetadataPrinter : public GCMetadataPrinter {
public:
void beginAssembly(AsmPrinter &AP) {};
void finishAssembly(AsmPrinter &AP) {};
};
}
static GCMetadataPrinterRegistry::Add<RustGCMetadataPrinter>
Y("rust", "Rust GC metadata printer");

View File

@ -0,0 +1,34 @@
//===- 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;
namespace {
class RustGCStrategy : public GCStrategy {
public:
RustGCStrategy();
};
}
static GCRegistry::Add<RustGCStrategy>
X("rust", "Rust GC");
RustGCStrategy::RustGCStrategy() {
NeededSafePoints = 1 << GC::PostCall;
UsesMetadata = true;
}