diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-26 04:35:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-26 04:35:26 +0000 |
commit | 6715952c2556cdd5ed8c5a0595e4bbae4560d17d (patch) | |
tree | a9bac51ef8736a33975a9f25d152aac5bf0da7ea /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | f8f8ba8a47787209f125a3e859d6c803beeffbc3 (diff) | |
download | bcm5719-llvm-6715952c2556cdd5ed8c5a0595e4bbae4560d17d.tar.gz bcm5719-llvm-6715952c2556cdd5ed8c5a0595e4bbae4560d17d.zip |
make MachineFunction keep track of its ID and make
MachineFunctionAnalysis dole them out, instead of having
AsmPrinter do both. Have the AsmPrinter::SetupMachineFunction
method set the 'AsmPrinter::MF' variable.
llvm-svn: 94509
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index fd6d182702b..537993373a6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -64,7 +64,7 @@ static bool getVerboseAsm(bool VDef) { char AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm, const MCAsmInfo *T, bool VDef) - : MachineFunctionPass(&ID), FunctionNumber(0), O(o), + : MachineFunctionPass(&ID), O(o), TM(tm), MAI(T), TRI(tm.getRegisterInfo()), OutContext(*new MCContext()), @@ -87,6 +87,12 @@ AsmPrinter::~AsmPrinter() { delete &OutContext; } +/// getFunctionNumber - Return a unique ID for the current function. +/// +unsigned AsmPrinter::getFunctionNumber() const { + return MF->getFunctionNumber(); +} + TargetLoweringObjectFile &AsmPrinter::getObjFileLowering() const { return TM.getTargetLowering()->getObjFileLowering(); } @@ -359,9 +365,9 @@ bool AsmPrinter::doFinalization(Module &M) { } void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { + this->MF = &MF; // Get the function symbol. CurrentFnSym = GetGlobalValueSymbol(MF.getFunction()); - IncrementFunctionNumber(); if (VerboseAsm) LI = &getAnalysis<MachineLoopInfo>(); |