X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FllvmGen%2FLlvmMangler.hs;fp=compiler%2FllvmGen%2FLlvmMangler.hs;h=ac187e0a0d8e7082d35b34c762c44f7410e931c0;hp=7b38ed8fa27a51b929bfee36e10407640cb29659;hb=e82e703e065f00f8c4a6a39be4751b80754fd5e2;hpb=50f5c8491bfcb6b891f772e2915443dbb5078e97 diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs index 7b38ed8..ac187e0 100644 --- a/compiler/llvmGen/LlvmMangler.hs +++ b/compiler/llvmGen/LlvmMangler.hs @@ -29,7 +29,7 @@ jmpInst = B.pack "\n\tjmp" infoLen, spFix, labelStart :: Int infoLen = B.length infoSec spFix = 4 -labelStart = B.length jmpInst + 1 +labelStart = B.length jmpInst -- Search Predicates eolPred, dollarPred, commaPred :: Char -> Bool @@ -114,11 +114,13 @@ fixupStack f f' = (a', n) = B.breakEnd dollarPred a (n', x) = B.break commaPred n num = B.pack $ show $ readInt n' + spFix + -- We need to avoid processing jumps to labels, they are of the form: + -- jmp\tL..., jmp\t_f..., jmpl\t_f..., jmpl\t*%eax..., jmpl *L... + targ = B.dropWhile ((==)'*') $ B.drop 1 $ B.dropWhile ((/=)'\t') $ + B.drop labelStart c in if B.null c then f' `B.append` f - -- We need to avoid processing jumps to labels, they are of the form: - -- jmp\tL..., jmp\t_f..., jmpl\t_f..., jmpl\t*%eax... - else if B.index c labelStart == 'L' + else if B.head targ == 'L' then fixupStack b $ f' `B.append` a `B.append` l else fixupStack b $ f' `B.append` a' `B.append` num `B.append` x `B.append` l