Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Decking
GHC
Commits
157161ba
Commit
157161ba
authored
Dec 10, 2010
by
benl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting only
parent
13b1fa90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
compiler/llvmGen/LlvmMangler.hs
compiler/llvmGen/LlvmMangler.hs
+19
-19
No files found.
compiler/llvmGen/LlvmMangler.hs
View file @
157161ba
...
...
@@ -98,18 +98,18 @@ oneTable f str =
let
last'
xs
=
if
(
null
xs
)
then
0
else
last
xs
-- get the function
(
bl
,
al
)
=
BS
.
breakSubstring
functionSuf
str
start
=
last'
$
BS
.
findSubstrings
funDivider
bl
(
bl
,
al
)
=
BS
.
breakSubstring
functionSuf
str
start
=
last'
$
BS
.
findSubstrings
funDivider
bl
(
before
,
fheader
)
=
BS
.
splitAt
start
bl
(
fun
,
after
)
=
BS
.
breakSubstring
funDivider
al
label
=
snd
$
BS
.
breakEnd
eolPred
bl
(
fun
,
after
)
=
BS
.
breakSubstring
funDivider
al
label
=
snd
$
BS
.
breakEnd
eolPred
bl
-- get the info table
ilabel
=
label
`
BS
.
append
`
tableSuf
(
bit
,
itable
)
=
BS
.
breakSubstring
ilabel
after
(
itable'
,
ait
)
=
BS
.
breakSubstring
funDivider
itable
istart
=
last'
$
BS
.
findSubstrings
funDivider
bit
(
bit'
,
iheader
)
=
BS
.
splitAt
istart
bit
ilabel
=
label
`
BS
.
append
`
tableSuf
(
bit
,
itable
)
=
BS
.
breakSubstring
ilabel
after
(
itable'
,
ait
)
=
BS
.
breakSubstring
funDivider
itable
istart
=
last'
$
BS
.
findSubstrings
funDivider
bit
(
bit'
,
iheader
)
=
BS
.
splitAt
istart
bit
-- fixup stack alignment
fun'
=
fixupStack
fun
BS
.
empty
...
...
@@ -143,8 +143,8 @@ oneTable f str =
replaceSection
::
ByteString
->
ByteString
replaceSection
sec
=
let
(
s1
,
s2
)
=
BS
.
breakSubstring
oldSection
sec
s1'
=
fst
$
BS
.
breakEnd
eolPred
s1
s2'
=
snd
$
BS
.
break
eolPred
s2
s1'
=
fst
$
BS
.
breakEnd
eolPred
s1
s2'
=
snd
$
BS
.
break
eolPred
s2
in
s1'
`
BS
.
append
`
newSection
`
BS
.
append
`
s2'
...
...
@@ -161,10 +161,10 @@ replaceSection sec =
fixupStack
::
ByteString
->
ByteString
->
ByteString
fixupStack
fun
nfun
|
BS
.
null
nfun
=
let
-- fixup sub op
(
a
,
b
)
=
BS
.
breakSubstring
(
BS
.
pack
", %esp
\n
"
)
fun
(
a
,
b
)
=
BS
.
breakSubstring
(
BS
.
pack
", %esp
\n
"
)
fun
(
a'
,
num
)
=
BS
.
breakEnd
dollarPred
a
num'
=
BS
.
pack
$
show
(
read
(
BS
.
unpack
num
)
+
4
::
Int
)
fix
=
a'
`
BS
.
append
`
num'
num'
=
BS
.
pack
$
show
(
read
(
BS
.
unpack
num
)
+
4
::
Int
)
fix
=
a'
`
BS
.
append
`
num'
in
if
BS
.
null
b
then
nfun
`
BS
.
append
`
a
else
fixupStack
b
(
nfun
`
BS
.
append
`
fix
)
...
...
@@ -174,12 +174,12 @@ fixupStack fun nfun =
(
a
,
b
)
=
BS
.
breakSubstring
(
BS
.
pack
"jmp"
)
fun
-- We need to avoid processing jumps to labels, they are of the form:
-- jmp\tL..., jmp\t_f..., jmpl\t_f..., jmpl\t*%eax...
labelJump
=
BS
.
index
b
4
==
'L'
(
jmp
,
b'
)
=
BS
.
break
eolPred
b
labelJump
=
BS
.
index
b
4
==
'L'
(
jmp
,
b'
)
=
BS
.
break
eolPred
b
(
a'
,
numx
)
=
BS
.
breakEnd
dollarPred
a
(
num
,
x
)
=
BS
.
break
commaPred
numx
num'
=
BS
.
pack
$
show
(
read
(
BS
.
unpack
num
)
+
4
::
Int
)
fix
=
a'
`
BS
.
append
`
num'
`
BS
.
append
`
x
`
BS
.
append
`
jmp
(
num
,
x
)
=
BS
.
break
commaPred
numx
num'
=
BS
.
pack
$
show
(
read
(
BS
.
unpack
num
)
+
4
::
Int
)
fix
=
a'
`
BS
.
append
`
num'
`
BS
.
append
`
x
`
BS
.
append
`
jmp
in
if
BS
.
null
b
then
nfun
`
BS
.
append
`
a
else
if
labelJump
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment