mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
11d53c129f
and passing off ownership to AsmPrinter. Now MachineModuleInfo creates it and owns it by value. This allows us to use MCSymbols more consistently throughout the rest of the code generator, and simplifies a bit of code. This also allows MachineFunction to keep an MCContext reference handy, and cleans up the TargetRegistry interfaces for AsmPrinters. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98450 91177308-0d34-0410-b5e6-96231b3b80d8
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
//===-- MachineFunctionAnalysis.cpp ---------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains the definitions of the MachineFunctionAnalysis members.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
|
#include "llvm/CodeGen/MachineModuleInfo.h"
|
|
using namespace llvm;
|
|
|
|
// Register this pass with PassInfo directly to avoid having to define
|
|
// a default constructor.
|
|
static PassInfo
|
|
X("Machine Function Analysis", "machine-function-analysis",
|
|
intptr_t(&MachineFunctionAnalysis::ID), 0,
|
|
/*CFGOnly=*/false, /*is_analysis=*/true);
|
|
|
|
char MachineFunctionAnalysis::ID = 0;
|
|
|
|
MachineFunctionAnalysis::MachineFunctionAnalysis(const TargetMachine &tm,
|
|
CodeGenOpt::Level OL) :
|
|
FunctionPass(&ID), TM(tm), OptLevel(OL), MF(0) {
|
|
}
|
|
|
|
MachineFunctionAnalysis::~MachineFunctionAnalysis() {
|
|
releaseMemory();
|
|
assert(!MF && "MachineFunctionAnalysis left initialized!");
|
|
}
|
|
|
|
bool MachineFunctionAnalysis::runOnFunction(Function &F) {
|
|
assert(!MF && "MachineFunctionAnalysis already initialized!");
|
|
MF = new MachineFunction(&F, TM, NextFnNum++,
|
|
getAnalysis<MachineModuleInfo>().getContext());
|
|
return false;
|
|
}
|
|
|
|
void MachineFunctionAnalysis::releaseMemory() {
|
|
delete MF;
|
|
MF = 0;
|
|
}
|
|
|
|
void MachineFunctionAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
|
|
AU.setPreservesAll();
|
|
AU.addRequired<MachineModuleInfo>();
|
|
}
|