llvm-6502/include/llvm/Transforms/ChangeAllocations.h
Chris Lattner f4de63f65f Implement a more powerful, simpler, pass system. This pass system can figure
out how to run a collection of passes optimially given their behaviors and
charactaristics.

Convert code to use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1507 91177308-0d34-0410-b5e6-96231b3b80d8
2002-01-21 07:31:50 +00:00

40 lines
1.3 KiB
C++

//===- llvm/Transforms/LowerAllocations.h - Remove Malloc & Free -*- C++ -*--=//
//
// This file defines the interface to a pass that lowers malloc and free
// instructions to calls to %malloc & %free functions. This transformation is
// a target dependant tranformation because we depend on the size of data types
// and alignment constraints.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_LOWERALLOCATIONS_H
#define LLVM_TRANSFORMS_LOWERALLOCATIONS_H
#include "llvm/Pass.h"
class TargetData;
class LowerAllocations : public MethodPass {
Method *MallocMeth; // Methods in the module we are processing
Method *FreeMeth; // Initialized by doPassInitializationVirt
const TargetData &DataLayout;
public:
inline LowerAllocations(const TargetData &TD) : DataLayout(TD) {
MallocMeth = FreeMeth = 0;
}
// doPassInitialization - For the lower allocations pass, this ensures that a
// module contains a declaration for a malloc and a free function.
//
// This function is always successful.
//
bool doInitialization(Module *M);
// doPerMethodWork - This method does the actual work of converting
// instructions over, assuming that the pass has already been initialized.
//
bool runOnMethod(Method *M);
};
#endif