[llvm-commits] [PATCH] Machine code verifier pass
Evan Cheng
evan.cheng at apple.com
Mon May 11 11:43:15 PDT 2009
Thanks Jakob! So comments below:
+ const MachineBasicBlock *MBB;
+ BBInfo *MBBInfo;
+ const MachineInstr *MI;
+ const MachineOperand *MO;
I find it strange that these are class ivars. Can you change them to
local variables and parameters?
+void
+MachineVerifier::calcMaxRegsPassed()
+{
+ // First push live-out regs to successors' vregsPassed. Remember
the MBBs that
+ // have any vregsPassed.
+ DenseSet<const MachineBasicBlock*> todo;
+ for (MachineFunction::const_iterator MFI = MF->begin(), MFE = MF-
>end();
+ MFI != MFE; ++MFI) {
+ const MachineBasicBlock &MBB(*MFI);
+ BBInfo &MInfo = MBBInfoMap[&MBB];
+ for (MachineBasicBlock::const_succ_iterator SuI = MBB.succ_begin(),
+ SuE = MBB.succ_end(); SuI != SuE; ++SuI) {
+ BBInfo &SInfo = MBBInfoMap[*SuI];
+ if (SInfo.addPassed(MInfo.regsLiveOut))
+ todo.insert(*SuI);
+ }
+ }
+
+ // Iteratively push vregsPassed to successors until convergence.
+ while (!todo.empty()) {
I don't think the order of iteration of DenseSet is deterministic.
+ // If any regs removed, we need to recheck successors
Missing a period at the end of the sentence.
Have you had a chance running this through some code?
Thanks,
Evan
On May 8, 2009, at 2:38 PM, Jakob Stoklund Olesen wrote:
> Hi,
>
> The attached patch creates a machine code verifier pass, enabled
> with -verify-machineinstrs. The verifier pass is run immediately
> after -print-machineinstrs would run. It verifies the following:
>
> 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 double-definition checking is disabled until LiveVariables has
> run.
>
> If I have misunderstood something about valid machine code, please
> let me know.
>
> <machine-verifier.patch>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list