Skip to content
Snippets Groups Projects
Commit b9394bdb authored by Cheng Shao's avatar Cheng Shao
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)
parent e4f09671
No related branches found
No related tags found
No related merge requests found
......@@ -137,6 +137,11 @@ cmmMakeDynamicReference config referenceKind lbl
addImport 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
-- for data, we might have to make some calculations:
DataReference -> return $ cmmMakePicReference config lbl
......@@ -414,6 +419,11 @@ howToAccessLabel config _arch os _kind lbl
then AccessViaSymbolPtr
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
howToAccessLabel config _arch _os _kind _lbl
| 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