X86-64: Mark WINCALL and more tail call instructions as code gen only.
[llvm.git] / tools / edis / EDOperand.h
blobad9345b758bded5290a04dd4625d07098d9a4143
1 //===-EDOperand.h - LLVM Enhanced Disassembler ------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the interface for the Enhanced Disassembly library's
11 // operand class. The operand is responsible for allowing evaluation given a
12 // particular register context.
14 //===----------------------------------------------------------------------===//
16 #ifndef EDOperand_
17 #define EDOperand_
19 #include "llvm-c/EnhancedDisassembly.h"
21 /// EDOperand - Encapsulates a single operand, which can be evaluated by the
22 /// client
23 struct EDOperand {
24 /// The parent disassembler
25 const EDDisassembler &Disassembler;
26 /// The parent instruction
27 const EDInst &Inst;
29 /// The index of the operand in the EDInst
30 unsigned int OpIndex;
31 /// The index of the first component of the operand in the MCInst
32 unsigned int MCOpIndex;
34 /// Constructor - Initializes an EDOperand
35 ///
36 /// @arg disassembler - The disassembler responsible for the operand
37 /// @arg inst - The instruction containing this operand
38 /// @arg opIndex - The index of the operand in inst
39 /// @arg mcOpIndex - The index of the operand in the original MCInst
40 EDOperand(const EDDisassembler &disassembler,
41 const EDInst &inst,
42 unsigned int opIndex,
43 unsigned int &mcOpIndex);
44 ~EDOperand();
46 /// evaluate - Returns the numeric value of an operand to the extent possible,
47 /// returning 0 on success or -1 if there was some problem (such as a
48 /// register not being readable)
49 ///
50 /// @arg result - A reference whose target is filled in with the value of
51 /// the operand (the address if it is a memory operand)
52 /// @arg callback - A function to call to obtain register values
53 /// @arg arg - An opaque argument to pass to callback
54 int evaluate(uint64_t &result,
55 EDRegisterReaderCallback callback,
56 void *arg);
58 /// isRegister - Returns 1 if the operand is a register or 0 otherwise
59 int isRegister();
60 /// regVal - Returns the register value.
61 unsigned regVal();
63 /// isImmediate - Returns 1 if the operand is an immediate or 0 otherwise
64 int isImmediate();
65 /// immediateVal - Returns the immediate value.
66 uint64_t immediateVal();
68 /// isMemory - Returns 1 if the operand is a memory location or 0 otherwise
69 int isMemory();
71 #ifdef __BLOCKS__
72 /// evaluate - Like evaluate for a callback, but uses a block instead
73 int evaluate(uint64_t &result,
74 EDRegisterBlock_t regBlock);
75 #endif
78 #endif