aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-20 18:55:04 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-20 18:55:04 +0000
commit4b0f4eff1fd931c782ea277b15c389dc34079c0c (patch)
tree12a7fc0c9734320b9a29dfe69613b04a4b435dc5 /include
parentda30a366b6420e99d8879657e2eb4367b9c75dae (diff)
downloadexternal_llvm-4b0f4eff1fd931c782ea277b15c389dc34079c0c.zip
external_llvm-4b0f4eff1fd931c782ea277b15c389dc34079c0c.tar.gz
external_llvm-4b0f4eff1fd931c782ea277b15c389dc34079c0c.tar.bz2
Add MCAsmParser interface.
- This provides the AsmParser interface to the target specific assembly parsers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/MC/MCAsmParser.h33
-rw-r--r--include/llvm/Target/TargetAsmParser.h17
2 files changed, 50 insertions, 0 deletions
diff --git a/include/llvm/MC/MCAsmParser.h b/include/llvm/MC/MCAsmParser.h
new file mode 100644
index 0000000..2379f21
--- /dev/null
+++ b/include/llvm/MC/MCAsmParser.h
@@ -0,0 +1,33 @@
+//===-- llvm/MC/MCAsmParser.h - Abstract Asm Parser Interface ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCASMPARSER_H
+#define LLVM_MC_MCASMPARSER_H
+
+namespace llvm {
+class MCAsmParser;
+class MCInst;
+class Target;
+class TargetAsmParser;
+
+/// MCAsmParser - Generic assembler parser interface, for use by target specific
+/// assembly parsers.
+class MCAsmParser {
+ MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT
+ void operator=(const MCAsmParser &); // DO NOT IMPLEMENT
+protected: // Can only create subclasses.
+ MCAsmParser();
+
+public:
+ virtual ~MCAsmParser();
+};
+
+} // End llvm namespace
+
+#endif
diff --git a/include/llvm/Target/TargetAsmParser.h b/include/llvm/Target/TargetAsmParser.h
index bf96bf7..c179991 100644
--- a/include/llvm/Target/TargetAsmParser.h
+++ b/include/llvm/Target/TargetAsmParser.h
@@ -11,6 +11,8 @@
#define LLVM_TARGET_TARGETPARSER_H
namespace llvm {
+class MCAsmParser;
+class MCInst;
class Target;
/// TargetAsmParser - Generic interface to target specific assembly parsers.
@@ -27,6 +29,21 @@ public:
virtual ~TargetAsmParser();
const Target &getTarget() const { return TheTarget; }
+
+ /// ParseInstruction - Parse one assembly instruction.
+ ///
+ /// The parser is positioned following the instruction name. The target
+ /// specific instruction parser should parse the entire instruction and
+ /// construct the appropriate MCInst, or emit an error. On success, the entire
+ /// line should be parsed up to and including the end-of-statement token. On
+ /// failure, the parser is not required to read to the end of the line.
+ //
+ /// \param AP - The current parser object.
+ /// \param Name - The instruction name.
+ /// \param Inst [out] - On success, the parsed instruction.
+ /// \return True on failure.
+ virtual bool ParseInstruction(MCAsmParser &AP, const char *Name,
+ MCInst &Inst) = 0;
};
} // End llvm namespace