Skip to content

Commit df2cfac

Browse files
committed
Move what's left of metadata::cwriter into middle::trans
1 parent 45efb1f commit df2cfac

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

src/comp/back/link.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import driver::session;
33
import lib::llvm::llvm;
44
import middle::trans;
55
import middle::ty;
6-
import metadata::cwriter;
76
import std::str;
87
import std::fs;
98
import std::vec;

src/comp/metadata/cwriter.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ fn C_postr(&str s) -> ValueRef {
1515
ret llvm::LLVMConstString(str::buf(s), str::byte_len(s), False);
1616
}
1717

18-
fn write_metadata(&@trans::crate_ctxt cx, &@crate crate) {
19-
if (!cx.sess.get_opts().shared) { ret; }
20-
auto llmeta = C_postr(encoder::encode_metadata(cx, crate));
21-
auto llconst = trans::C_struct([llmeta]);
22-
auto llglobal =
23-
llvm::LLVMAddGlobal(cx.llmod, trans::val_ty(llconst),
24-
str::buf("rust_metadata"));
25-
llvm::LLVMSetInitializer(llglobal, llconst);
26-
llvm::LLVMSetSection(llglobal, str::buf(x86::get_meta_sect_name()));
27-
}
2818

2919
//
3020
// Local Variables:

src/comp/middle/trans.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import link::crate_meta_vers;
6767
import link::crate_meta_extras_hash;
6868
import metadata::tyencode;
6969
import metadata::creader;
70-
import metadata::cwriter;
7170
import metadata::decoder;
7271
import pretty::ppaux::ty_to_str;
7372
import pretty::ppaux::ty_to_short_str;
@@ -1041,6 +1040,11 @@ fn C_str(&@crate_ctxt cx, &str s) -> ValueRef {
10411040
ret llvm::LLVMConstPointerCast(g, T_ptr(T_str()));
10421041
}
10431042

1043+
// Returns a Plain Old LLVM String:
1044+
fn C_postr(&str s) -> ValueRef {
1045+
ret llvm::LLVMConstString(str::buf(s), str::byte_len(s), False);
1046+
}
1047+
10441048
fn C_zero_byte_arr(uint size) -> ValueRef {
10451049
auto i = 0u;
10461050
let vec[ValueRef] elts = [];
@@ -8386,6 +8390,17 @@ fn create_crate_map(&@crate_ctxt ccx) -> ValueRef {
83868390
ret map;
83878391
}
83888392

8393+
fn write_metadata(&@trans::crate_ctxt cx, &@ast::crate crate) {
8394+
if (!cx.sess.get_opts().shared) { ret; }
8395+
auto llmeta = C_postr(metadata::encoder::encode_metadata(cx, crate));
8396+
auto llconst = trans::C_struct([llmeta]);
8397+
auto llglobal =
8398+
llvm::LLVMAddGlobal(cx.llmod, trans::val_ty(llconst),
8399+
str::buf("rust_metadata"));
8400+
llvm::LLVMSetInitializer(llglobal, llconst);
8401+
llvm::LLVMSetSection(llglobal, str::buf(x86::get_meta_sect_name()));
8402+
}
8403+
83898404
fn trans_crate(&session::session sess, &@ast::crate crate, &ty::ctxt tcx,
83908405
&str output, &ast_map::map amap) -> ModuleRef {
83918406
auto llmod =
@@ -8452,7 +8467,7 @@ fn trans_crate(&session::session sess, &@ast::crate crate, &ty::ctxt tcx,
84528467
emit_tydescs(ccx);
84538468
// Translate the metadata:
84548469

8455-
cwriter::write_metadata(cx.ccx, crate);
8470+
write_metadata(cx.ccx, crate);
84568471
if (ccx.sess.get_opts().stats) {
84578472
log_err "--- trans stats ---";
84588473
log_err #fmt("n_static_tydescs: %u", ccx.stats.n_static_tydescs);

src/comp/middle/ty.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import front::ast::constr_arg_general;
1818
import front::ast::mutability;
1919
import front::ast::controlflow;
2020
import metadata::creader;
21-
import metadata::cwriter;
2221
import metadata::decoder;
2322
import util::common::*;
2423
import util::data::interner;

src/comp/rustc.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ mod metadata {
6969
mod encoder;
7070
mod decoder;
7171
mod creader;
72-
mod cwriter;
7372
}
7473

7574
mod driver {

0 commit comments

Comments
 (0)