|
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | 15 | use std::borrow::Cow; |
| 16 | +use std::collections::HashSet; |
16 | 17 | use std::fmt; |
17 | 18 | use std::fmt::{Debug, Display}; |
18 | 19 | // TODO : provide some way to forbid emitting register reads for certain registers |
@@ -316,3 +317,42 @@ pub enum VisitorAction { |
316 | 317 | Sibling, |
317 | 318 | Halt, |
318 | 319 | } |
| 320 | + |
| 321 | +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] |
| 322 | +pub enum ILInstructionAttribute { |
| 323 | + ILAllowDeadStoreElimination, |
| 324 | + ILPreventDeadStoreElimination, |
| 325 | + MLILAssumePossibleUse, |
| 326 | + MLILUnknownSize, |
| 327 | + SrcInstructionUsesPointerAuth, |
| 328 | + ILPreventAliasAnalysis, |
| 329 | + ILIsCFGProtected, |
| 330 | + MLILPossiblyUnusedIntermediate, |
| 331 | + HLILFoldableExpr, |
| 332 | + HLILInvertableCondition, |
| 333 | + HLILEarlyReturnPossible, |
| 334 | + HLILSwitchRecoveryPossible, |
| 335 | + ILTransparentCopy, |
| 336 | +} |
| 337 | + |
| 338 | +impl ILInstructionAttribute { |
| 339 | + pub fn value(&self) -> u32 { |
| 340 | + match self { |
| 341 | + Self::ILAllowDeadStoreElimination => 1, |
| 342 | + Self::ILPreventDeadStoreElimination => 2, |
| 343 | + Self::MLILAssumePossibleUse => 4, |
| 344 | + Self::MLILUnknownSize => 8, |
| 345 | + Self::SrcInstructionUsesPointerAuth => 16, |
| 346 | + Self::ILPreventAliasAnalysis => 32, |
| 347 | + Self::ILIsCFGProtected => 64, |
| 348 | + Self::MLILPossiblyUnusedIntermediate => 128, |
| 349 | + Self::HLILFoldableExpr => 256, |
| 350 | + Self::HLILInvertableCondition => 512, |
| 351 | + Self::HLILEarlyReturnPossible => 1024, |
| 352 | + Self::HLILSwitchRecoveryPossible => 2048, |
| 353 | + Self::ILTransparentCopy => 4096, |
| 354 | + } |
| 355 | + } |
| 356 | +} |
| 357 | + |
| 358 | +pub type ILInstructionAttributeSet = HashSet<ILInstructionAttribute>; |
0 commit comments