diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2017-04-24 09:41:35 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-04-24 12:53:43 -0400 |
commit | b68697e579d38ca29c2b84377dc2affa04659a28 (patch) | |
tree | 3d7a9f8c888baad175c81863d5519fb42e817770 /compiler/llvmGen/LlvmCodeGen/Data.hs | |
parent | d5cb4d2b7fab89ea1c3fc74da2317f86e75816ea (diff) | |
download | haskell-b68697e579d38ca29c2b84377dc2affa04659a28.tar.gz |
compiler/cmm/PprC.hs: constify labels in .rodata
Consider one-line module
module B (v) where v = "hello"
in -fvia-C mode it generates code like
static char gibberish_str[] = "hello";
It resides in data section (precious resource on ia64!).
The patch switches genrator to emit:
static const char gibberish_str[] = "hello";
Other types if symbols that gained 'const' qualifier are:
- info tables (from haskell and CMM)
- static reference tables (from haskell and CMM)
Cleanups along the way:
- fixed info tables defined in .cmm to reside in .rodata
- split out closure declaration into 'IC_' / 'EC_'
- added label declaration (based on label type) right before
each label definition (based on section type) so that C
compiler could check if declaration and definition matches
at definition site.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: ran testsuite on unregisterised x86_64 compiler
Reviewers: simonmar, ezyang, austin, bgamari, erikd
Reviewed By: bgamari, erikd
Subscribers: rwbarton, thomie
GHC Trac Issues: #8996
Differential Revision: https://phabricator.haskell.org/D3481
Diffstat (limited to 'compiler/llvmGen/LlvmCodeGen/Data.hs')
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen/Data.hs | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs index 9bb5a75bda..adb86d312d 100644 --- a/compiler/llvmGen/LlvmCodeGen/Data.hs +++ b/compiler/llvmGen/LlvmCodeGen/Data.hs @@ -56,18 +56,6 @@ genLlvmData (sec, Statics lbl xs) = do return ([globDef], [tyAlias]) --- | Should a data in this section be considered constant -isSecConstant :: Section -> Bool -isSecConstant (Section t _) = case t of - Text -> True - ReadOnlyData -> True - RelocatableReadOnlyData -> True - ReadOnlyData16 -> True - CString -> True - Data -> False - UninitialisedData -> False - (OtherSection _) -> False - -- | Format the section type part of a Cmm Section llvmSectionType :: Platform -> SectionType -> FastString llvmSectionType p t = case t of |