[llvm-commits] [llvm] r113600 - in /llvm/trunk: include/llvm/AutoUpgrade.h lib/Bitcode/Reader/BitcodeReader.cpp lib/VMCore/AutoUpgrade.cpp test/Bitcode/AutoUpgradeGlobals.ll test/Bitcode/AutoUpgradeGlobals.ll.bc
Bill Wendling
isanbard at gmail.com
Fri Sep 10 11:51:56 PDT 2010
Author: void
Date: Fri Sep 10 13:51:56 2010
New Revision: 113600
URL: http://llvm.org/viewvc/llvm-project?rev=113600&view=rev
Log:
Auto-upgrade the magic ".llvm.eh.catch.all.value" global to
"llvm.eh.catch.all.value". Only the name needs to be changed.
Added:
llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll
llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll.bc (with props)
Modified:
llvm/trunk/include/llvm/AutoUpgrade.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/VMCore/AutoUpgrade.cpp
Modified: llvm/trunk/include/llvm/AutoUpgrade.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/AutoUpgrade.h?rev=113600&r1=113599&r2=113600&view=diff
==============================================================================
--- llvm/trunk/include/llvm/AutoUpgrade.h (original)
+++ llvm/trunk/include/llvm/AutoUpgrade.h Fri Sep 10 13:51:56 2010
@@ -16,6 +16,7 @@
namespace llvm {
class Module;
+ class GlobalVariable;
class Function;
class CallInst;
@@ -35,6 +36,10 @@
/// so that it can update all calls to the old function.
void UpgradeCallsToIntrinsic(Function* F);
+ /// This checks for global variables which should be upgraded. It returns true
+ /// if it requires upgrading.
+ bool UpgradeGlobalVariable(GlobalVariable *GV);
+
/// This function checks debug info intrinsics. If an intrinsic is invalid
/// then this function simply removes the intrinsic.
void CheckDebugInfoIntrinsics(Module *M);
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=113600&r1=113599&r2=113600&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Sep 10 13:51:56 2010
@@ -1288,6 +1288,12 @@
UpgradedIntrinsics.push_back(std::make_pair(FI, NewFn));
}
+ // Look for global variables which need to be renamed.
+ for (Module::global_iterator
+ GI = TheModule->global_begin(), GE = TheModule->global_end();
+ GI != GE; ++GI)
+ UpgradeGlobalVariable(GI);
+
// Force deallocation of memory for these vectors to favor the client that
// want lazy deserialization.
std::vector<std::pair<GlobalVariable*, unsigned> >().swap(GlobalInits);
Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=113600&r1=113599&r2=113600&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original)
+++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Fri Sep 10 13:51:56 2010
@@ -365,6 +365,20 @@
return Upgraded;
}
+bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
+ const std::string &Name = GV->getName();
+
+ // We are only upgrading one symbol here. If we upgrade more, we will want to
+ // perform some sort of short-circuiting like in the
+ // "UpgradeIntrinsicFunction1" function.
+ if (Name == ".llvm.eh.catch.all.value") {
+ GV->setName("llvm.eh.catch.all.value");
+ return true;
+ }
+
+ return false;
+}
+
/// ExtendNEONArgs - For NEON "long" and "wide" operations, where the results
/// have vector elements twice as big as one or both source operands, do the
/// sign- or zero-extension that used to be handled by intrinsics. The
Added: llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll?rev=113600&view=auto
==============================================================================
--- llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll (added)
+++ llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll Fri Sep 10 13:51:56 2010
@@ -0,0 +1,3 @@
+; This isn't really an assembly file. It just runs test on bitcode to ensure
+; it is auto-upgraded.
+; RUN: llvm-dis < %s.bc | not grep {i32 @\\.llvm\\.eh}
Added: llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll.bc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll.bc?rev=113600&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/Bitcode/AutoUpgradeGlobals.ll.bc
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
More information about the llvm-commits
mailing list