diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-14 17:53:23 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-14 17:53:23 +0000 |
commit | 9efbbcbe454b16b41e22a5986878c6b6ac925e80 (patch) | |
tree | 5f2a4c700cc93bd2c8f54e316f56e48030ba8b40 /llvm/lib/CodeGen/MachineModuleInfo.cpp | |
parent | 87dd2d6388db027c83ed5d76a82c9c465c332898 (diff) | |
download | llvm-9efbbcbe454b16b41e22a5986878c6b6ac925e80.zip llvm-9efbbcbe454b16b41e22a5986878c6b6ac925e80.tar.gz llvm-9efbbcbe454b16b41e22a5986878c6b6ac925e80.tar.bz2 |
fix AsmPrinter::GetBlockAddressSymbol to always return a unique
label instead of trying to form one based on the BB name (which
causes collisions if the name is empty). This fixes PR6608
llvm-svn: 98495
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineModuleInfo.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index fdbda8f..a23cc1a 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -104,6 +104,18 @@ void MachineModuleInfo::AnalyzeModule(Module &M) { UsedFunctions.insert(F); } +/// getAddrLabelSymbol - Return the symbol to be used for the specified basic +/// block when its address is taken. This cannot be its normal LBB label +/// because the block may be accessed outside its containing function. +MCSymbol *MachineModuleInfo::getAddrLabelSymbol(const BasicBlock *BB) { + assert(BB->hasAddressTaken() && + "Shouldn't get label for block without address taken"); + MCSymbol *&Entry = AddrLabelSymbols[const_cast<BasicBlock*>(BB)]; + if (Entry) return Entry; + return Entry = Context.CreateTempSymbol(); +} + + //===-EH-------------------------------------------------------------------===// /// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the |