X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FCmmLint.hs;h=80ad9ef49d6f406b250bffa1365bea183ded5490;hp=fbfb14c1653d42d9bdaa941c3650ede3f028e9bd;hb=49c98d143c382a1341e1046f5ca00819a25691ba;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1 diff --git a/compiler/cmm/CmmLint.hs b/compiler/cmm/CmmLint.hs index fbfb14c..80ad9ef 100644 --- a/compiler/cmm/CmmLint.hs +++ b/compiler/cmm/CmmLint.hs @@ -1,8 +1,8 @@ ----------------------------------------------------------------------------- -- --- CmmLint: checking the correctness of Cmm statements and expressions +-- (c) The University of Glasgow 2004-2006 -- --- (c) The University of Glasgow 2004 +-- CmmLint: checking the correctness of Cmm statements and expressions -- ----------------------------------------------------------------------------- @@ -13,14 +13,14 @@ module CmmLint ( #include "HsVersions.h" import Cmm -import CLabel ( pprCLabel ) +import CLabel import MachOp import Outputable import PprCmm -import Unique ( getUnique ) -import Constants ( wORD_SIZE ) +import Unique +import Constants -import Monad ( when ) +import Control.Monad -- ----------------------------------------------------------------------------- -- Exported entry points: @@ -118,11 +118,15 @@ lintCmmStmt (CmmStore l r) = do lintCmmExpr r return () lintCmmStmt (CmmCall _target _res args _vols) = mapM_ (lintCmmExpr.fst) args -lintCmmStmt (CmmCondBranch e _id) = lintCmmExpr e >> return () +lintCmmStmt (CmmCondBranch e _id) = lintCmmExpr e >> checkCond e >> return () lintCmmStmt (CmmSwitch e _branches) = lintCmmExpr e >> return () lintCmmStmt (CmmJump e _args) = lintCmmExpr e >> return () lintCmmStmt _other = return () +checkCond (CmmMachOp mop _) | isComparisonMachOp mop = return () +checkCond expr = cmmLintErr (hang (text "expression is not a conditional:") 2 + (ppr expr)) + -- ----------------------------------------------------------------------------- -- CmmLint monad