提交 027368b8 编写于 作者: G Graydon Hoare

Janitorial: move llvmext back to llvm module, as they're the same thing now.

上级 fb08ef44
......@@ -4,7 +4,6 @@
import front.ast;
import lib.llvm.False;
import lib.llvm.llvm;
import lib.llvm.llvmext;
import lib.llvm.mk_object_file;
import lib.llvm.mk_section_iter;
import middle.fold;
......@@ -331,23 +330,23 @@ fn load_crate(session.session sess,
for (str library_search_path in library_search_paths) {
auto path = fs.connect(library_search_path, filename);
auto pbuf = _str.buf(path);
auto mb = llvmext.LLVMRustCreateMemoryBufferWithContentsOfFile(pbuf);
auto mb = llvm.LLVMRustCreateMemoryBufferWithContentsOfFile(pbuf);
if (mb as int != 0) {
auto of = mk_object_file(mb);
auto si = mk_section_iter(of.llof);
while (llvmext.LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) ==
while (llvm.LLVMIsSectionIteratorAtEnd(of.llof, si.llsi) ==
False) {
auto name_buf = llvmext.LLVMGetSectionName(si.llsi);
auto name_buf = llvm.LLVMGetSectionName(si.llsi);
auto name = _str.str_from_cstr(name_buf);
if (_str.eq(name, x86.get_meta_sect_name())) {
auto cbuf = llvmext.LLVMGetSectionContents(si.llsi);
auto csz = llvmext.LLVMGetSectionSize(si.llsi);
auto cbuf = llvm.LLVMGetSectionContents(si.llsi);
auto csz = llvm.LLVMGetSectionSize(si.llsi);
auto cvbuf = cbuf as _vec.vbuf;
auto cvec = _vec.vec_from_vbuf[u8](cvbuf, csz);
sess.set_external_crate(cnum, cvec);
ret;
}
llvmext.LLVMMoveToNextSection(si.llsi);
llvm.LLVMMoveToNextSection(si.llsi);
}
}
}
......
......@@ -22,8 +22,8 @@
import llvm.IntPredicate;
import llvm.RealPredicate;
import llvm.Opcode;
import llvmext.ObjectFileRef;
import llvmext.SectionIteratorRef;
import llvm.ObjectFileRef;
import llvm.SectionIteratorRef;
type ULongLong = u64;
type LongLong = i64;
......@@ -740,9 +740,10 @@ fn LLVMBuildPtrDiff(BuilderRef B, ValueRef LHS,
/** Destroys a memory buffer. */
fn LLVMDisposeMemoryBuffer(MemoryBufferRef MemBuf);
}
native mod llvmext = llvm_lib {
/* Stuff that's in rustllvm/ because it's not upstream yet. */
type ObjectFileRef;
type SectionIteratorRef;
......@@ -777,6 +778,11 @@ fn LLVMRustCreateMemoryBufferWithContentsOfFile(sbuf Path) ->
/** Returns a string describing the last error caused by an LLVMRust*
call. */
fn LLVMRustGetLastError() -> sbuf;
}
native mod rustllvm = llvm_lib {
}
/* Slightly more terse object-interface to LLVM's 'builder' functions. */
......@@ -1384,26 +1390,26 @@ fn mk_pass_manager() -> pass_manager {
/* Memory-managed interface to object files. */
obj object_file_dtor(ObjectFileRef ObjectFile) {
drop { llvmext.LLVMDisposeObjectFile(ObjectFile); }
drop { llvm.LLVMDisposeObjectFile(ObjectFile); }
}
type object_file = rec(ObjectFileRef llof, object_file_dtor dtor);
fn mk_object_file(MemoryBufferRef llmb) -> object_file {
auto llof = llvmext.LLVMCreateObjectFile(llmb);
auto llof = llvm.LLVMCreateObjectFile(llmb);
ret rec(llof=llof, dtor=object_file_dtor(llof));
}
/* Memory-managed interface to section iterators. */
obj section_iter_dtor(SectionIteratorRef SI) {
drop { llvmext.LLVMDisposeSectionIterator(SI); }
drop { llvm.LLVMDisposeSectionIterator(SI); }
}
type section_iter = rec(SectionIteratorRef llsi, section_iter_dtor dtor);
fn mk_section_iter(ObjectFileRef llof) -> section_iter {
auto llsi = llvmext.LLVMGetSections(llof);
auto llsi = llvm.LLVMGetSections(llof);
ret rec(llsi=llsi, dtor=section_iter_dtor(llsi));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册