aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-02-10 15:52:37 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-02-10 15:52:37 +0000
commite49dd22fc233f3b7b7dcca4bd1ba2e7ea6dea71c (patch)
tree865177df733ea597f487d7728f21e117b0966bdb
parent859732e4d167dfe83b29cebc757f21ba2c342f33 (diff)
downloadgcc-e49dd22fc233f3b7b7dcca4bd1ba2e7ea6dea71c.zip
gcc-e49dd22fc233f3b7b7dcca4bd1ba2e7ea6dea71c.tar.gz
gcc-e49dd22fc233f3b7b7dcca4bd1ba2e7ea6dea71c.tar.bz2
Remove unsued functions in the GCC wrapper
-rw-r--r--gcc/rust/rust-backend.h113
-rw-r--r--gcc/rust/rust-gcc.cc221
2 files changed, 0 insertions, 334 deletions
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h
index 7d28892..ca41575 100644
--- a/gcc/rust/rust-backend.h
+++ b/gcc/rust/rust-backend.h
@@ -491,119 +491,6 @@ public:
Location location, tree *pstatement)
= 0;
- // Create an implicit variable that is compiler-defined. This is
- // used when generating GC data and roots, when storing the values
- // of a slice constructor, and for the zero value of types. This returns a
- // Bvariable because it corresponds to an initialized variable in C.
- //
- // NAME is the name to use for the initialized variable this will create.
- //
- // ASM_NAME is encoded assembler-friendly version of the name, or the
- // empty string if no encoding is needed.
- //
- // TYPE is the type of the implicit variable.
- //
- // IS_HIDDEN will be true if the descriptor should only be visible
- // within the current object.
- //
- // IS_CONSTANT is true if the implicit variable should be treated like it is
- // immutable. For slice initializers, if the values must be copied to the
- // heap, the variable IS_CONSTANT.
- //
- // IS_COMMON is true if the implicit variable should
- // be treated as a common variable (multiple definitions with
- // different sizes permitted in different object files, all merged
- // into the largest definition at link time); this will be true for
- // the zero value. IS_HIDDEN and IS_COMMON will never both be true.
- //
- // If ALIGNMENT is not zero, it is the desired alignment of the variable.
- virtual Bvariable *implicit_variable (const std::string &name,
- const std::string &asm_name, tree type,
- bool is_hidden, bool is_constant,
- bool is_common, int64_t alignment)
- = 0;
-
- // Set the initial value of a variable created by implicit_variable.
- // This must be called even if there is no initializer, i.e., INIT is NULL.
- // The NAME, TYPE, IS_HIDDEN, IS_CONSTANT, and IS_COMMON parameters are
- // the same ones passed to implicit_variable. INIT will be a composite
- // literal of type TYPE. It will not contain any function calls or anything
- // else that can not be put into a read-only data section.
- // It may contain the address of variables created by implicit_variable.
- //
- // If IS_COMMON is true, INIT will be NULL, and the
- // variable should be initialized to all zeros.
- virtual void implicit_variable_set_init (Bvariable *, const std::string &name,
- tree type, bool is_hidden,
- bool is_constant, bool is_common,
- tree init)
- = 0;
-
- // Create a reference to a named implicit variable defined in some
- // other package. This will be a variable created by a call to
- // implicit_variable with the same NAME, ASM_NAME and TYPE and with
- // IS_COMMON passed as false. This corresponds to an extern global
- // variable in C.
- virtual Bvariable *implicit_variable_reference (const std::string &name,
- const std::string &asm_name,
- tree type)
- = 0;
-
- // Create a named immutable initialized data structure. This is
- // used for type descriptors, map descriptors, and function
- // descriptors. This returns a Bvariable because it corresponds to
- // an initialized const variable in C.
- //
- // NAME is the name to use for the initialized global variable which
- // this call will create.
- //
- // ASM_NAME is the encoded, assembler-friendly version of NAME, or
- // the empty string if no encoding is needed.
- //
- // IS_HIDDEN will be true if the descriptor should only be visible
- // within the current object.
- //
- // IS_COMMON is true if NAME may be defined by several packages, and
- // the linker should merge all such definitions. If IS_COMMON is
- // false, NAME should be defined in only one file. In general
- // IS_COMMON will be true for the type descriptor of an unnamed type
- // or a builtin type. IS_HIDDEN and IS_COMMON will never both be
- // true.
- //
- // TYPE will be a struct type; the type of the returned expression
- // must be a pointer to this struct type.
- //
- // We must create the named structure before we know its
- // initializer, because the initializer may refer to its own
- // address. After calling this the frontend will call
- // immutable_struct_set_init.
- virtual Bvariable *
- immutable_struct (const std::string &name, const std::string &asm_name,
- bool is_hidden, bool is_common, tree type, Location)
- = 0;
-
- // Set the initial value of a variable created by immutable_struct.
- // The NAME, IS_HIDDEN, IS_COMMON, TYPE, and location parameters are
- // the same ones passed to immutable_struct. INITIALIZER will be a
- // composite literal of type TYPE. It will not contain any function
- // calls or anything else that can not be put into a read-only data
- // section. It may contain the address of variables created by
- // immutable_struct.
- virtual void immutable_struct_set_init (Bvariable *, const std::string &name,
- bool is_hidden, bool is_common,
- tree type, Location, tree initializer)
- = 0;
-
- // Create a reference to a named immutable initialized data
- // structure defined in some other package. This will be a
- // structure created by a call to immutable_struct with the same
- // NAME, ASM_NAME and TYPE and with IS_COMMON passed as false. This
- // corresponds to an extern const global variable in C.
- virtual Bvariable *immutable_struct_reference (const std::string &name,
- const std::string &asm_name,
- tree type, Location)
- = 0;
-
// Labels.
// Create a new label. NAME will be empty if this is a label
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index d83dd4d..22a1df6 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -321,24 +321,6 @@ public:
Bvariable *temporary_variable (tree, tree, tree, tree, bool, Location,
tree *);
- Bvariable *implicit_variable (const std::string &, const std::string &, tree,
- bool, bool, bool, int64_t);
-
- void implicit_variable_set_init (Bvariable *, const std::string &, tree, bool,
- bool, bool, tree);
-
- Bvariable *implicit_variable_reference (const std::string &,
- const std::string &, tree);
-
- Bvariable *immutable_struct (const std::string &, const std::string &, bool,
- bool, tree, Location);
-
- void immutable_struct_set_init (Bvariable *, const std::string &, bool, bool,
- tree, Location, tree);
-
- Bvariable *immutable_struct_reference (const std::string &,
- const std::string &, tree, Location);
-
// Labels.
tree label (tree, const std::string &name, Location);
@@ -2620,209 +2602,6 @@ Gcc_backend::temporary_variable (tree fndecl, tree bind_tree, tree type_tree,
return new Bvariable (var);
}
-// Create an implicit variable that is compiler-defined. This is used when
-// generating GC root variables and storing the values of a slice initializer.
-
-Bvariable *
-Gcc_backend::implicit_variable (const std::string &name,
- const std::string &asm_name, tree type_tree,
- bool is_hidden, bool is_constant,
- bool is_common, int64_t alignment)
-{
- if (type_tree == error_mark_node)
- return this->error_variable ();
-
- tree decl = build_decl (BUILTINS_LOCATION, VAR_DECL,
- get_identifier_from_string (name), type_tree);
- DECL_EXTERNAL (decl) = 0;
- TREE_PUBLIC (decl) = !is_hidden;
- TREE_STATIC (decl) = 1;
- TREE_USED (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- if (is_common)
- {
- DECL_COMMON (decl) = 1;
-
- // When the initializer for one implicit_variable refers to another,
- // it needs to know the visibility of the referenced struct so that
- // compute_reloc_for_constant will return the right value. On many
- // systems calling make_decl_one_only will mark the decl as weak,
- // which will change the return value of compute_reloc_for_constant.
- // We can't reliably call make_decl_one_only yet, because we don't
- // yet know the initializer. This issue doesn't arise in C because
- // Rust initializers, unlike C initializers, can be indirectly
- // recursive. To ensure that compute_reloc_for_constant computes
- // the right value if some other initializer refers to this one, we
- // mark this symbol as weak here. We undo that below in
- // immutable_struct_set_init before calling mark_decl_one_only.
- DECL_WEAK (decl) = 1;
- }
- if (is_constant)
- {
- TREE_READONLY (decl) = 1;
- TREE_CONSTANT (decl) = 1;
- }
- if (alignment != 0)
- {
- SET_DECL_ALIGN (decl, alignment * BITS_PER_UNIT);
- DECL_USER_ALIGN (decl) = 1;
- }
- if (!asm_name.empty ())
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier_from_string (asm_name));
-
- rust_preserve_from_gc (decl);
- return new Bvariable (decl);
-}
-
-// Set the initalizer for a variable created by implicit_variable.
-// This is where we finish compiling the variable.
-
-void
-Gcc_backend::implicit_variable_set_init (Bvariable *var, const std::string &,
- tree, bool, bool, bool is_common,
- tree init_tree)
-{
- tree decl = var->get_decl ();
- if (decl == error_mark_node || init_tree == error_mark_node)
- return;
-
- DECL_INITIAL (decl) = init_tree;
-
- // Now that DECL_INITIAL is set, we can't call make_decl_one_only.
- // See the comment where DECL_WEAK is set in implicit_variable.
- if (is_common)
- {
- DECL_WEAK (decl) = 0;
- make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
- }
-
- resolve_unique_section (decl, 2, 1);
-
- rest_of_decl_compilation (decl, 1, 0);
-}
-
-// Return a reference to an implicit variable defined in another package.
-
-Bvariable *
-Gcc_backend::implicit_variable_reference (const std::string &name,
- const std::string &asm_name,
- tree type_tree)
-{
- if (type_tree == error_mark_node)
- return this->error_variable ();
-
- tree decl = build_decl (BUILTINS_LOCATION, VAR_DECL,
- get_identifier_from_string (name), type_tree);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- TREE_STATIC (decl) = 0;
- DECL_ARTIFICIAL (decl) = 1;
- if (!asm_name.empty ())
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier_from_string (asm_name));
- rust_preserve_from_gc (decl);
- return new Bvariable (decl);
-}
-
-// Create a named immutable initialized data structure.
-
-Bvariable *
-Gcc_backend::immutable_struct (const std::string &name,
- const std::string &asm_name, bool is_hidden,
- bool is_common, tree type_tree,
- Location location)
-{
- if (type_tree == error_mark_node)
- return this->error_variable ();
- gcc_assert (TREE_CODE (type_tree) == RECORD_TYPE);
- tree decl = build_decl (location.gcc_location (), VAR_DECL,
- get_identifier_from_string (name),
- build_qualified_type (type_tree, TYPE_QUAL_CONST));
- TREE_STATIC (decl) = 1;
- TREE_USED (decl) = 1;
- TREE_READONLY (decl) = 1;
- TREE_CONSTANT (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- if (!is_hidden)
- TREE_PUBLIC (decl) = 1;
- if (!asm_name.empty ())
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier_from_string (asm_name));
-
- // When the initializer for one immutable_struct refers to another,
- // it needs to know the visibility of the referenced struct so that
- // compute_reloc_for_constant will return the right value. On many
- // systems calling make_decl_one_only will mark the decl as weak,
- // which will change the return value of compute_reloc_for_constant.
- // We can't reliably call make_decl_one_only yet, because we don't
- // yet know the initializer. This issue doesn't arise in C because
- // Rust initializers, unlike C initializers, can be indirectly
- // recursive. To ensure that compute_reloc_for_constant computes
- // the right value if some other initializer refers to this one, we
- // mark this symbol as weak here. We undo that below in
- // immutable_struct_set_init before calling mark_decl_one_only.
- if (is_common)
- DECL_WEAK (decl) = 1;
-
- // We don't call rest_of_decl_compilation until we have the
- // initializer.
-
- rust_preserve_from_gc (decl);
- return new Bvariable (decl);
-}
-
-// Set the initializer for a variable created by immutable_struct.
-// This is where we finish compiling the variable.
-
-void
-Gcc_backend::immutable_struct_set_init (Bvariable *var, const std::string &,
- bool, bool is_common, tree, Location,
- tree init_tree)
-{
- tree decl = var->get_decl ();
- if (decl == error_mark_node || init_tree == error_mark_node)
- return;
-
- DECL_INITIAL (decl) = init_tree;
-
- // Now that DECL_INITIAL is set, we can't call make_decl_one_only.
- // See the comment where DECL_WEAK is set in immutable_struct.
- if (is_common)
- {
- DECL_WEAK (decl) = 0;
- make_decl_one_only (decl, DECL_ASSEMBLER_NAME (decl));
- }
-
- // These variables are often unneeded in the final program, so put
- // them in their own section so that linker GC can discard them.
- resolve_unique_section (decl, compute_reloc_for_constant (init_tree), 1);
-
- rest_of_decl_compilation (decl, 1, 0);
-}
-
-// Return a reference to an immutable initialized data structure
-// defined in another package.
-
-Bvariable *
-Gcc_backend::immutable_struct_reference (const std::string &name,
- const std::string &asm_name,
- tree type_tree, Location location)
-{
- if (type_tree == error_mark_node)
- return this->error_variable ();
- gcc_assert (TREE_CODE (type_tree) == RECORD_TYPE);
- tree decl = build_decl (location.gcc_location (), VAR_DECL,
- get_identifier_from_string (name),
- build_qualified_type (type_tree, TYPE_QUAL_CONST));
- TREE_READONLY (decl) = 1;
- TREE_CONSTANT (decl) = 1;
- DECL_ARTIFICIAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
- DECL_EXTERNAL (decl) = 1;
- if (!asm_name.empty ())
- SET_DECL_ASSEMBLER_NAME (decl, get_identifier_from_string (asm_name));
- rust_preserve_from_gc (decl);
- return new Bvariable (decl);
-}
-
// Make a label.
tree