I'm not why it was added to DAGToDAG oringally but it seems
to make sense alongside the non-TLS version: LowerGlobalAddress
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@tlively IIUC this is preferable?
Some of the APIs used at this level are slightly different but I'm pretty sure this is NFC.
Side note: When looking at this code compared to the PIC symbol references in the code below its interesting to me that we directly generate the global.get for the base address rather than relying on the pattern. i.e. we use DAG.getMachineNode(GlobalGet.. rather than SDValue BaseAddr = DAG.getNode(WebAssemblyISD::Wrapper. Is this bad or something we want to avoid?
Yes, this looks better than what we had before. I think it would be generally better to use TableGen patterns rather than generating the MachineNode directly in C++.
llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp | ||
---|---|---|
126 | I think this has a lowering hook in WebAssemblyISelLowering.cpp as well and could also be moved, although that could be a follow-up patch. | |
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | ||
1315–1318 | I think the pattern used down in the next method is more readable. | |
llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td | ||
355–359 | IIUC, these aren't currently used because the lowering generates a MachineNode directly, right? |
llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td | ||
---|---|---|
355–359 | No these are used. I don't generate the Const as MachineNodes, only the global get they get added to. These two lines require these patterns: SDValue TLSOffset = DAG.getTargetGlobalAddress( GV, DL, PtrVT, GA->getOffset(), WebAssemblyII::MO_TLS_BASE_REL); SDValue SymAddr = DAG.getNode(WebAssemblyISD::Wrapper, DL, PtrVT, TLSOffset); |
I think this has a lowering hook in WebAssemblyISelLowering.cpp as well and could also be moved, although that could be a follow-up patch.