-// LowerAllocations - Turn malloc and free instructions into %malloc and %free
-// calls.
-//
-class LowerAllocations : public BasicBlockPass {
- Function *MallocFunc; // Functions in the module we are processing
- Function *FreeFunc; // Initialized by doInitialization
-
- const TargetData &DataLayout;
-public:
- LowerAllocations(const TargetData &TD) : DataLayout(TD) {
- MallocFunc = FreeFunc = 0;
- }
-
- // doPassInitialization - For the lower allocations pass, this ensures that a
- // module contains a declaration for a malloc and a free function.
- //
- bool doInitialization(Module &M);
-
- // runOnBasicBlock - This method does the actual work of converting
- // instructions over, assuming that the pass has already been initialized.
- //
- bool runOnBasicBlock(BasicBlock &BB);
-};
+ /// doPassInitialization - For the lower allocations pass, this ensures that
+ /// a module contains a declaration for a malloc and a free function.
+ ///
+ bool doInitialization(Module &M);
+
+ /// runOnBasicBlock - This method does the actual work of converting
+ /// instructions over, assuming that the pass has already been initialized.
+ ///
+ bool runOnBasicBlock(BasicBlock &BB);
+ };
+
+ RegisterOpt<LowerAllocations>
+ X("lowerallocs", "Lower allocations from instructions to calls");