diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-08-24 17:20:57 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2023-01-31 14:16:49 +0100 |
commit | 86743891a6e9eb6a927dc0201c0306a98ec8ebad (patch) | |
tree | 68896da7ed9835c6547ff6b53ccf98e90f7c74ad /gcc/rust/rust-gcc.cc | |
parent | ff8a56950776dae4fbae6b42eb79b9798dad76e3 (diff) | |
download | gcc-86743891a6e9eb6a927dc0201c0306a98ec8ebad.zip gcc-86743891a6e9eb6a927dc0201c0306a98ec8ebad.tar.gz gcc-86743891a6e9eb6a927dc0201c0306a98ec8ebad.tar.bz2 |
gccrs: backend: Expose Bvariable class through rust-gcc header
gcc/rust/ChangeLog:
* rust-gcc.cc (class Bvariable): Move class to `rust-gcc.h` header.
* rust-gcc.h: New file.
Diffstat (limited to 'gcc/rust/rust-gcc.cc')
-rw-r--r-- | gcc/rust/rust-gcc.cc | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index e3331d6..82b2d33 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -50,38 +50,10 @@ #include "rust-linemap.h" #include "rust-backend.h" #include "rust-object-export.h" +#include "rust-gcc.h" #include "backend/rust-tree.h" -// TODO: this will have to be significantly modified to work with Rust - -// Bvariable is a bit more complicated, because of zero-sized types. -// The GNU linker does not permit dynamic variables with zero size. -// When we see such a variable, we generate a version of the type with -// non-zero size. However, when referring to the global variable, we -// want an expression of zero size; otherwise, if, say, the global -// variable is passed to a function, we will be passing a -// non-zero-sized value to a zero-sized value, which can lead to a -// miscompilation. - -class Bvariable -{ -public: - Bvariable (tree t) : t_ (t), orig_type_ (NULL) {} - - Bvariable (tree t, tree orig_type) : t_ (t), orig_type_ (orig_type) {} - - // Get the tree for use as an expression. - tree get_tree (Location) const; - - // Get the actual decl; - tree get_decl () const { return this->t_; } - -private: - tree t_; - tree orig_type_; -}; - // Get the tree of a variable for use as an expression. If this is a // zero-sized global, create an expression that refers to the decl but // has zero size. |