/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ namespace dnSpy.Contracts.Disassembly { /// /// A variable (argument or local) in a function /// public readonly struct X86Variable { /// /// Name or null /// public string? Name { get; } /// /// Argument/local index or < 0 /// public int Index { get; } /// /// true if it's a local variable /// public bool IsLocal { get; } /// /// true if it's an argument /// public bool IsArgument => !IsLocal; /// /// Start address in the code where this variable is live /// public ulong LiveAddress { get; } /// /// Length of the live range /// public uint LiveLength { get; } /// /// Variable location kind /// public X86VariableLocationKind LocationKind { get; } /// /// Register or memory base register /// public X86Register Register { get; } /// /// Offset relative to if it's a memory location () /// public int MemoryOffset { get; } /// /// Constructor /// /// Name or null /// Argument/local index or < 0 /// true if it's a local, false if it's an argument /// Start address in the code where this variable is live /// Length of the live range /// Variable kind /// Register or memory base register /// Offset relative to if it's a memory location () public X86Variable(string? name, int index, bool isLocal, ulong liveAddress, uint liveLength, X86VariableLocationKind locationKind, X86Register register, int memoryOffset) { Name = name; Index = index; IsLocal = isLocal; LiveAddress = liveAddress; LiveLength = liveLength; LocationKind = locationKind; Register = register; MemoryOffset = memoryOffset; } } /// /// Variable location kind /// public enum X86VariableLocationKind { /// /// The variable is stored somewhere else /// Other, /// /// The variable is stored in a register /// Register, /// /// The variable is stored in a memory location (register + offset) /// Memory, } }