Commit 9e460664 authored by Gabor Greif's avatar Gabor Greif 💬
Browse files

There can be several blocks in a PPC/ELF cmm proc

add FETCHPC to all of them (this fixes #7814).
parent a4433030
......@@ -710,16 +710,23 @@ initializePicBase_ppc ArchPPC os picReg
(PPC.ImmCLbl gotOffLabel)
(PPC.ImmCLbl mkPicBaseLabel)
BasicBlock bID insns
= head blocks
blocks' = case blocks of
[] -> []
(b:bs) -> fetchPC b : map maybeFetchPC bs
b' = BasicBlock bID (PPC.FETCHPC picReg
: PPC.LD PPC.archWordSize tmp
(PPC.AddrRegImm picReg offsetToOffset)
: PPC.ADD picReg picReg (PPC.RIReg tmp)
: insns)
maybeFetchPC b@(BasicBlock bID _)
| bID `mapMember` info = fetchPC b
| otherwise = b
fetchPC (BasicBlock bID insns) =
BasicBlock bID (PPC.FETCHPC picReg
: PPC.LD PPC.archWordSize tmp
(PPC.AddrRegImm picReg offsetToOffset)
: PPC.ADD picReg picReg (PPC.RIReg tmp)
: insns)
return (CmmProc info lab live (ListGraph blocks') : gotOffset : statics)
return (CmmProc info lab live (ListGraph (b' : tail blocks)) : gotOffset : statics)
initializePicBase_ppc ArchPPC OSDarwin picReg
(CmmProc info lab live (ListGraph blocks) : statics)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment