Hi,

I believe the number WN_Get_Linenum() returns is not directly the line num, it 
includes both line number and file number, and you need to extract the linenum 
using the srcpos interface in common/com/srcpos.h. I believe there is a way to 
get the file name from the file number, but this file number will not be useful 
in IPA, because it's based on pre-IPA file structure. There are other ways to 
get it in IPA. Each IPA_NODE has a File_Id(), that will at least tell you if 2 
functions belong to the same or different file. And see 
IPA_Check_Optimization_Options() in ipa_cg.cxx that shows a way to retrieve the 
original filename from the file header (see IP_FILE_HDR_file_name).

Gautam



________________________________
From: Tianwei <tianwei.sh...@gmail.com>
To: open64-devel <open64-devel@lists.sourceforge.net>
Sent: Sat, September 25, 2010 5:53:30 AM
Subject: [Open64-devel] how we can get the filename and line number for a WHIRL 
node?

Hi, all,  
   if I have the following statement, such as:
test.c
. 
LINE:18   *p =2

for the above ISTORE node, how can I get the filename and line number 
information,  for line number, 
in the common/com/wn_core.cxx, there is a function:
/*REFERENCED*/
inline INT64 WN_Get_Linenum(const WN *wn)
{
  if (OPCODE_has_next_prev(WN_opcode(wn))) {
    return WN_linenum(wn);
  } else {
    return 0;
  }
}


but how about file name? is there a similar API I can use?  intra-procedurally, 
there is a global variable "Orig_Src_File_Name" I can use,
how about in IPA before the final transformation?

Thanks.

TIanwei
-- 
Sheng, Tianwei
Inst. of High Performance Computing
Dept. of Computer Sci. & Tech.
Tsinghua Univ.



      
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to