[RFC PATCH v1 08/43] include/helper-to-tcg: Introduce annotate.h

Anton Johansson via posted 43 patches 2 days, 13 hours ago
[RFC PATCH v1 08/43] include/helper-to-tcg: Introduce annotate.h
Posted by Anton Johansson via 2 days, 13 hours ago
Wrap __attribute__((annotate(str))) in a macro for convenient
function annotations.  Will be used in future commits to tag functions
for translation by helper-to-tcg, and to specify which helper function
arguments correspond to immediate or vector values.

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 include/helper-to-tcg/annotate.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 include/helper-to-tcg/annotate.h

diff --git a/include/helper-to-tcg/annotate.h b/include/helper-to-tcg/annotate.h
new file mode 100644
index 0000000000..80ecf23217
--- /dev/null
+++ b/include/helper-to-tcg/annotate.h
@@ -0,0 +1,28 @@
+/*
+ *  Copyright(c) 2024 rev.ng Labs Srl. All Rights Reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ANNOTATE_H
+#define ANNOTATE_H
+
+/* HELPER_TO_TCG can be defined when generating LLVM IR. */
+#ifdef HELPER_TO_TCG
+#define LLVM_ANNOTATE(str) __attribute__((annotate (str)))
+#else
+#define LLVM_ANNOTATE(str) /* str */
+#endif
+
+#endif /* ANNOTATE_H */
-- 
2.45.2
Re: [RFC PATCH v1 08/43] include/helper-to-tcg: Introduce annotate.h
Posted by Richard Henderson 20 hours ago
On 11/20/24 19:49, Anton Johansson wrote:
> Wrap __attribute__((annotate(str))) in a macro for convenient
> function annotations.  Will be used in future commits to tag functions
> for translation by helper-to-tcg, and to specify which helper function
> arguments correspond to immediate or vector values.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   include/helper-to-tcg/annotate.h | 28 ++++++++++++++++++++++++++++
>   1 file changed, 28 insertions(+)
>   create mode 100644 include/helper-to-tcg/annotate.h

Is this really specific to helper-to-tcg, or might it be used for something else in the 
future?  In other words, does it belong in include/qemu/compiler.h?


r~