================ @@ -3412,13 +3416,23 @@ SDValue PPCTargetLowering::LowerGlobalTLSAddressAIX(SDValue Op, return DAG.getNode(PPCISD::ADD_TLS, dl, PtrVT, TLSReg, VariableOffset); } - // Only Local-Exec, Initial-Exec and General-Dynamic TLS models are currently - // supported models. If Local- or Initial-exec are not possible or specified, - // all GlobalTLSAddress nodes are lowered using the general-dynamic model. - // We need to generate two TOC entries, one for the variable offset, one for - // the region handle. The global address for the TOC entry of the region - // handle is created with the MO_TLSGDM_FLAG flag and the global address - // for the TOC entry of the variable offset is created with MO_TLSGD_FLAG. + if (Model == TLSModel::LocalDynamic) { + // For local-dynamic on AIX, we need to generate two TOC entries, one for + // the variable offset, the other for the module handle. The module handle + // is encapsulated inside the TLSLD_AIX pseudo node, and will be expanded by + // PPCTLSDynamicCall. + SDValue VariableOffsetTGA = + DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0, PPCII::MO_TLSLD_FLAG); + SDValue VariableOffset = getTOCEntry(DAG, dl, VariableOffsetTGA); ---------------- orcguru wrote:
There is a blocker which limits FLAG bit size to be 12: ``` llvm/include/llvm/CodeGen/MachineOperand.h ... unsigned SubReg_TargetFlags : 12; ... void setTargetFlags(unsigned F) { assert(!isReg() && "Register operands can't have target flags"); SubReg_TargetFlags = F; assert(SubReg_TargetFlags == F && "Target flags out of range"); } ``` Currently PPCII::TOF is already full. I'm afraid this will be a FIXME... https://github.com/llvm/llvm-project/pull/66316 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits