diff options
| author | Graydon Hoare <[email protected]> | 2011-03-25 18:44:52 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-25 18:45:00 -0700 |
| commit | 027368b885848377a0025ced2734cabf5ff201e1 (patch) | |
| tree | 312d2a76d7a8e02686f5b6a81678ee07b8a869cd | |
| parent | Tweak rustllvm bindings to work on linux, where bool != LLVMBool. (diff) | |
| download | rust-027368b885848377a0025ced2734cabf5ff201e1.tar.xz rust-027368b885848377a0025ced2734cabf5ff201e1.zip | |
Janitorial: move llvmext back to llvm module, as they're the same thing now.
| -rw-r--r-- | src/comp/front/creader.rs | 13 | ||||
| -rw-r--r-- | src/comp/lib/llvm.rs | 22 |
2 files changed, 20 insertions, 15 deletions
diff --git a/src/comp/front/creader.rs b/src/comp/front/creader.rs index 01203226..b19a2972 100644 --- a/src/comp/front/creader.rs +++ b/src/comp/front/creader.rs @@ -4,7 +4,6 @@ import driver.session; 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); } } } diff --git a/src/comp/lib/llvm.rs b/src/comp/lib/llvm.rs index 73881fd9..6c1e5042 100644 --- a/src/comp/lib/llvm.rs +++ b/src/comp/lib/llvm.rs @@ -22,8 +22,8 @@ import llvm.CallConv; 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 @@ native mod llvm = llvm_lib { /** 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 @@ native mod llvmext = llvm_lib { /** 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)); } |