Displaying 2 results from an estimated 2 matches for "litb_malloc".
Did you mean:
libmalloc
2011 Apr 06
0
[LLVMdev] Target independency using "opaque"? How to do it else?
...in place of
> "size_t". When loading the IR module, I would refine the "opaque" to either
> i64 or i32, depending on which target I'm using.
you can inject a declaration for your own malloc function that always takes a
64 bit argument into the bitcode:
declare i8 *@litb_malloc(i64)
When you know how big a pointer is on the target you can provide an appropriate
body. For example on a 32 bit machine you could inject:
define i8 *@litb_malloc(i64 %s) {
%t = trunc i64 %s to i32
%m = call i8 *@malloc(i32 %t)
ret i8 *%m
}
Ciao, Duncan.
2011 Apr 06
2
[LLVMdev] Target independency using "opaque"? How to do it else?
Hello all,
I'm writing a backend for our scriptlanguage compiler and I'm currently
writing an IR module for the runtime library that contains some support
routines called by generated code.
The IR module contains calls to "malloc", which depend on the size of
"size_t". Since I don't know the target when writing the IR module for the
runtime library, I