2010-01-14 21:20:55 +00:00
|
|
|
//===-- llvm/MC/MCParsedAsmOperand.h - Asm Parser Operand -------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-10 00:45:19 +00:00
|
|
|
#ifndef LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
|
|
|
|
#define LLVM_MC_MCPARSER_MCPARSEDASMOPERAND_H
|
2010-01-14 21:20:55 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
2010-01-15 00:41:53 +00:00
|
|
|
class SMLoc;
|
2010-08-11 06:37:04 +00:00
|
|
|
class raw_ostream;
|
2010-01-14 21:20:55 +00:00
|
|
|
|
|
|
|
/// MCParsedAsmOperand - This abstract class represents a source-level assembly
|
|
|
|
/// instruction operand. It should be subclassed by target-specific code. This
|
|
|
|
/// base class is used by target-independent clients and is the interface
|
|
|
|
/// between parsing an asm instruction and recognizing it.
|
|
|
|
class MCParsedAsmOperand {
|
2012-10-12 22:15:11 +00:00
|
|
|
/// MCOperandNum - The corresponding MCInst operand number. Only valid when
|
|
|
|
/// parsing MS-style inline assembly.
|
|
|
|
unsigned MCOperandNum;
|
|
|
|
|
|
|
|
/// Constraint - The constraint on this operand. Only valid when parsing
|
|
|
|
/// MS-style inline assembly.
|
|
|
|
std::string Constraint;
|
|
|
|
|
2011-02-11 01:21:00 +00:00
|
|
|
public:
|
2010-01-14 21:32:45 +00:00
|
|
|
MCParsedAsmOperand() {}
|
|
|
|
virtual ~MCParsedAsmOperand() {}
|
2011-02-11 01:21:00 +00:00
|
|
|
|
2012-10-12 22:15:11 +00:00
|
|
|
void setConstraint(StringRef C) { Constraint = C.str(); }
|
|
|
|
StringRef getConstraint() { return Constraint; }
|
|
|
|
|
|
|
|
void setMCOperandNum (unsigned OpNum) { MCOperandNum = OpNum; }
|
|
|
|
unsigned getMCOperandNum() { return MCOperandNum; }
|
|
|
|
|
2013-04-09 17:53:49 +00:00
|
|
|
virtual StringRef getSymName() { return StringRef(); }
|
2014-04-24 06:44:33 +00:00
|
|
|
virtual void *getOpDecl() { return nullptr; }
|
2012-10-12 22:15:11 +00:00
|
|
|
|
2012-09-11 23:20:20 +00:00
|
|
|
/// isToken - Is this a token operand?
|
2012-09-11 23:03:44 +00:00
|
|
|
virtual bool isToken() const = 0;
|
2012-09-11 23:20:20 +00:00
|
|
|
/// isImm - Is this an immediate operand?
|
2012-09-11 23:03:44 +00:00
|
|
|
virtual bool isImm() const = 0;
|
2012-09-11 23:20:20 +00:00
|
|
|
/// isReg - Is this a register operand?
|
2012-09-11 23:03:44 +00:00
|
|
|
virtual bool isReg() const = 0;
|
2012-10-01 20:53:03 +00:00
|
|
|
virtual unsigned getReg() const = 0;
|
|
|
|
|
2012-09-11 23:20:20 +00:00
|
|
|
/// isMem - Is this a memory operand?
|
2012-09-11 23:03:44 +00:00
|
|
|
virtual bool isMem() const = 0;
|
|
|
|
|
2010-01-14 22:29:57 +00:00
|
|
|
/// getStartLoc - Get the location of the first token of this operand.
|
2010-08-11 06:37:04 +00:00
|
|
|
virtual SMLoc getStartLoc() const = 0;
|
2010-01-14 22:29:57 +00:00
|
|
|
/// getEndLoc - Get the location of the last token of this operand.
|
2010-08-11 06:37:04 +00:00
|
|
|
virtual SMLoc getEndLoc() const = 0;
|
|
|
|
|
2013-01-10 22:10:27 +00:00
|
|
|
/// needAddressOf - Do we need to emit code to get the address of the
|
|
|
|
/// variable/label? Only valid when parsing MS-style inline assembly.
|
|
|
|
virtual bool needAddressOf() const { return false; }
|
|
|
|
|
2012-10-22 19:50:35 +00:00
|
|
|
/// isOffsetOf - Do we need to emit code to get the offset of the variable,
|
|
|
|
/// rather then the value of the variable? Only valid when parsing MS-style
|
|
|
|
/// inline assembly.
|
|
|
|
virtual bool isOffsetOf() const { return false; }
|
|
|
|
|
2012-10-23 17:43:43 +00:00
|
|
|
/// getOffsetOfLoc - Get the location of the offset operator.
|
|
|
|
virtual SMLoc getOffsetOfLoc() const { return SMLoc(); }
|
|
|
|
|
2011-07-13 15:34:57 +00:00
|
|
|
/// print - Print a debug representation of the operand to the given stream.
|
|
|
|
virtual void print(raw_ostream &OS) const = 0;
|
|
|
|
/// dump - Print to the debug stream.
|
|
|
|
virtual void dump() const;
|
2010-01-14 21:20:55 +00:00
|
|
|
};
|
|
|
|
|
2011-07-13 15:34:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Debugging Support
|
|
|
|
|
|
|
|
inline raw_ostream& operator<<(raw_ostream &OS, const MCParsedAsmOperand &MO) {
|
|
|
|
MO.print(OS);
|
|
|
|
return OS;
|
|
|
|
}
|
|
|
|
|
2010-01-14 21:20:55 +00:00
|
|
|
} // end namespace llvm.
|
|
|
|
|
|
|
|
#endif
|