Skip to content

Commit 0fafabc

Browse files
committed
---
yaml --- r: 4577 b: refs/heads/master c: e8d170b h: refs/heads/master i: 4575: 730e6d3 v: v3
1 parent 2c3beeb commit 0fafabc

File tree

4 files changed

+82
-2
lines changed

4 files changed

+82
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 0a22f91c9cf4b2a54f05a5d58a23459c0f6fb590
2+
refs/heads/master: e8d170beae28f99bd7075a6dde4dcb20d6126b68

trunk/mk/rustllvm.mk

Lines changed: 2 additions & 1 deletion
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

Lines changed: 45 additions & 0 deletions
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+

trunk/src/rustllvm/RustGCStrategy.cpp

Lines changed: 34 additions & 0 deletions
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)