MCParsedAsmOperand.h revision fde528fa2b206604bc80618af815bf5dab3fed8e
1//===-- llvm/MC/MCParsedAsmOperand.h - Asm Parser Operand -------*- 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#ifndef LLVM_MC_MCASMOPERAND_H 11#define LLVM_MC_MCASMOPERAND_H 12 13namespace llvm { 14class SMLoc; 15class raw_ostream; 16 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. 21class MCParsedAsmOperand { 22public: 23 MCParsedAsmOperand() {} 24 virtual ~MCParsedAsmOperand() {} 25 26 virtual bool isToken() const = 0; 27 virtual bool isImm() const = 0; 28 virtual bool isReg() const = 0; 29 virtual bool isMem() const = 0; 30 31 /// getStartLoc - Get the location of the first token of this operand. 32 virtual SMLoc getStartLoc() const = 0; 33 /// getEndLoc - Get the location of the last token of this operand. 34 virtual SMLoc getEndLoc() const = 0; 35 36 /// print - Print a debug representation of the operand to the given stream. 37 virtual void print(raw_ostream &OS) const = 0; 38 /// dump - Print to the debug stream. 39 virtual void dump() const; 40}; 41 42//===----------------------------------------------------------------------===// 43// Debugging Support 44 45inline raw_ostream& operator<<(raw_ostream &OS, const MCParsedAsmOperand &MO) { 46 MO.print(OS); 47 return OS; 48} 49 50} // end namespace llvm. 51 52#endif 53