llvm-mc: Add some more doxyments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74607 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-07-01 15:14:50 +00:00
parent 42cdc3878e
commit 1aa14aac41

View File

@ -18,13 +18,15 @@ class MCContext;
class MCSymbol; class MCSymbol;
class MCValue; class MCValue;
/// AsmExpr - Base class for the full range of assembler expressions which are
/// needed for parsing.
class AsmExpr { class AsmExpr {
public: public:
enum AsmExprKind { enum AsmExprKind {
Binary, /// Binary expressions. Binary, ///< Binary expressions.
Constant, /// Constant expressions. Constant, ///< Constant expressions.
SymbolRef, /// References to labels and assigned expressions. SymbolRef, ///< References to labels and assigned expressions.
Unary /// Unary expressions. Unary ///< Unary expressions.
}; };
private: private:
@ -45,7 +47,7 @@ public:
bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const;
/// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable /// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable
/// value. /// value, i.e. an expression of the fixed form (a - b + constant).
/// ///
/// @param Res - The relocatable value, if evaluation succeeds. /// @param Res - The relocatable value, if evaluation succeeds.
/// @result - True on success. /// @result - True on success.
@ -54,6 +56,7 @@ public:
static bool classof(const AsmExpr *) { return true; } static bool classof(const AsmExpr *) { return true; }
}; };
//// AsmConstantExpr - Represent a constant integer expression.
class AsmConstantExpr : public AsmExpr { class AsmConstantExpr : public AsmExpr {
int64_t Value; int64_t Value;
@ -69,6 +72,12 @@ public:
static bool classof(const AsmConstantExpr *) { return true; } static bool classof(const AsmConstantExpr *) { return true; }
}; };
/// AsmSymbolRefExpr - Represent a reference to a symbol from inside an
/// expression.
///
/// A symbol reference in an expression may be a use of a label, a use of an
/// assembler variable (defined constant), or constitute an implicit definition
/// of the symbol as external.
class AsmSymbolRefExpr : public AsmExpr { class AsmSymbolRefExpr : public AsmExpr {
MCSymbol *Symbol; MCSymbol *Symbol;
@ -84,13 +93,14 @@ public:
static bool classof(const AsmSymbolRefExpr *) { return true; } static bool classof(const AsmSymbolRefExpr *) { return true; }
}; };
/// AsmUnaryExpr - Unary assembler expressions.
class AsmUnaryExpr : public AsmExpr { class AsmUnaryExpr : public AsmExpr {
public: public:
enum Opcode { enum Opcode {
LNot, /// Logical negation. LNot, ///< Logical negation.
Minus, /// Unary minus. Minus, ///< Unary minus.
Not, /// Bit-wise negation. Not, ///< Bitwise negation.
Plus /// Unary plus. Plus ///< Unary plus.
}; };
private: private:
@ -114,27 +124,28 @@ public:
static bool classof(const AsmUnaryExpr *) { return true; } static bool classof(const AsmUnaryExpr *) { return true; }
}; };
/// AsmBinaryExpr - Binary assembler expressions.
class AsmBinaryExpr : public AsmExpr { class AsmBinaryExpr : public AsmExpr {
public: public:
enum Opcode { enum Opcode {
Add, /// Addition. Add, ///< Addition.
And, /// Bitwise and. And, ///< Bitwise and.
Div, /// Division. Div, ///< Division.
EQ, /// Equality comparison. EQ, ///< Equality comparison.
GT, /// Greater than comparison. GT, ///< Greater than comparison.
GTE, /// Greater than or equal comparison. GTE, ///< Greater than or equal comparison.
LAnd, /// Logical and. LAnd, ///< Logical and.
LOr, /// Logical or. LOr, ///< Logical or.
LT, /// Less than comparison. LT, ///< Less than comparison.
LTE, /// Less than or equal comparison. LTE, ///< Less than or equal comparison.
Mod, /// Modulus. Mod, ///< Modulus.
Mul, /// Multiplication. Mul, ///< Multiplication.
NE, /// Inequality comparison. NE, ///< Inequality comparison.
Or, /// Bitwise or. Or, ///< Bitwise or.
Shl, /// Bitwise shift left. Shl, ///< Bitwise shift left.
Shr, /// Bitwise shift right. Shr, ///< Bitwise shift right.
Sub, /// Subtraction. Sub, ///< Subtraction.
Xor /// Bitwise exclusive or. Xor ///< Bitwise exclusive or.
}; };
private: private:
@ -151,7 +162,10 @@ public:
Opcode getOpcode() const { return Op; } Opcode getOpcode() const { return Op; }
/// getLHS - Get the left-hand side expression of the binary operator.
AsmExpr *getLHS() const { return LHS; } AsmExpr *getLHS() const { return LHS; }
/// getRHS - Get the right-hand side expression of the binary operator.
AsmExpr *getRHS() const { return RHS; } AsmExpr *getRHS() const { return RHS; }
static bool classof(const AsmExpr *E) { static bool classof(const AsmExpr *E) {