Remove several unused methods from MiscMethods
This commit is contained in:
parent
7c91ec4652
commit
c431ea681c
4 changed files with 10 additions and 44 deletions
|
@ -416,10 +416,6 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||||
self.codegen_unit
|
self.codegen_unit
|
||||||
}
|
}
|
||||||
|
|
||||||
fn used_statics(&self) -> &RefCell<Vec<RValue<'gcc>>> {
|
|
||||||
unimplemented!();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn set_frame_pointer_type(&self, _llfn: RValue<'gcc>) {
|
fn set_frame_pointer_type(&self, _llfn: RValue<'gcc>) {
|
||||||
// TODO(antoyo)
|
// TODO(antoyo)
|
||||||
}
|
}
|
||||||
|
@ -428,10 +424,6 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||||
// TODO(antoyo)
|
// TODO(antoyo)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_used_variable(&self) {
|
|
||||||
unimplemented!();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
|
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
|
||||||
if self.get_declared_value("main").is_none() {
|
if self.get_declared_value("main").is_none() {
|
||||||
Some(self.declare_cfn("main", fn_type))
|
Some(self.declare_cfn("main", fn_type))
|
||||||
|
@ -443,14 +435,6 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compiler_used_statics(&self) -> &RefCell<Vec<RValue<'gcc>>> {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_compiler_used_variable(&self) {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'gcc, 'tcx> HasTyCtxt<'tcx> for CodegenCx<'gcc, 'tcx> {
|
impl<'gcc, 'tcx> HasTyCtxt<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||||
|
|
|
@ -19,6 +19,8 @@ use crate::context::CodegenCx;
|
||||||
use crate::llvm;
|
use crate::llvm;
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
|
|
||||||
|
use cstr::cstr;
|
||||||
|
|
||||||
use rustc_codegen_ssa::base::maybe_create_entry_wrapper;
|
use rustc_codegen_ssa::base::maybe_create_entry_wrapper;
|
||||||
use rustc_codegen_ssa::mono_item::MonoItemExt;
|
use rustc_codegen_ssa::mono_item::MonoItemExt;
|
||||||
use rustc_codegen_ssa::traits::*;
|
use rustc_codegen_ssa::traits::*;
|
||||||
|
@ -107,11 +109,14 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the llvm.used and llvm.compiler.used variables.
|
// Create the llvm.used and llvm.compiler.used variables.
|
||||||
if !cx.used_statics().borrow().is_empty() {
|
if !cx.used_statics.borrow().is_empty() {
|
||||||
cx.create_used_variable()
|
cx.create_used_variable_impl(cstr!("llvm.used"), &*cx.used_statics.borrow());
|
||||||
}
|
}
|
||||||
if !cx.compiler_used_statics().borrow().is_empty() {
|
if !cx.compiler_used_statics.borrow().is_empty() {
|
||||||
cx.create_compiler_used_variable()
|
cx.create_used_variable_impl(
|
||||||
|
cstr!("llvm.compiler.used"),
|
||||||
|
&*cx.compiler_used_statics.borrow(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run replace-all-uses-with for statics that need it. This must
|
// Run replace-all-uses-with for statics that need it. This must
|
||||||
|
|
|
@ -458,7 +458,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
|
||||||
self.coverage_cx.as_ref()
|
self.coverage_cx.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_used_variable_impl(&self, name: &'static CStr, values: &[&'ll Value]) {
|
pub(crate) fn create_used_variable_impl(&self, name: &'static CStr, values: &[&'ll Value]) {
|
||||||
let section = cstr!("llvm.metadata");
|
let section = cstr!("llvm.metadata");
|
||||||
let array = self.const_array(self.type_ptr_to(self.type_i8()), values);
|
let array = self.const_array(self.type_ptr_to(self.type_i8()), values);
|
||||||
|
|
||||||
|
@ -556,14 +556,6 @@ impl<'ll, 'tcx> MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||||
self.codegen_unit
|
self.codegen_unit
|
||||||
}
|
}
|
||||||
|
|
||||||
fn used_statics(&self) -> &RefCell<Vec<&'ll Value>> {
|
|
||||||
&self.used_statics
|
|
||||||
}
|
|
||||||
|
|
||||||
fn compiler_used_statics(&self) -> &RefCell<Vec<&'ll Value>> {
|
|
||||||
&self.compiler_used_statics
|
|
||||||
}
|
|
||||||
|
|
||||||
fn set_frame_pointer_type(&self, llfn: &'ll Value) {
|
fn set_frame_pointer_type(&self, llfn: &'ll Value) {
|
||||||
if let Some(attr) = attributes::frame_pointer_type_attr(self) {
|
if let Some(attr) = attributes::frame_pointer_type_attr(self) {
|
||||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[attr]);
|
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[attr]);
|
||||||
|
@ -577,17 +569,6 @@ impl<'ll, 'tcx> MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||||
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &attrs);
|
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_used_variable(&self) {
|
|
||||||
self.create_used_variable_impl(cstr!("llvm.used"), &*self.used_statics.borrow());
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_compiler_used_variable(&self) {
|
|
||||||
self.create_used_variable_impl(
|
|
||||||
cstr!("llvm.compiler.used"),
|
|
||||||
&*self.compiler_used_statics.borrow(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
|
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function> {
|
||||||
if self.get_declared_value("main").is_none() {
|
if self.get_declared_value("main").is_none() {
|
||||||
Some(self.declare_cfn("main", llvm::UnnamedAddr::Global, fn_type))
|
Some(self.declare_cfn("main", llvm::UnnamedAddr::Global, fn_type))
|
||||||
|
|
|
@ -15,12 +15,8 @@ pub trait MiscMethods<'tcx>: BackendTypes {
|
||||||
fn eh_personality(&self) -> Self::Value;
|
fn eh_personality(&self) -> Self::Value;
|
||||||
fn sess(&self) -> &Session;
|
fn sess(&self) -> &Session;
|
||||||
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx>;
|
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx>;
|
||||||
fn used_statics(&self) -> &RefCell<Vec<Self::Value>>;
|
|
||||||
fn compiler_used_statics(&self) -> &RefCell<Vec<Self::Value>>;
|
|
||||||
fn set_frame_pointer_type(&self, llfn: Self::Function);
|
fn set_frame_pointer_type(&self, llfn: Self::Function);
|
||||||
fn apply_target_cpu_attr(&self, llfn: Self::Function);
|
fn apply_target_cpu_attr(&self, llfn: Self::Function);
|
||||||
fn create_used_variable(&self);
|
|
||||||
fn create_compiler_used_variable(&self);
|
|
||||||
/// Declares the extern "C" main function for the entry point. Returns None if the symbol already exists.
|
/// Declares the extern "C" main function for the entry point. Returns None if the symbol already exists.
|
||||||
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function>;
|
fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue