aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-mangle.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-10-21 14:01:04 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2022-12-13 14:00:07 +0100
commit15f04af347e3b65f436808077cbac4fa566019f9 (patch)
tree32ec5a4c2ca65044848cb37137c1074ed63f5401 /gcc/rust/backend/rust-mangle.h
parent509e4c32c6a80ede6c6dda0f4cfc96f94d24c4d6 (diff)
downloadgcc-15f04af347e3b65f436808077cbac4fa566019f9.zip
gcc-15f04af347e3b65f436808077cbac4fa566019f9.tar.gz
gcc-15f04af347e3b65f436808077cbac4fa566019f9.tar.bz2
gccrs: Add base for HIR to GCC GENERIC lowering
This pass walks the HIR crate and turns them into GCC `tree`s. We do not have any Rust specific tree's. We are slowly removing the backend abstraction which was ported over from gccgo in favour of using `tree`s directly. gcc/rust/ * backend/rust-builtins.h: New. * backend/rust-compile-base.cc: New. * backend/rust-compile-base.h: New. * backend/rust-mangle.cc: New. * backend/rust-mangle.h: New. * backend/rust-tree.cc: New. * backend/rust-tree.h: New. * rust-backend.h: New. * rust-gcc.cc: New. Co-authored-by: David Faust <david.faust@oracle.com>
Diffstat (limited to 'gcc/rust/backend/rust-mangle.h')
-rw-r--r--gcc/rust/backend/rust-mangle.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-mangle.h b/gcc/rust/backend/rust-mangle.h
new file mode 100644
index 0000000..6d5a64f
--- /dev/null
+++ b/gcc/rust/backend/rust-mangle.h
@@ -0,0 +1,52 @@
+// This file is part of GCC.
+
+// GCC 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 3, or (at your option) any later
+// version.
+
+// GCC 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 GCC; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef RUST_MANGLE_H
+#define RUST_MANGLE_H
+
+#include "rust-system.h"
+#include "rust-tyty.h"
+
+namespace Rust {
+namespace Compile {
+
+class Mangler
+{
+public:
+ enum MangleVersion
+ {
+ // Values defined in rust/lang.opt
+ LEGACY = 0,
+ V0 = 1,
+ };
+
+ // this needs to support Legacy and V0 see github #429 or #305
+ std::string mangle_item (const TyTy::BaseType *ty,
+ const Resolver::CanonicalPath &path) const;
+
+ static void set_mangling (int frust_mangling_value)
+ {
+ version = static_cast<MangleVersion> (frust_mangling_value);
+ }
+
+private:
+ static enum MangleVersion version;
+};
+
+} // namespace Compile
+} // namespace Rust
+
+#endif // RUST_MANGLE_H