search for: t_string_m_assign_a_pv

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

2012 Oct 02
2
[LLVMdev] Offset to C++ structure members
...pass as the 'this' argument to T_string_M_assign_Pv(). The LLVM code generated via the IRBuilder is: %0 = call i8* @T_S_M_new(i8* %heap) %1 = ptrtoint i8* %0 to i64 %2 = add i64 %1, 8 ; 8 is what's returned by mbr_offset_of() %3 = inttoptr i64 %2 to i8* call void @T_string_M_assign_A_Pv(i8* %3, i8* getelementptr inbounds ([15 x i8]* @0, i64 0, i64 0)) The code does in fact work. My questions are: * Is this an "OK" thing to do? * Is there a better way? - Paul P.S.: I don't explicitly put the getelementptr instruction in there. That's something the IRBuilder...
2012 Oct 02
0
[LLVMdev] Offset to C++ structure members
...rgument to T_string_M_assign_Pv(). The LLVM code generated via the IRBuilder is: > > %0 = call i8* @T_S_M_new(i8* %heap) > %1 = ptrtoint i8* %0 to i64 > %2 = add i64 %1, 8 ; 8 is what's returned by mbr_offset_of() > %3 = inttoptr i64 %2 to i8* > call void @T_string_M_assign_A_Pv(i8* %3, i8* getelementptr inbounds ([15 x i8]* @0, i64 0, i64 0)) > > The code does in fact work. My questions are: > > * Is this an "OK" thing to do? Doing math on pointers if you know the offsets is perfectly legitimate. clang will generate code like this for certain cast...
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
...t'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. - Paul
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++