Initial enablment of EMULTLS on RiscV
authordrahn <drahn@openbsd.org>
Fri, 14 May 2021 01:15:54 +0000 (01:15 +0000)
committerdrahn <drahn@openbsd.org>
Fri, 14 May 2021 01:15:54 +0000 (01:15 +0000)
Uncertain if this is 100% correct, however this enables self hosting
using clang.

gnu/llvm/llvm/lib/Target/RISCV/RISCVISelLowering.cpp

index 03d9eef..17f06ab 100644 (file)
@@ -634,6 +634,10 @@ SDValue RISCVTargetLowering::getDynamicTLSAddr(GlobalAddressSDNode *N,
 
 SDValue RISCVTargetLowering::lowerGlobalTLSAddress(SDValue Op,
                                                    SelectionDAG &DAG) const {
+  const GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(Op);
+  if (DAG.getTarget().useEmulatedTLS())
+    return LowerToTLSEmulatedModel(GA, DAG);
+
   SDLoc DL(Op);
   EVT Ty = Op.getValueType();
   GlobalAddressSDNode *N = cast<GlobalAddressSDNode>(Op);