[LLVMdev] Debug info for conditionally defined variables?
Domagoj Babic
babic.domagoj at gmail.com
Wed Aug 1 20:27:25 PDT 2007
Hi,
I have this piece of code:
tm = local ? localtime(&curr) : gmtime(&curr);
if (!tm) return NULL;
which translates into something like:
----------------------------------------------
entry:
%iftmp.0 = alloca %struct.tm*, align 8
%tm = alloca %struct.tm*, align 8
...
// Declares iftmp.0 as iftmp.0
call void @llvm.dbg.declare( { }* %iftmp.0, { }* bitcast
(%llvm.dbg.variable.type* @llvm.dbg.variable792014 to { }*) )
// Declares tm as tm
call void @llvm.dbg.declare( { }* %tm8, { }* bitcast
(%llvm.dbg.variable.type* @llvm.dbg.variable91 to { }*) )
...
cond_true:
%tmp15 = call %struct.tm* @localtime( i64* %curr )
br label %cond_next
cond_false:
%tmp16 = call %struct.tm* @gmtime( i64* %curr )
br label %cond_next
cond_next:
%storemerge = phi %struct.tm* [ %tmp15, %cond_true ], [ %tmp16,
%cond_false ]
store %struct.tm* %storemerge, %struct.tm** %iftmp.0
%tmp17 = load %struct.tm** %iftmp.0
store %struct.tm* %tmp17, %struct.tm** %tm
...
----------------------------------------------
Now, I need to figure out somehow that tmp15 and tmp16 are actually
tm variable, but the generated code introduces another (redundant)
level of indirection, which makes debug info recovery complicated.
Is there any simple way to either eliminate that level of redundancy
[so that iftmp.0 is never generated and that tm is used instead], or
to recover the debug info [without symbolic execution]?
I'm using slightly older version of llvm-gcc 4, but I compared it to the
newest SVN version today, and it doesn't seem that DeclareEmit has
been changed significantly.
Thx,
--
Domagoj Babic
http://www.domagoj.info/
http://www.calysto.org/
More information about the llvm-dev
mailing list