-// The next two methods are used to construct and to retrieve
-// the MachineCodeForFunction object for the given function.
-// construct() -- Allocates and initializes for a given function and target
-// get() -- Returns a handle to the object.
-// This should not be called before "construct()"
-// for a given Function.
-//
-MachineFunction&
-MachineFunction::construct(const Function *Fn, const TargetMachine &Tar)
-{
- AnnotationID MF_AID =
- AnnotationManager::getID("CodeGen::MachineCodeForFunction");
- assert(Fn->getAnnotation(MF_AID) == 0 &&
- "Object already exists for this function!");
- MachineFunction* mcInfo = new MachineFunction(Fn, Tar);
- Fn->addAnnotation(mcInfo);
- return *mcInfo;
-}
-
-void MachineFunction::destruct(const Function *Fn) {
- AnnotationID MF_AID =
- AnnotationManager::getID("CodeGen::MachineCodeForFunction");
- bool Deleted = Fn->deleteAnnotation(MF_AID);
- assert(Deleted && "Machine code did not exist for function!");
- Deleted = Deleted; // silence warning when no assertions.
-}
-
-MachineFunction& MachineFunction::get(const Function *F)
-{
- AnnotationID MF_AID =
- AnnotationManager::getID("CodeGen::MachineCodeForFunction");
- MachineFunction *mc = (MachineFunction*)F->getAnnotation(MF_AID);
- assert(mc && "Call construct() method first to allocate the object");
- return *mc;
-}
-