Pass to verify generated machine code.

The following is checked:

* Operand counts: All explicit operands must be present.

* Register classes: All physical and virtual register operands must be
  compatible with the register class required by the instruction descriptor.

* Register live intervals: Registers must be defined only once, and must be
  defined before use.

The machine code verifier is enabled with the command-line option
'-verify-machineinstrs', or by defining the environment variable
LLVM_VERIFY_MACHINEINSTRS to the name of a file that will receive all the
verifier errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71918 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen
2009-05-16 00:33:53 +00:00
parent 3b00162fa1
commit 48872e0d84
4 changed files with 711 additions and 27 deletions

View File

@@ -196,6 +196,13 @@ namespace llvm {
/// createStackProtectorPass - This pass adds stack protectors to functions.
FunctionPass *createStackProtectorPass(const TargetLowering *tli);
/// createMachineVerifierPass - This pass verifies cenerated machine code
/// instructions for correctness.
///
/// @param allowPhysDoubleDefs ignore double definitions of
/// registers. Useful before LiveVariables has run.
FunctionPass *createMachineVerifierPass(bool allowDoubleDefs);
} // End llvm namespace
#endif