This change attempts to do two things:
- It separates out the state that is stored in the MachineIRBuilder (insertion point, MF, MRI, InsertFunction etc.) into a separate object called MachineIRBuilderState.
- Add the ability to constant fold operations while building instructions (optionally). MachineIRBuilder is now refactored into a MachineIRBuilderBase which contains lots of non foldable build methods and their implementation. Instructions which can be constant folded/transformed are now in a class called FoldableInstructionBuilder which uses CRTP to use the implementation of the derived class for buildBinaryOps. Additionally buildInstr in the derived class can be used to implement other kinds of transformations.
MachineIRBuilder currently does no transformations where as ConstantFoldingMachineIRBuilder does constant folding (as used in the unit test).