@@ -346,7 +346,7 @@ instance ToNBitCode (Maybe Ident, Module) where
346346
347347 mkGlobalRec  ::  HasCallStack  =>  V. Value  ->  NBitCode 
348348 mkGlobalRec (V. Global {.. }) =  mkRec MC. GLOBALVAR  [ lookupTypeIndex typeMap t --  NOTE: We store the pointee type.
349-  , 1 .|.  shift (bool gIsConst)  1  .|.  shift gAddressSpace 2 
349+  , bool gIsConst  .|.  shift explicitType  1  .|.  shift gAddressSpace 2 
350350 , fromMaybe 0  ((+ 1 ) .  lookupSymbolIndex <$>  gInit)
351351 , fromEnum' gLinkage
352352 , gParamAttrs
@@ -359,6 +359,7 @@ instance ToNBitCode (Maybe Ident, Module) where
359359 , gComdat
360360 ]
361361 where  (T. Ptr  _ t) =  gPointerType
362+  explicitType =  1 
362363
363364 mkFunctionRec  ::  HasCallStack  =>  V. Value  ->  NBitCode 
364365 mkFunctionRec (V. Function {.. }) =  mkRec MC. FUNCTION  [ lookupTypeIndex typeMap t --  NOTE: Similar to Globals we store the pointee type.
@@ -505,13 +506,21 @@ instance ToNBitCode (Maybe Ident, Module) where
505506 --  XXX: Call needs paramAttrs! -- Can use 0 for empty param set.
506507 mkInstRec n (I. Call  _ tck cc s fnTy args)
507508 |  ty (V. symbolValue s) /=  ty s =  error  $  unlines  [ " SymbolValues type and Symbol" 
508-  , show  s
509-  , " type mismatch; symbolValue ty" 
510-  , show  (ty (V. symbolValue s))
511-  , " ty s" 
512-  , show  (ty s)
513-  ]
514-  |  ty (V. symbolValue s) /=  fnTy =  error  $  " Callees Symbols ty "   ++  show  (ty (V. symbolValue s)) ++  "  does not match call signature "   ++  show  fnTy
509+  , show  s
510+  , " type mismatch; symbolValue ty" 
511+  , show  (ty (V. symbolValue s))
512+  , " ty s" 
513+  , show  (ty s)
514+  ]
515+  |  ty (V. symbolValue s) /=  fnTy =  error  $  unlines  [ " Callees Symbols " 
516+  , show  s
517+  , " type mismatch; symbolValue ty" 
518+  , show  (ty (V. symbolValue s))
519+  , " function signature type" 
520+  , show  fnTy
521+  , " arguments ("   ++  show  (length  args) ++  " )" 
522+  , show  args
523+  ]
515524 |  otherwise  =  mkRec FC. INST_CALL  $  [ (0  ::  Word64 ) --  Fix PARAMATTR
516525 , cconv .|.  tcKind .|.  explTy
517526 --  FMF
@@ -592,7 +601,7 @@ instance ToNBitCode (Maybe Ident, Module) where
592601
593602 mkInstRec n (I. ExtractValue  val idxs)
594603 =  mkRec FC. INST_EXTRACTVAL  $  [ lookupRelativeSymbolIndex' n val ] ++  idxs
595- 
604+ 596605 mkInstRec n i =  error  $  " Instruction "   ++  (show  i) ++  "  not yet supported." 
597606 --  Fold helper to keep track of the instruction count.
598607 mkInstRecFold  ::  HasCallStack  =>  (Word64 , [NBitCode ]) ->  I. Inst  ->  (Word64 , [NBitCode ])
0 commit comments