Put TargetIsa's emit_inst under a "testing_hooks" feature. (#531)
* Put TargetIsa's emit_inst under a "testing_hooks" feature. In practice, TargetIsa's emit_inst pulls in its own instantiation of the target-specifi `emit_inst` functions, which can be quite large, and LTO doesn't eliminate them because they're held live by TargetIsa's vtable. Fortunately, this function is only used by tests, so we can put it behind a feature flag. Fixes #530. * Add comments for `emit_inst` to clarify its purpose.
This commit is contained in:
@@ -307,6 +307,10 @@ pub trait TargetIsa: fmt::Display {
|
||||
///
|
||||
/// Note that this will call `put*` methods on the `sink` trait object via its vtable which
|
||||
/// is not the fastest way of emitting code.
|
||||
///
|
||||
/// This function is under the "testing_hooks" feature, and is only suitable for use by
|
||||
/// test harnesses. It increases code size, and is inefficient.
|
||||
#[cfg(feature = "testing_hooks")]
|
||||
fn emit_inst(
|
||||
&self,
|
||||
func: &ir::Function,
|
||||
@@ -316,7 +320,5 @@ pub trait TargetIsa: fmt::Display {
|
||||
);
|
||||
|
||||
/// Emit a whole function into memory.
|
||||
///
|
||||
/// This is more performant than calling `emit_inst` for each instruction.
|
||||
fn emit_function_to_memory(&self, func: &ir::Function, sink: &mut binemit::MemoryCodeSink);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user