Skip to content
Snippets Groups Projects
Commit 752677dc authored by Cheng Shao's avatar Cheng Shao :beach: Committed by Zubin
Browse files

compiler: fix Cmm dynamic CLabels for wasm

This commit fixes the handling of dynamic CLabels for the wasm
backend. Just do the simplest handling: preserve the original CLabel,
both unreg/NCG backends can handle them properly without issue.

(cherry picked from commit 74411461)
(cherry picked from commit 76293382)
parent cb8d1184
No related branches found
No related tags found
No related merge requests found
...@@ -142,6 +142,11 @@ cmmMakeDynamicReference config referenceKind lbl ...@@ -142,6 +142,11 @@ cmmMakeDynamicReference config referenceKind lbl
addImport symbolPtr addImport symbolPtr
return $ cmmLoadBWord platform (cmmMakePicReference config symbolPtr) return $ cmmLoadBWord platform (cmmMakePicReference config symbolPtr)
-- On wasm, always preserve the original CLabel, the backends
-- will handle dynamic references properly
AccessDirectly | ArchWasm32 <- platformArch platform ->
pure $ CmmLit $ CmmLabel lbl
AccessDirectly -> case referenceKind of AccessDirectly -> case referenceKind of
-- for data, we might have to make some calculations: -- for data, we might have to make some calculations:
DataReference -> return $ cmmMakePicReference config lbl DataReference -> return $ cmmMakePicReference config lbl
...@@ -413,6 +418,11 @@ howToAccessLabel config _arch os _kind lbl ...@@ -413,6 +418,11 @@ howToAccessLabel config _arch os _kind lbl
then AccessViaSymbolPtr then AccessViaSymbolPtr
else AccessDirectly else AccessDirectly
-- On wasm, always keep the original CLabel and let the backend decide
-- how to handle dynamic references
howToAccessLabel _ ArchWasm32 _ _ _
= AccessDirectly
-- all other platforms -- all other platforms
howToAccessLabel config _arch _os _kind _lbl howToAccessLabel config _arch _os _kind _lbl
| not (ncgPIC config) | not (ncgPIC config)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment