[llvm-commits] [llvm] r74132 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Owen Anderson
resistor at mac.com
Wed Jun 24 15:28:13 PDT 2009
Author: resistor
Date: Wed Jun 24 17:28:12 2009
New Revision: 74132
URL: http://llvm.org/viewvc/llvm-project?rev=74132&view=rev
Log:
Move local statics to per-instance variables.
Modified:
llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=74132&r1=74131&r2=74132&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Wed Jun 24 17:28:12 2009
@@ -109,6 +109,12 @@
///
bool VerboseAsm;
+ /// Private state for PrintSpecial()
+ // Assign a unique ID to this machine instruction.
+ mutable const MachineInstr *LastMI;
+ mutable const Function *LastFn;
+ mutable unsigned Counter;
+
protected:
explicit AsmPrinter(raw_ostream &o, TargetMachine &TM,
const TargetAsmInfo *T, CodeGenOpt::Level OL, bool V);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=74132&r1=74131&r2=74132&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Jun 24 17:28:12 2009
@@ -45,7 +45,7 @@
const TargetAsmInfo *T, CodeGenOpt::Level OL, bool VDef)
: MachineFunctionPass(&ID), FunctionNumber(0), OptLevel(OL), O(o),
TM(tm), TAI(T), TRI(tm.getRegisterInfo()),
- IsInTextSection(false) {
+ IsInTextSection(false), LastMI(0), LastFn(0), Counter(~0U) {
DW = 0; MMI = 0;
switch (AsmVerbose) {
case cl::BOU_UNSET: VerboseAsm = VDef; break;
@@ -1315,20 +1315,15 @@
if (VerboseAsm)
O << TAI->getCommentString();
} else if (!strcmp(Code, "uid")) {
- // Assign a unique ID to this machine instruction.
- static const MachineInstr *LastMI = 0;
- static const Function *F = 0;
- static unsigned Counter = 0U-1;
-
// Comparing the address of MI isn't sufficient, because machineinstrs may
// be allocated to the same address across functions.
const Function *ThisF = MI->getParent()->getParent()->getFunction();
- // If this is a new machine instruction, bump the counter.
- if (LastMI != MI || F != ThisF) {
+ // If this is a new LastFn instruction, bump the counter.
+ if (LastMI != MI || LastFn != ThisF) {
++Counter;
LastMI = MI;
- F = ThisF;
+ LastFn = ThisF;
}
O << Counter;
} else {
More information about the llvm-commits
mailing list