Skip to content

Commit e8d170b

Browse files
committed
rt: Stub Rust GC metadata printer and Rust GC strategy modules
1 parent 0a22f91 commit e8d170b

File tree

3 files changed

+81
-1
lines changed

3 files changed

+81
-1
lines changed

mk/rustllvm.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# rustc LLVM-extensions (C++) library variables and rules
33
######################################################################
44

5-
RUSTLLVM_OBJS_CS := $(addprefix rustllvm/, RustWrapper.cpp)
5+
RUSTLLVM_OBJS_CS := $(addprefix rustllvm/, RustGCMetadataPrinter.cpp \
6+
RustGCStrategy.cpp RustWrapper.cpp)
67

78
RUSTLLVM_DEF := rustllvm/rustllvm$(CFG_DEF_SUFFIX)
89

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//===-- RustGCPrinter.cpp - Rust garbage collection map printer -----------===//
2+
//
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 defines the emitter for the Rust garbage collection stack maps.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
#include "llvm/CodeGen/GCs.h"
15+
#include "llvm/CodeGen/AsmPrinter.h"
16+
#include "llvm/CodeGen/GCMetadataPrinter.h"
17+
#include "llvm/Module.h"
18+
#include "llvm/MC/MCAsmInfo.h"
19+
#include "llvm/MC/MCContext.h"
20+
#include "llvm/MC/MCSymbol.h"
21+
#include "llvm/MC/MCStreamer.h"
22+
#include "llvm/Target/Mangler.h"
23+
#include "llvm/Target/TargetData.h"
24+
#include "llvm/Target/TargetLoweringObjectFile.h"
25+
#include "llvm/Target/TargetMachine.h"
26+
#include "llvm/ADT/SmallString.h"
27+
#include "llvm/Support/ErrorHandling.h"
28+
#include "llvm/Support/FormattedStream.h"
29+
#include <cctype>
30+
31+
using namespace llvm;
32+
33+
namespace {
34+
35+
class RustGCMetadataPrinter : public GCMetadataPrinter {
36+
public:
37+
void beginAssembly(AsmPrinter &AP) {};
38+
void finishAssembly(AsmPrinter &AP) {};
39+
};
40+
41+
}
42+
43+
static GCMetadataPrinterRegistry::Add<RustGCMetadataPrinter>
44+
Y("rust", "Rust GC metadata printer");
45+

src/rustllvm/RustGCStrategy.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//===- RustGCStrategy.cpp - Rust garbage collection strategy ----*- C++ -*-===//
2+
//
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 defines the garbage collection strategy for Rust.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
#include "llvm/CodeGen/GCs.h"
15+
#include "llvm/CodeGen/GCStrategy.h"
16+
17+
using namespace llvm;
18+
19+
namespace {
20+
class RustGCStrategy : public GCStrategy {
21+
public:
22+
RustGCStrategy();
23+
};
24+
}
25+
26+
static GCRegistry::Add<RustGCStrategy>
27+
X("rust", "Rust GC");
28+
29+
RustGCStrategy::RustGCStrategy() {
30+
NeededSafePoints = 1 << GC::PostCall;
31+
UsesMetadata = true;
32+
}
33+
34+

0 commit comments

Comments
 (0)