[LLVMdev] struct type parament
Mehdi Amini
mehdi.amini at apple.com
Tue Jun 2 11:48:40 PDT 2015
Hi,
I think this is when a collision is found on the name.
I would be interesting to have the full test, it might be that the API is used in a way such that type is constantly re-created even if it already exists, which might be inefficient.
See in lib/IR/Type.cpp, StructType::setName(StringRef Name):
...
// While we have a name collision, try a random rename.
if (Entry->getValue()) {
SmallString<64> TempStr(Name);
TempStr.push_back('.');
raw_svector_ostream TmpStream(TempStr);
unsigned NameSize = Name.size();
do {
TempStr.resize(NameSize + 1);
TmpStream.resync();
TmpStream << getContext().pImpl->NamedStructTypesUniqueID++;
Entry = &getContext().pImpl->
NamedStructTypes.GetOrCreateValue(TmpStream.str());
} while (Entry->getValue());
}
—
Mehdi
> On Jun 2, 2015, at 11:23 AM, Haopeng Liu <hyliuhp at gmail.com> wrote:
>
> Hi All,
>
> I generated the following code with "clang -flto" command.
>
> void test(struct StruTyName *a) {
> ...
> }
>
> Then the type of test function is "void (%struct.StruTyName.100*)" by calling function::getFunctionType API.
>
> What's the meaning of number 100?
>
> Best,
> Haopeng
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list