MC: Tidy up formatting a bit. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238799 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach committed 2015-06-01 23:55:02 +00:00
1 parent 3ba7d326d5
commit 574635710f
3 files changed
+47 -48

No files matched your search

+10 -11
View File
@@ -32,12 +32,12 @@ class MCInst;
/// This is a simple discriminated union. /// This is a simple discriminated union.
class MCOperand { class MCOperand {
enum MachineOperandType : unsigned char { enum MachineOperandType : unsigned char {
kInvalid, ///< Uninitialized. kInvalid, ///< Uninitialized.
kRegister, ///< Register operand. kRegister, ///< Register operand.
kImmediate, ///< Immediate operand. kImmediate, ///< Immediate operand.
kFPImmediate, ///< Floating-point immediate operand. kFPImmediate, ///< Floating-point immediate operand.
kExpr, ///< Relocatable immediate operand. kExpr, ///< Relocatable immediate operand.
kInst ///< Sub-instruction operand. kInst ///< Sub-instruction operand.
}; };
MachineOperandType Kind; MachineOperandType Kind;
@@ -48,8 +48,8 @@ class MCOperand {
const MCExpr *ExprVal; const MCExpr *ExprVal;
const MCInst *InstVal; const MCInst *InstVal;
}; };
public:
public:
MCOperand() : Kind(kInvalid), FPImmVal(0.0) {} MCOperand() : Kind(kInvalid), FPImmVal(0.0) {}
bool isValid() const { return Kind != kInvalid; } bool isValid() const { return Kind != kInvalid; }
@@ -151,6 +151,7 @@ class MCInst {
unsigned Opcode; unsigned Opcode;
SMLoc Loc; SMLoc Loc;
SmallVector<MCOperand, 8> Operands; SmallVector<MCOperand, 8> Operands;
public: public:
MCInst() : Opcode(0) {} MCInst() : Opcode(0) {}
@@ -164,9 +165,7 @@ public:
MCOperand &getOperand(unsigned i) { return Operands[i]; } MCOperand &getOperand(unsigned i) { return Operands[i]; }
unsigned getNumOperands() const { return Operands.size(); } unsigned getNumOperands() const { return Operands.size(); }
void addOperand(const MCOperand &Op) { void addOperand(const MCOperand &Op) { Operands.push_back(Op); }
Operands.push_back(Op);
}
void clear() { Operands.clear(); } void clear() { Operands.clear(); }
size_t size() const { return Operands.size(); } size_t size() const { return Operands.size(); }
@@ -175,7 +174,7 @@ public:
typedef SmallVectorImpl<MCOperand>::const_iterator const_iterator; typedef SmallVectorImpl<MCOperand>::const_iterator const_iterator;
iterator begin() { return Operands.begin(); } iterator begin() { return Operands.begin(); }
const_iterator begin() const { return Operands.begin(); } const_iterator begin() const { return Operands.begin(); }
iterator end() { return Operands.end(); } iterator end() { return Operands.end(); }
const_iterator end() const { return Operands.end(); } const_iterator end() const { return Operands.end(); }
iterator insert(iterator I, const MCOperand &Op) { iterator insert(iterator I, const MCOperand &Op) {
return Operands.insert(I, Op); return Operands.insert(I, Op);
+9 -9
View File
@@ -27,10 +27,10 @@ class StringRef;
void dumpBytes(ArrayRef<uint8_t> Bytes, raw_ostream &OS); void dumpBytes(ArrayRef<uint8_t> Bytes, raw_ostream &OS);
namespace HexStyle { namespace HexStyle {
enum Style { enum Style {
C, ///< 0xff C, ///< 0xff
Asm ///< 0ffh Asm ///< 0ffh
}; };
} }
/// \brief This is an instance of a target assembly language printer that /// \brief This is an instance of a target assembly language printer that
@@ -56,12 +56,12 @@ protected:
/// Utility function for printing annotations. /// Utility function for printing annotations.
void printAnnotation(raw_ostream &OS, StringRef Annot); void printAnnotation(raw_ostream &OS, StringRef Annot);
public: public:
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii,
const MCRegisterInfo &mri) const MCRegisterInfo &mri)
: CommentStream(nullptr), MAI(mai), MII(mii), MRI(mri), : CommentStream(nullptr), MAI(mai), MII(mii), MRI(mri), UseMarkup(0),
UseMarkup(0), PrintImmHex(0), PrintImmHex(0), PrintHexStyle(HexStyle::C) {}
PrintHexStyle(HexStyle::C) {}
virtual ~MCInstPrinter(); virtual ~MCInstPrinter();
@@ -69,8 +69,8 @@ public:
void setCommentStream(raw_ostream &OS) { CommentStream = &OS; } void setCommentStream(raw_ostream &OS) { CommentStream = &OS; }
/// \brief Print the specified MCInst to the specified raw_ostream. /// \brief Print the specified MCInst to the specified raw_ostream.
virtual void printInst(const MCInst *MI, raw_ostream &OS, virtual void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot,
StringRef Annot, const MCSubtargetInfo &STI) = 0; const MCSubtargetInfo &STI) = 0;
/// \brief Return the name of the specified opcode enum (e.g. "MOV32ri") or /// \brief Return the name of the specified opcode enum (e.g. "MOV32ri") or
/// empty if we can't resolve it. /// empty if we can't resolve it.
+28 -28
View File
@@ -17,41 +17,41 @@
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"
namespace llvm { namespace llvm {
class MCContext; class MCContext;
class raw_ostream; class raw_ostream;
/// \brief Instances of this class represent a label name in the MC file, /// \brief Instances of this class represent a label name in the MC file,
/// and MCLabel are created and uniqued by the MCContext class. MCLabel /// and MCLabel are created and uniqued by the MCContext class. MCLabel
/// should only be constructed for valid instances in the object file. /// should only be constructed for valid instances in the object file.
class MCLabel { class MCLabel {
// \brief The instance number of this Directional Local Label. // \brief The instance number of this Directional Local Label.
unsigned Instance; unsigned Instance;
private: // MCContext creates and uniques these. private: // MCContext creates and uniques these.
friend class MCContext; friend class MCContext;
MCLabel(unsigned instance) MCLabel(unsigned instance) : Instance(instance) {}
: Instance(instance) {}
MCLabel(const MCLabel&) = delete; MCLabel(const MCLabel &) = delete;
void operator=(const MCLabel&) = delete; void operator=(const MCLabel &) = delete;
public:
/// \brief Get the current instance of this Directional Local Label.
unsigned getInstance() const { return Instance; }
/// \brief Increment the current instance of this Directional Local Label. public:
unsigned incInstance() { return ++Instance; } /// \brief Get the current instance of this Directional Local Label.
unsigned getInstance() const { return Instance; }
/// \brief Print the value to the stream \p OS. /// \brief Increment the current instance of this Directional Local Label.
void print(raw_ostream &OS) const; unsigned incInstance() { return ++Instance; }
/// \brief Print the value to stderr. /// \brief Print the value to the stream \p OS.
void dump() const; void print(raw_ostream &OS) const;
};
inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) { /// \brief Print the value to stderr.
Label.print(OS); void dump() const;
return OS; };
}
inline raw_ostream &operator<<(raw_ostream &OS, const MCLabel &Label) {
Label.print(OS);
return OS;
}
} // end namespace llvm } // end namespace llvm
#endif #endif