Skip to content

Commit 7d957bd

Browse files
committed
---
yaml --- r: 2379 b: refs/heads/master c: 5fb6e63 h: refs/heads/master i: 2377: 7f878c5 2375: 72095a1 v: v3
1 parent 4aacf65 commit 7d957bd

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
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: 6b742aec91f1c2615ab8e01ba027dfff3008a7f7
2+
refs/heads/master: 5fb6e6364b6b10e98430140554e644697f29eb06

trunk/src/comp/back/Link.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ tag output_type {
1616
output_type_object;
1717
}
1818

19+
fn link_intrinsics(session.session sess, ModuleRef llmod) {
20+
// TODO
21+
}
22+
1923
mod Write {
2024
fn is_object_or_assembly(output_type ot) -> bool {
2125
if (ot == output_type_assembly) {
@@ -41,6 +45,8 @@ mod Write {
4145
}
4246

4347
fn run_passes(session.session sess, ModuleRef llmod, str output) {
48+
link_intrinsics(sess, llmod);
49+
4450
auto pm = mk_pass_manager();
4551
auto opts = sess.get_opts();
4652

trunk/src/comp/lib/llvm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,9 @@ native mod llvm = llvm_lib {
848848
call. */
849849
fn LLVMRustGetLastError() -> sbuf;
850850

851+
/** Parses the bitcode in the given memory buffer. */
852+
fn LLVMRustParseBitcode(MemoryBufferRef MemBuf) -> ModuleRef;
853+
851854
/** Links LLVM modules together. `Src` is destroyed by this call and
852855
must never be referenced again. */
853856
fn LLVMLinkModules(ModuleRef Dest, ModuleRef Src) -> Bool;

trunk/src/rustllvm/RustWrapper.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/Target/TargetRegistry.h"
2222
#include "llvm/Target/TargetOptions.h"
2323
#include "llvm-c/Core.h"
24+
#include "llvm-c/BitReader.h"
2425
#include "llvm-c/Object.h"
2526
#include <cstdlib>
2627

@@ -98,3 +99,10 @@ extern "C" void LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
9899
(void)foo;
99100
PM->run(*unwrap(M));
100101
}
102+
103+
extern "C" LLVMModuleRef LLVMRustParseBitcode(LLVMMemoryBufferRef MemBuf) {
104+
LLVMModuleRef M;
105+
return LLVMParseBitcode(MemBuf, &M, const_cast<char **>(&LLVMRustError))
106+
? NULL : M;
107+
}
108+

trunk/src/rustllvm/rustllvm.def.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
LLVMRustCreateMemoryBufferWithContentsOfFile
22
LLVMRustWriteOutputFile
33
LLVMRustGetLastError
4+
LLVMRustParseBitcode
45
LLVMLinkModules
56
LLVMCreateObjectFile
67
LLVMDisposeObjectFile

0 commit comments

Comments
 (0)