Improve X86CodeGen's pprASCII.
authorHE, Tao <sighingnow@gmail.com>
Tue, 6 Feb 2018 18:29:40 +0000 (13:29 -0500)
committerBen Gamari <ben@smart-cactus.org>
Tue, 6 Feb 2018 19:21:16 +0000 (14:21 -0500)
commit2987b041a3811b25bcee402ce6fdab80827dc90e
tree42b60ab5f8663653320548a281b8f050e3ceb56a
parent4c364402ad9edade698863a3684f395e737b9de2
Improve X86CodeGen's pprASCII.

The original implementation generates a list of SDoc then concatenates
them using `hcat`. For memory optimization, we can transform the given
literal string into escaped string the construct SDoc directly.

This optimization will decreate the memory allocation when there's big
literal strings in haskell code, see Trac #14741.

Signed-off-by: HE, Tao <sighingnow@gmail.com>
Reviewers: bgamari, mpickering, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie, carter

GHC Trac Issues: #14741

Differential Revision: https://phabricator.haskell.org/D4384
compiler/nativeGen/X86/Ppr.hs