blob: 8f53051da34fe3d027f77f078dc249dbb199f3bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
//===- 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 Pass {
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 doPassInitialization(Module *M);
// doPerMethodWork - This method does the actual work of converting
// instructions over, assuming that the pass has already been initialized.
//
bool doPerMethodWork(Method *M);
};
#endif
|