mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
emit LLVM IR that can be compiled to wasm
This commit is contained in:
parent
5a7a9e9520
commit
0a7f7a2772
9 changed files with 33 additions and 25 deletions
|
@ -370,10 +370,18 @@ impl<'a, 'ctx, 'env> Env<'a, 'ctx, 'env> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn module_from_builtins<'ctx>(ctx: &'ctx Context, module_name: &str) -> Module<'ctx> {
|
||||
pub fn module_from_builtins<'ctx>(
|
||||
ctx: &'ctx Context,
|
||||
module_name: &str,
|
||||
ptr_bytes: u32,
|
||||
) -> Module<'ctx> {
|
||||
// In the build script for the builtins module,
|
||||
// we compile the builtins into LLVM bitcode
|
||||
let bitcode_bytes: &[u8] = include_bytes!("../../../builtins/bitcode/builtins.bc");
|
||||
let bitcode_bytes: &[u8] = match ptr_bytes {
|
||||
8 => include_bytes!("../../../builtins/bitcode/builtins-64bit.bc"),
|
||||
4 => include_bytes!("../../../builtins/bitcode/builtins-32bit.bc"),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
let memory_buffer = MemoryBuffer::create_from_memory_range(bitcode_bytes, module_name);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue