diff options
author | Quentin Colombet <qcolombet@apple.com> | 2016-08-26 22:32:53 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2016-08-26 22:32:53 +0000 |
commit | ac0c6d3071088fbf713d77f0b904484692ea19f9 (patch) | |
tree | 507598b5ccfaa9643ba9640200ee8c7bb724da15 /include | |
parent | ea4e88c5cffb0fa2b480f6b22f3eae5b967883ea (diff) |
[MachineFunction] Introduce a reset method.
This method allows to reset the state of a MachineFunction as if it was
just created. This will be used during the bring-up of GlobalISel to
provide a way to fallback on SelectionDAG. That way, we can start doing
correctness testing even if we are not able to select all functions via
the global instruction selector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279876 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/MachineFunction.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index ad72e84c07d..57b7bc6bf70 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -238,11 +238,28 @@ class MachineFunction { MachineFunction(const MachineFunction &) = delete; void operator=(const MachineFunction&) = delete; + + /// Clear all the members of this MachineFunction, but the ones used + /// to initialize again the MachineFunction. + /// More specifically, this deallocates all the dynamically allocated + /// objects and get rid of all the XXXInfo data structure, but keep + /// unchanged the references to Fn, Target, MMI, and FunctionNumber. + void clear(); + /// Allocate and initialize the different members. + /// In particular, the XXXInfo data structure. + /// \pre Fn, Target, MMI, and FunctionNumber are properly set. + void init(); public: MachineFunction(const Function *Fn, const TargetMachine &TM, unsigned FunctionNum, MachineModuleInfo &MMI); ~MachineFunction(); + /// Reset the instance as if it was just created. + void reset() { + clear(); + init(); + } + MachineModuleInfo &getMMI() const { return MMI; } MCContext &getContext() const { return Ctx; } |