https://github.com/heiher closed https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/erichkeane approved this pull request.
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3369,6 +3369,36 @@ static void handleSectionAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
}
}
+static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ StringRef CM;
+ StringRef Str;
+ SourceLocation LiteralLoc;
+ bool Ok = false;
+ // Check tha
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 01/10] [clang] Add per-global code model attribute
This patch adds a pe
@@ -3369,6 +3369,36 @@ static void handleSectionAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
}
}
+static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ StringRef CM;
+ StringRef Str;
+ SourceLocation LiteralLoc;
+ bool Ok = false;
+ // Check tha
heiher wrote:
@erichkeane gentle ping
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
heiher wrote:
> Overall this seems fine, thanks!
>
> But I'm not sure if reporting a more generic "the model attribute is not
> supported on this target" for non-LoongArch would be better: it doesn't give
> the false impression that the target doesn't support the specified code model.
In my o
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 1/9] [clang] Add per-global code model attribute
This patch adds a per-
@@ -3408,6 +3408,8 @@ def warn_objc_redundant_literal_use : Warning<
def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
"\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
+def err_attr_codemodel_arg : Error<"code_model '%0' is not supported on
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 1/8] [clang] Add per-global code model attribute
This patch adds a per-
https://github.com/xen0n edited https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3408,6 +3408,8 @@ def warn_objc_redundant_literal_use : Warning<
def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
"\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
+def err_attr_codemodel_arg : Error<"code_model '%0' is not supported on
https://github.com/xen0n commented:
Overall this seems fine, thanks!
But I'm not sure if reporting a more generic "the model attribute is not
supported on this target" for non-LoongArch would be better: it doesn't give
the false impression that the target doesn't support the specified code mod
@@ -3408,6 +3408,8 @@ def warn_objc_redundant_literal_use : Warning<
def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
"\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
+def err_attr_codemodel_arg : Error<"code_model '%0' is not yet supported
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 1/7] [clang] Add per-global code model attribute
This patch adds a per-
MaskRay wrote:
Add @erichkeane for the attribute change.
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3408,6 +3408,8 @@ def warn_objc_redundant_literal_use : Warning<
def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
"\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
+def err_attr_codemodel_arg : Error<"code_model '%0' is not yet supported
https://github.com/xen0n edited https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -emit-llvm -triple loongarch64 %s -o - | FileCheck %s
+
+// CHECK: @_ZL2v1 ={{.*}} global i32 0, code_model "small"
+static int v1 __attribute__((model("normal")));
+
+void use1() {
+ v1 = 1;
+}
+
+// CHECK: @v2 ={{.*}} global i32 0, code_mode
https://github.com/heiher edited https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4841,6 +4841,19 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef
MangledName, llvm::Type *Ty,
isExternallyVisible(D->getLinkageAndVisibility().getLinkage()))
GV->setSection(".cp.rodata");
+// Handle code model attribute
+if (D->hasAttr()) {
+ i
https://github.com/heiher edited https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -emit-llvm -triple loongarch64 %s -o - | FileCheck %s
+
+// CHECK: @_ZL2v1 ={{.*}} global i32 0, code_model "small"
+static int v1 __attribute__((model("normal")));
+
+void use1() {
+ v1 = 1;
+}
+
+// CHECK: @v2 ={{.*}} global i32 0, code_mode
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 1/6] [clang] Add per-global code model attribute
This patch adds a per-
https://github.com/MaskRay edited
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -4841,6 +4841,19 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef
MangledName, llvm::Type *Ty,
isExternallyVisible(D->getLinkageAndVisibility().getLinkage()))
GV->setSection(".cp.rodata");
+// Handle code model attribute
+if (D->hasAttr()) {
+ i
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -emit-llvm -triple loongarch64 %s -o - | FileCheck %s
+
+// CHECK: @_ZL2v1 ={{.*}} global i32 0, code_model "small"
+static int v1 __attribute__((model("normal")));
+
+void use1() {
+ v1 = 1;
+}
+
+// CHECK: @v2 ={{.*}} global i32 0, code_mode
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -emit-llvm -triple loongarch64 %s -o - | FileCheck %s
+
+// CHECK: @normal ={{.*}} global i32 0, code_model "small"
+int normal __attribute__((model("normal")));
+
+// CHECK: @medium ={{.*}} global i32 0, code_model "medium"
+int medium __attri
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -triple aarch64 -verify=expected,aarch64 -fsyntax-only %s
+// RUN: %clang_cc1 -triple loongarch64 -verify=expected,loongarch64
-fsyntax-only %s
+// RUN: %clang_cc1 -triple mips64 -verify=expected,mips64 -fsyntax-only %s
+// RUN: %clang_cc1 -tr
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 1/5] [clang] Add per-global code model attribute
This patch adds a per-
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -triple aarch64 -verify=expected,aarch64 -fsyntax-only %s
+// RUN: %clang_cc1 -triple loongarch64 -verify=expected,loongarch64
-fsyntax-only %s
+// RUN: %clang_cc1 -triple mips64 -verify=expected,mips64 -fsyntax-only %s
+// RUN: %clang_cc1 -tr
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -emit-llvm -triple loongarch64 %s -o - | FileCheck %s
+
+// CHECK: @normal ={{.*}} global i32 0, code_model "small"
+int normal __attribute__((model("normal")));
+
+// CHECK: @medium ={{.*}} global i32 0, code_model "medium"
+int medium __attri
@@ -57,6 +57,16 @@ global variable or function should be in after translation.
let Heading = "section, __declspec(allocate)";
}
+def CodeModelDocs : Documentation {
+ let Category = DocCatVariable;
+ let Content = [{
+The ``model`` attribute allows you to use a different c
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 1/4] [clang] Add per-global code model attribute
This patch adds a per-
@@ -57,6 +57,16 @@ global variable or function should be in after translation.
let Heading = "section, __declspec(allocate)";
}
+def CodeModelDocs : Documentation {
+ let Category = DocCatVariable;
+ let Content = [{
+The ``model`` attribute allows you to use a different c
rnk wrote:
Here's a [GCC doc
link](https://gcc.gnu.org/onlinedocs/gcc/IA-64-Variable-Attributes.html). I
think matching GCC is sufficient motivation for me, I just didn't see it
mentioned.
https://github.com/llvm/llvm-project/pull/72078
___
cfe-comm
xry111 wrote:
> is it too late to change the gcc attribute name?
It has been released in GCC 13, and GCC 14 is in stage 3 so a change must be
deferred into GCC 15. And the kernel code already relies on it. So a change
will render all previous kernel releases impossible to build with GCC 13/1
aeubanks wrote:
is it too late to change the gcc attribute name?
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
xry111 wrote:
> Do folks feel like the attribute name is sufficiently descriptive? i.e.
> should it be `__attribute__((code_model("asdf")))`? Are we aiming for GCC
> compat here? What guides the naming choice?
Yes, for GCC compat, so we don't need to add more #ifdef's in kernel.
As the author
rnk wrote:
Do folks feel like the attribute name is sufficiently descriptive? i.e. should
it be `__attribute__((code_model("asdf")))`? Are we aiming for GCC compat here?
What guides the naming choice?
https://github.com/llvm/llvm-project/pull/72078
_
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 1/3] [clang] Add per-global code model attribute
This patch adds a per-
@@ -57,6 +57,15 @@ global variable or function should be in after translation.
let Heading = "section, __declspec(allocate)";
}
+def CodeModelDocs : Documentation {
+ let Category = DocCatVariable;
+ let Content = [{
+The ``model`` attribute allows you to specify a specifi
@@ -3369,6 +3369,33 @@ static void handleSectionAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
}
}
+static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ StringRef CM;
+ StringRef Str;
+ SourceLocation LiteralLoc;
+ bool Ok = false;
+ // Check tha
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH 1/2] [clang] Add per-global code model attribute
This patch adds a per-
@@ -57,6 +57,15 @@ global variable or function should be in after translation.
let Heading = "section, __declspec(allocate)";
}
+def CodeModelDocs : Documentation {
+ let Category = DocCatVariable;
+ let Content = [{
+The ``model`` attribute allows you to specify a specifi
@@ -3369,6 +3369,33 @@ static void handleSectionAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
}
}
+static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ StringRef CM;
+ StringRef Str;
+ SourceLocation LiteralLoc;
+ bool Ok = false;
+ // Check tha
https://github.com/xen0n edited https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/xen0n commented:
There should also be a test case that shows the attribute is not supported on a
non-LoongArch target. Otherwise this mostly looks fine to me, thanks for
pushing this forward!
https://github.com/llvm/llvm-project/pull/72078
___
https://github.com/heiher edited https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From e3863873ab817dacf8680763bb42d91f005fe5ea Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH] [clang] Add per-global code model attribute
This patch adds a per-glob
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From 478cbb52d3ed3c6311389dd48c8d187cb28de18d Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH] [clang] Add per-global code model attribute
This adds a per-global cod
https://github.com/heiher ready_for_review
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From 20069f5db5e45e4884397ebda1797d2050283854 Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH] [clang] Add per-global code model attribute
This adds a per-global cod
https://github.com/heiher converted_to_draft
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/heiher ready_for_review
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/heiher edited https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From 5333233261a3563f80ed58250c40791bd44a9901 Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH] [clang] Add per-global code model attribute
This adds a per-global cod
@@ -3369,6 +3369,23 @@ static void handleSectionAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
}
}
+static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ StringRef Model;
+ SourceLocation LiteralLoc;
+ // Check that it is a string.
+ if (!S.checkSt
@@ -3369,6 +3369,23 @@ static void handleSectionAttr(Sema &S, Decl *D, const
ParsedAttr &AL) {
}
}
+static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ StringRef Model;
+ SourceLocation LiteralLoc;
+ // Check that it is a string.
+ if (!S.checkSt
heiher wrote:
cc @xen0n @xry111
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/heiher updated
https://github.com/llvm/llvm-project/pull/72078
>From 323a8f851acb085a9464b3edca1206481f2aee23 Mon Sep 17 00:00:00 2001
From: WANG Rui
Date: Fri, 10 Nov 2023 21:07:48 -0600
Subject: [PATCH] [clang] Add per-global code model attribute
This adds a per-global cod
heiher wrote:
Part 1: #72077
Part 3: #72079
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff 18415c8365047841c4671798e0129ca9bbd03c40
29c89161a55c2d7355a0d0b544044ea72348c086 --
https://github.com/heiher converted_to_draft
https://github.com/llvm/llvm-project/pull/72078
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: hev (heiher)
Changes
This adds a per-global code model attribute, which can override the target's
code model to access global variables.
Link:
https://discourse.llvm.org/t/how-to-best-implement-code-model-overriding-for-certain-values/71
https://github.com/heiher created
https://github.com/llvm/llvm-project/pull/72078
This adds a per-global code model attribute, which can override the target's
code model to access global variables.
Link:
https://discourse.llvm.org/t/how-to-best-implement-code-model-overriding-for-certain-valu
66 matches
Mail list logo