This patch adds a new class named InstructionError to improve the error reporting in the driver.
A new class named InstructionError has been added to Support.h in order to improve the error reporting from class InstrBuilder.
The llvm-mca driver is responsible for handling InstructionError objects, and printing them out to stderr.
The goal of this patch is to remove all the remaining error handling logic from the library code.
In particular, this allows us to:
- Simplify the logic in InstrBuilder by removing a needless dependency from MCInstrPrinter.
- Centralize all the error halding logic in a new function named 'runPipeline' (see llvm-mca.cpp).
This is also a first step towards generalizing class InstrBuilder, so that in future, we will be able to reuse its logic to also "lower" MachineInstr to mca::Instruction objects.
Let me know if okay to commit.
You can probably get away with just making these StringRefs in this case.