================
@@ -1933,6 +1900,34 @@ void CIRGenModule::setGVPropertiesAux(mlir::Operation
*op,
assert(!cir::MissingFeatures::opGlobalPartition());
}
+cir::TLS_Model CIRGenModule::getDefaultCIRTLSModel() const {
+ switch (getCodeGenOpts().getDefaultTLSModel()) {
+ case CodeGenOptions::GeneralDynamicTLSModel:
+ return cir::TLS_Model::GeneralDynamic;
+ case CodeGenOptions::LocalDynamicTLSModel:
+ return cir::TLS_Model::LocalDynamic;
+ case CodeGenOptions::InitialExecTLSModel:
+ return cir::TLS_Model::InitialExec;
+ case CodeGenOptions::LocalExecTLSModel:
+ return cir::TLS_Model::LocalExec;
+ }
+ llvm_unreachable("Invalid TLS model!");
+}
+
+void CIRGenModule::setTLSMode(mlir::Operation *op, const VarDecl &d) {
+ assert(d.getTLSKind() && "setting TLS mode on non-TLS var!");
+
+ cir::TLS_Model tlm = getDefaultCIRTLSModel();
+
+ // Override the TLS model if it is explicitly specified.
+ if (d.getAttr<TLSModelAttr>()) {
----------------
andykaylor wrote:
I was going to just let this go, but since this needs to be rebased anyway I'll
mention it. This shouldn't have braces since the body is a single line.
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
https://github.com/llvm/llvm-project/pull/168662
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits