|
14 | 14 |
|
15 | 15 | use std::borrow::Cow; |
16 | 16 | use std::fmt; |
17 | | -use std::fmt::{Display, Formatter}; |
| 17 | +use std::fmt::{Debug, Display}; |
18 | 18 | // TODO : provide some way to forbid emitting register reads for certain registers |
19 | 19 | // also writing for certain registers (e.g. zero register must prohibit il.set_reg and il.reg |
20 | 20 | // (replace with nop or const(0) respectively) |
@@ -83,15 +83,15 @@ impl LowLevelILTempRegister { |
83 | 83 | } |
84 | 84 | } |
85 | 85 |
|
86 | | -impl fmt::Debug for LowLevelILTempRegister { |
87 | | - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 86 | +impl Debug for LowLevelILTempRegister { |
| 87 | + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
88 | 88 | write!(f, "temp{}", self.temp_id) |
89 | 89 | } |
90 | 90 | } |
91 | 91 |
|
92 | | -impl fmt::Display for LowLevelILTempRegister { |
93 | | - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { |
94 | | - fmt::Debug::fmt(self, f) |
| 92 | +impl Display for LowLevelILTempRegister { |
| 93 | + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 94 | + Debug::fmt(self, f) |
95 | 95 | } |
96 | 96 | } |
97 | 97 |
|
@@ -148,18 +148,21 @@ impl<R: ArchReg> LowLevelILRegisterKind<R> { |
148 | 148 | } |
149 | 149 | } |
150 | 150 |
|
151 | | -impl<R: ArchReg> fmt::Debug for LowLevelILRegisterKind<R> { |
152 | | - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 151 | +impl<R: ArchReg> Debug for LowLevelILRegisterKind<R> { |
| 152 | + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
153 | 153 | match *self { |
154 | 154 | LowLevelILRegisterKind::Arch(ref r) => r.fmt(f), |
155 | | - LowLevelILRegisterKind::Temp(ref id) => fmt::Debug::fmt(id, f), |
| 155 | + LowLevelILRegisterKind::Temp(ref id) => Debug::fmt(id, f), |
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
159 | 159 |
|
160 | | -impl<R: ArchReg> fmt::Display for LowLevelILRegisterKind<R> { |
161 | | - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { |
162 | | - fmt::Debug::fmt(self, f) |
| 160 | +impl<R: ArchReg> Display for LowLevelILRegisterKind<R> { |
| 161 | + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 162 | + match *self { |
| 163 | + LowLevelILRegisterKind::Arch(ref r) => write!(f, "{}", r.name()), |
| 164 | + LowLevelILRegisterKind::Temp(ref id) => Display::fmt(id, f), |
| 165 | + } |
163 | 166 | } |
164 | 167 | } |
165 | 168 |
|
@@ -191,7 +194,7 @@ impl<R: ArchReg> LowLevelILSSARegister<R> { |
191 | 194 | } |
192 | 195 |
|
193 | 196 | impl<R: ArchReg> Display for LowLevelILSSARegister<R> { |
194 | | - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { |
| 197 | + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
195 | 198 | write!(f, "{}#{}", self.reg, self.version) |
196 | 199 | } |
197 | 200 | } |
|
0 commit comments