Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
febd6d9a
Commit
febd6d9a
authored
Feb 09, 2006
by
Simon Marlow
Browse files
x86_64: fix case of out-of-range operands to leaq
parent
eba7b660
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/compiler/nativeGen/MachCodeGen.hs
View file @
febd6d9a
...
...
@@ -1113,12 +1113,14 @@ getRegister e@(CmmMachOp mop [x, y]) -- dyadic MachOps
--------------------
add_code
::
MachRep
->
CmmExpr
->
CmmExpr
->
NatM
Register
add_code
rep
x
(
CmmLit
(
CmmInt
y
_
))
=
add_int
rep
x
y
add_code
rep
x
(
CmmLit
(
CmmInt
y
_
))
|
not
(
is64BitInteger
y
)
=
add_int
rep
x
y
add_code
rep
x
y
=
trivialCode
rep
(
ADD
rep
)
(
Just
(
ADD
rep
))
x
y
--------------------
sub_code
::
MachRep
->
CmmExpr
->
CmmExpr
->
NatM
Register
sub_code
rep
x
(
CmmLit
(
CmmInt
y
_
))
=
add_int
rep
x
(
-
y
)
sub_code
rep
x
(
CmmLit
(
CmmInt
y
_
))
|
not
(
is64BitInteger
(
-
y
))
=
add_int
rep
x
(
-
y
)
sub_code
rep
x
y
=
trivialCode
rep
(
SUB
rep
)
Nothing
x
y
-- our three-operand add instruction:
...
...
@@ -1972,13 +1974,16 @@ getRegOrMem e = do
return
(
OpReg
reg
,
code
)
#
if
x86_64_TARGET_ARCH
is64BitLit
(
CmmInt
i
I64
)
=
i
>
0x7fffffff
||
i
<
-
0x80000000
is64BitLit
(
CmmInt
i
I64
)
=
i
s64BitInteger
i
-- assume that labels are in the range 0-2^31-1: this assumes the
-- small memory model (see gcc docs, -mcmodel=small).
#
endif
is64BitLit
x
=
False
#
endif
is64BitInteger
::
Integer
->
Bool
is64BitInteger
i
=
i
>
0x7fffffff
||
i
<
-
0x80000000
-- -----------------------------------------------------------------------------
-- The 'CondCode' type: Condition codes passed up the tree.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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