[LLVMdev] Adding type qualifies or property

Reid Spencer reid at x10sys.com
Mon Jul 12 00:39:02 PDT 2004


Xia,

LLVM doesn't really use type qualifiers the way you're thinking about
it. In LLVM parlance, types are neither const nor non-const, they just
define the fundamental nature of a value. However, LLVM fully supports
Constant Values (see include/llvm/Constant.h) and constant global
variables (see include/llvm/GlobalVariable.h). You might want to read up
on the LLVM IR a bit here:

http://llvm.cs.uiuc.edu/docs/GettingStarted.html
http://llvm.cs.uiuc.edu/docs/ProgrammersManual.html
http://llvm.cs.uiuc.edu/docs/LangRef.html

Reid.

On Sun, 2004-07-11 at 21:08, xia_yimin wrote:
> Hi
> 
> Has anybody tell me how to create some new type qualifies in LVM? 
> A type qualify, like "const" in C, is useful for program 
> analysis. I hope that I can set/get the type qualify of any value 
> in a program analysed.
> 
> Or, if I could add a property to the value class and set/get the 
> property, it is same to add some new type qualifies. So, I simply 
> insert a "int" private members in the value class in 
> llvm/Value.h, write a pair of set/get methods for the value 
> class, and initialize it in Value::Value(const Type *ty, ValueTy vty, const std::string &name). But, when I set the privative 
> member of a value in my pass, analyse gives me:
> 
> analyze[0x83f0a00]
> analyze[0x83f0c0c]
> /lib/tls/libc.so.6[0x420275c8]
> analyze(void std::_Destroy<llvm::Use>(llvm::Use*)+0x11)[0x8296921]
> analyze(void std::__destroy_aux<llvm::Use*>(llvm::Use*, llvm::Use*, __false_type)+0x1c)[0x8297570]
> analyze(void std::_Destroy<llvm::Use*>(llvm::Use*, llvm::Use*)+0x1a)[0x82968f0]
> analyze(std::vector<llvm::Use, std::allocator<llvm::Use> >::~vector [in-charge]()+0x19)[0x82972fd]
> analyze(llvm::User::~User [not-in-charge]()+0x1e)[0x8295b8c]
> analyze(llvm::GlobalValue::~GlobalValue [not-in-charge]()+0x1a)[0x83ba8c0]
> analyze(llvm::Function::~Function [in-charge deleting]()+0xb4)[0x8374768]
> analyze(llvm::iplist<llvm::Function, llvm::ilist_traits<llvm::Function> >::erase(llvm::ilist_iterator<llvm::Function>)+0x38)[0x8288ba2]
> analyze(llvm::iplist<llvm::Function, llvm::ilist_traits<llvm::Function> >::erase(llvm::ilist_iterator<llvm::Function>, llvm::ilist_iterator<llvm::Function>)+0x32)[0x83bb8d4]
> analyze(llvm::iplist<llvm::Function, llvm::ilist_traits<llvm::Function> >::clear()+0x3d)[0x83bb5e1]
> analyze(llvm::Module::~Module [in-charge]()+0x41)[0x83788b9]
> analyze(main+0x5f7)[0x827151b]
> /lib/tls/libc.so.6(__libc_start_main+0xe4)[0x42015574]
> analyze(dlopen+0x41)[0x8269b75]
> 
> Has anyone encountered this? Any workarounds?
> 
> Thanks,
> 
> David xia
> 
> 
> ______________________________________
> 
> ע30䣨 http://mail.sina.com.cn/chooseMode.html
> 
> ===================================================================
> ԸС (http://ad4.sina.com.cn/wx/ads/zhuiyu_hprefresh1.html)
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040712/0842b526/attachment.sig>


More information about the llvm-dev mailing list