mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
Move local statics to per-instance variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74132 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
02a6218774
commit
bd58edf591
@ -109,6 +109,12 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
bool VerboseAsm;
|
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:
|
protected:
|
||||||
explicit AsmPrinter(raw_ostream &o, TargetMachine &TM,
|
explicit AsmPrinter(raw_ostream &o, TargetMachine &TM,
|
||||||
const TargetAsmInfo *T, CodeGenOpt::Level OL, bool V);
|
const TargetAsmInfo *T, CodeGenOpt::Level OL, bool V);
|
||||||
|
@ -45,7 +45,7 @@ AsmPrinter::AsmPrinter(raw_ostream &o, TargetMachine &tm,
|
|||||||
const TargetAsmInfo *T, CodeGenOpt::Level OL, bool VDef)
|
const TargetAsmInfo *T, CodeGenOpt::Level OL, bool VDef)
|
||||||
: MachineFunctionPass(&ID), FunctionNumber(0), OptLevel(OL), O(o),
|
: MachineFunctionPass(&ID), FunctionNumber(0), OptLevel(OL), O(o),
|
||||||
TM(tm), TAI(T), TRI(tm.getRegisterInfo()),
|
TM(tm), TAI(T), TRI(tm.getRegisterInfo()),
|
||||||
IsInTextSection(false) {
|
IsInTextSection(false), LastMI(0), LastFn(0), Counter(~0U) {
|
||||||
DW = 0; MMI = 0;
|
DW = 0; MMI = 0;
|
||||||
switch (AsmVerbose) {
|
switch (AsmVerbose) {
|
||||||
case cl::BOU_UNSET: VerboseAsm = VDef; break;
|
case cl::BOU_UNSET: VerboseAsm = VDef; break;
|
||||||
@ -1315,20 +1315,15 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) const {
|
|||||||
if (VerboseAsm)
|
if (VerboseAsm)
|
||||||
O << TAI->getCommentString();
|
O << TAI->getCommentString();
|
||||||
} else if (!strcmp(Code, "uid")) {
|
} 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
|
// Comparing the address of MI isn't sufficient, because machineinstrs may
|
||||||
// be allocated to the same address across functions.
|
// be allocated to the same address across functions.
|
||||||
const Function *ThisF = MI->getParent()->getParent()->getFunction();
|
const Function *ThisF = MI->getParent()->getParent()->getFunction();
|
||||||
|
|
||||||
// If this is a new machine instruction, bump the counter.
|
// If this is a new LastFn instruction, bump the counter.
|
||||||
if (LastMI != MI || F != ThisF) {
|
if (LastMI != MI || LastFn != ThisF) {
|
||||||
++Counter;
|
++Counter;
|
||||||
LastMI = MI;
|
LastMI = MI;
|
||||||
F = ThisF;
|
LastFn = ThisF;
|
||||||
}
|
}
|
||||||
O << Counter;
|
O << Counter;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user