1 //===-- llvm/MC/MCParsedAsmOperand.h - Asm Parser Operand -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_MC_MCASMOPERAND_H
11 #define LLVM_MC_MCASMOPERAND_H
17 /// MCParsedAsmOperand - This abstract class represents a source-level assembly
18 /// instruction operand. It should be subclassed by target-specific code. This
19 /// base class is used by target-independent clients and is the interface
20 /// between parsing an asm instruction and recognizing it.
21 class MCParsedAsmOperand {
23 MCParsedAsmOperand() {}
24 virtual ~MCParsedAsmOperand() {}
26 /// isToken - Is this a token operand?
27 virtual bool isToken() const = 0;
28 /// isImm - Is this an immediate operand?
29 virtual bool isImm() const = 0;
30 /// isReg - Is this a register operand?
31 virtual bool isReg() const = 0;
32 virtual unsigned getReg() const = 0;
34 /// isMem - Is this a memory operand?
35 virtual bool isMem() const = 0;
37 /// isMSAsmWildcard - Is this a wildcard operand? This is specific to
38 /// MS-style inline assembly and should never happen in normal assembly.
39 virtual bool isMSAsmWildcard() const { return false; }
41 /// setMSAsmWildcard - Convert the operand into a wildcard.
42 virtual void setMSAsmWildcard(unsigned Size) { }
44 /// getStartLoc - Get the location of the first token of this operand.
45 virtual SMLoc getStartLoc() const = 0;
46 /// getEndLoc - Get the location of the last token of this operand.
47 virtual SMLoc getEndLoc() const = 0;
49 /// print - Print a debug representation of the operand to the given stream.
50 virtual void print(raw_ostream &OS) const = 0;
51 /// dump - Print to the debug stream.
52 virtual void dump() const;
55 //===----------------------------------------------------------------------===//
58 inline raw_ostream& operator<<(raw_ostream &OS, const MCParsedAsmOperand &MO) {
63 } // end namespace llvm.