search for: t_s_m_new

Displaying 5 results from an estimated 5 matches for "t_s_m_new".

2012 Oct 02
2
[LLVMdev] Offset to C++ structure members
Given the C++ struct: struct S { string a; string b; }; I also have C "thunk" functions that I call from LLVM code: // calls S::S() void* T_S_M_new( void *heap ); // call string::assign(char const*) void T_string_M_assign_Pv( void *that, void *value ); I want to do the LLVM equivalent of the following C++ (where that 's' is pointer to an instance of 'S'): s->b.assign( "Hello, world!" ); // assign to S::b If...
2012 Oct 02
0
[LLVMdev] Offset to C++ structure members
.... Lucas <paul at lucasmail.org> wrote: > Given the C++ struct: > > struct S { > string a; > string b; > }; > > I also have C "thunk" functions that I call from LLVM code: > > // calls S::S() > void* T_S_M_new( void *heap ); > > // call string::assign(char const*) > void T_string_M_assign_Pv( void *that, void *value ); > > I want to do the LLVM equivalent of the following C++ (where that 's' is pointer to an instance of 'S'): > > s->b.assign...
2012 Oct 02
0
[LLVMdev] Offset to C++ structure members
On Tue, Oct 2, 2012 at 11:33 AM, Paul J. Lucas <paul at lucasmail.org> wrote: > On Oct 1, 2012, at 9:58 PM, Eli Friedman <eli.friedman at gmail.com> wrote: > >> Using GEP on an i8* is a bit nicer to the optimizer, though, because >> using ptrtoint/inttoptr has effects on alias analysis. > > My understanding is that, in order to use GEP, you have to provide the
2012 Oct 02
1
[LLVMdev] Offset to C++ structure members
...I don't understand why, however. I print out the offset, and it's the correct value that's getting added to the Pointer. > > No idea what's happening here. The IR code is now: @0 = private unnamed_addr constant [14 x i8] c"Hello, world!\00" ... %0 = call i8* @T_S_M_new(i8* %heap) %1 = getelementptr i8* %0, i64 16 call void @T_string_M_assign_A_Pv(i8* %1, i8* getelementptr inbounds ([14 x i8]* @0, i64 0, i64 0)) where the "16" is the correct offset (it agrees with my pure C++ version of the code), yet it still crashes. It's not obvious why. - P...
2012 Oct 02
2
[LLVMdev] Offset to C++ structure members
On Oct 1, 2012, at 9:58 PM, Eli Friedman <eli.friedman at gmail.com> wrote: > Using GEP on an i8* is a bit nicer to the optimizer, though, because > using ptrtoint/inttoptr has effects on alias analysis. My understanding is that, in order to use GEP, you have to provide the LLVM code with the struct layout, i.e., build a StructType object. In my case, that struct is declared in C++