Stop naming instructions with numbered names.

LLVM will number instructions if you don't provide a name, so we get %7 instead of %s7 from calling state.var_name(). LLVM doesn't assign the numbers until printing out the LLVM IR as text, which we never do in a normal run of wasmer.

If you're editing a .ll text by hand and you're worried about messing up the numbering, use `opt --instnamer` to assign autogenerated names to all numbered instructions.
This commit is contained in:
Nick Lewycky
2020-05-19 09:50:57 -07:00
parent 45a83b3239
commit ae6f0dadb2
2 changed files with 657 additions and 1193 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,6 @@ use inkwell::{
values::{BasicValue, BasicValueEnum, PhiValue}, values::{BasicValue, BasicValueEnum, PhiValue},
}; };
use smallvec::SmallVec; use smallvec::SmallVec;
use std::cell::Cell;
use std::ops::{BitAnd, BitOr, BitOrAssign}; use std::ops::{BitAnd, BitOr, BitOrAssign};
use wasmer_compiler::CompileError; use wasmer_compiler::CompileError;
@ -196,7 +195,6 @@ impl BitAnd for ExtraInfo {
pub struct State<'ctx> { pub struct State<'ctx> {
pub stack: Vec<(BasicValueEnum<'ctx>, ExtraInfo)>, pub stack: Vec<(BasicValueEnum<'ctx>, ExtraInfo)>,
control_stack: Vec<ControlFrame<'ctx>>, control_stack: Vec<ControlFrame<'ctx>>,
value_counter: Cell<usize>,
pub reachable: bool, pub reachable: bool,
} }
@ -206,7 +204,6 @@ impl<'ctx> State<'ctx> {
Self { Self {
stack: vec![], stack: vec![],
control_stack: vec![], control_stack: vec![],
value_counter: Cell::new(0),
reachable: true, reachable: true,
} }
} }
@ -270,13 +267,6 @@ impl<'ctx> State<'ctx> {
)) ))
} }
pub fn var_name(&self) -> String {
let counter = self.value_counter.get();
let s = format!("s{}", counter);
self.value_counter.set(counter + 1);
s
}
pub fn push1<T: BasicValue<'ctx>>(&mut self, value: T) { pub fn push1<T: BasicValue<'ctx>>(&mut self, value: T) {
self.push1_extra(value, Default::default()); self.push1_extra(value, Default::default());
} }