Using ValueSymbolTable...

Hi all,
I have a question regarding populating ValueSymbolTable of a Function.
Is it that ValueSymbolTable is populated automatically whenever an alloca
instruction is created using IRBuilder or do we need to explicitly
populate??
If we need to populate explicitly, the insert method in ValueSymbolTable is
private, so how can we do it?

Currently, I am trying to access the symbol table as below:
llvm::ValueSymbolTable symTab;
symTab = mCurrentFunction->getValueSymbolTable();
llvm::Value* variable = symTab.lookup(aName);

Thanks

subramanyam wrote:

Hi all,
I have a question regarding populating ValueSymbolTable of a Function.
Is it that ValueSymbolTable is populated automatically whenever an alloca
instruction is created using IRBuilder or do we need to explicitly
populate??

It's maintained by LLVM for you, by Value::setName and other methods.

Nick

Nick Lewycky wrote:

It's maintained by LLVM for you, by Value::setName and other methods.

Nick
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

I am getting the following error when trying to fetch the symbol table using
getValueSymbolTable()

/home/llvm/install/include/llvm/ADT/StringMap.h:256: void
llvm::StringMap<ValueTy, AllocatorTy>::operator=(const
llvm::StringMap<ValueTy, AllocatorTy>&) [with ValueTy = llvm::Value*,
AllocatorTy = llvm::MallocAllocator]: Assertion `RHS.empty() && "assignment
from non-empty stringmap not implemented yet!"' failed.

Regards,
subbu

I am getting the following error when trying to fetch the symbol table using
getValueSymbolTable()

Why do you want to do this?

Anton Korobeynikov-2 wrote:

I am getting the following error when trying to fetch the symbol table
using
getValueSymbolTable()

Why do you want to do this?

I want to access some of the variables created in the function.

I want to access some of the variables created in the function.

Use Module's iterators to access the globals.

subramanyam wrote:

Nick Lewycky wrote:

It's maintained by LLVM for you, by Value::setName and other methods.

Nick
_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

I am getting the following error when trying to fetch the symbol table using
getValueSymbolTable()

/home/llvm/install/include/llvm/ADT/StringMap.h:256: void
llvm::StringMap<ValueTy, AllocatorTy>::operator=(const
llvm::StringMap<ValueTy, AllocatorTy>&) [with ValueTy = llvm::Value*,
AllocatorTy = llvm::MallocAllocator]: Assertion `RHS.empty()&& "assignment
from non-empty stringmap not implemented yet!"' failed.

Does the value you created have a parent?

Nick