diff options
author | Simon Marlow <simonmar@microsoft.com> | 2007-11-08 13:28:42 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2007-11-08 13:28:42 +0000 |
commit | e5d9aaa2b7b717c862651f8eea5e2dc66f0a8028 (patch) | |
tree | ec6294032c14933b72553e5a5b5538901978cbf6 /compiler/codeGen/CgHeapery.lhs | |
parent | 23e4e1039c16bb30fec04b5006bfc0f4989239d9 (diff) | |
download | haskell-e5d9aaa2b7b717c862651f8eea5e2dc66f0a8028.tar.gz |
Pad static literals to word size in the code generator
Diffstat (limited to 'compiler/codeGen/CgHeapery.lhs')
-rw-r--r-- | compiler/codeGen/CgHeapery.lhs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/codeGen/CgHeapery.lhs b/compiler/codeGen/CgHeapery.lhs index cef14cf9fc..9cb1bb4370 100644 --- a/compiler/codeGen/CgHeapery.lhs +++ b/compiler/codeGen/CgHeapery.lhs @@ -231,7 +231,7 @@ mkStaticClosure :: CLabel -> CostCentreStack -> [CmmLit] mkStaticClosure info_lbl ccs payload padding_wds static_link_field saved_info_field = [CmmLabel info_lbl] ++ variable_header_words - ++ payload + ++ concatMap padLitToWord payload ++ padding_wds ++ static_link_field ++ saved_info_field @@ -241,6 +241,17 @@ mkStaticClosure info_lbl ccs payload padding_wds static_link_field saved_info_fi ++ staticParHdr ++ staticProfHdr ccs ++ staticTickyHdr + +padLitToWord :: CmmLit -> [CmmLit] +padLitToWord lit = lit : padding pad_length + where rep = cmmLitRep lit + pad_length = wORD_SIZE - machRepByteWidth rep :: Int + + padding n | n <= 0 = [] + | n `rem` 2 /= 0 = CmmInt 0 I8 : padding (n-1) + | n `rem` 4 /= 0 = CmmInt 0 I16 : padding (n-2) + | n `rem` 8 /= 0 = CmmInt 0 I32 : padding (n-4) + | otherwise = CmmInt 0 I64 : padding (n-8) \end{code} %************************************************************************ |