From c5252da873d547a19069eaf9030fec203f128f66 Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Fri, 14 Sep 2012 14:57:36 +0000 Subject: Fix Doxygen issues: * wrap code blocks in \code ... \endcode; * refer to parameter names in paragraphs correctly (\arg is not what most people want -- it starts a new paragraph); * use \param instead of \arg to document parameters in order to be consistent with the rest of the codebase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163902 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index c673a79..adc960d 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -73,15 +73,13 @@ public: /// Run - Run the parser on the input source buffer. virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0; - /// Warning - Emit a warning at the location \arg L, with the message \arg - /// Msg. + /// Warning - Emit a warning at the location \p L, with the message \p Msg. /// /// \return The return value is true, if warnings are fatal. virtual bool Warning(SMLoc L, const Twine &Msg, ArrayRef Ranges = ArrayRef()) = 0; - /// Error - Emit an error at the location \arg L, with the message \arg - /// Msg. + /// Error - Emit an error at the location \p L, with the message \p Msg. /// /// \return The return value is always true, as an idiomatic convenience to /// clients. @@ -100,7 +98,7 @@ public: ArrayRef Ranges = ArrayRef()); /// ParseIdentifier - Parse an identifier or string (as a quoted identifier) - /// and set \arg Res to the identifier contents. + /// and set \p Res to the identifier contents. virtual bool ParseIdentifier(StringRef &Res) = 0; /// \brief Parse up to the end of statement and return the contents from the -- cgit v1.1 From 84125ca43c758fd21fdab2b05196e0df57c55c96 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Sat, 13 Oct 2012 00:26:04 +0000 Subject: [ms-inline asm] Remove the MatchInstruction() function. Previously, this was the interface between the front-end and the MC layer when parsing inline assembly. Unfortunately, this is too deep into the parsing stack. Specifically, we're unable to handle target-independent assembly (i.e., assembly directives, labels, etc.). Note the MatchAndEmitInstruction() isn't the correct abstraction either. I'll be exposing target-independent hooks shortly, so this is really just a cleanup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165858 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index adc960d..a572e6d 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -73,6 +73,8 @@ public: /// Run - Run the parser on the input source buffer. virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0; + virtual void setParsingInlineAsm(bool V) = 0; + /// Warning - Emit a warning at the location \p L, with the message \p Msg. /// /// \return The return value is true, if warnings are fatal. -- cgit v1.1 From 8f138d1121730007f973131ca79a06a58f981011 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Mon, 15 Oct 2012 17:19:13 +0000 Subject: [ms-inline asm] Add a few new APIs to the AsmParser class in support of MS-Style inline assembly. For the time being, these will be called directly by clang. However, in the near future I expect these to be sunk back into the MC layer and more basic APIs (e.g., getClobbers(), getConstraints(), etc.) will be called by clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165946 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index a572e6d..08758cd 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -20,6 +20,7 @@ class MCAsmLexer; class MCAsmParserExtension; class MCContext; class MCExpr; +class MCParsedAsmOperand; class MCStreamer; class MCTargetAsmParser; class SMLoc; @@ -75,6 +76,25 @@ public: virtual void setParsingInlineAsm(bool V) = 0; + /// ParseStatement - Parse the next statement. + virtual bool ParseStatement() = 0; + + /// getNumParsedOperands - Returns the number of MCAsmParsedOperands from the + /// previously parsed statement. + virtual unsigned getNumParsedOperands() = 0; + + /// getParsedOperand - Get a MCAsmParsedOperand. + virtual MCParsedAsmOperand &getParsedOperand(unsigned OpNum) = 0; + + /// freeParsedOperands - Free the MCAsmParsedOperands. + virtual void freeParsedOperands() = 0; + + /// isInstruction - Was the previously parsed statement an instruction? + virtual bool isInstruction() = 0; + + /// getOpcode - Get the opcode from the previously parsed instruction. + virtual unsigned getOpcode() = 0; + /// Warning - Emit a warning at the location \p L, with the message \p Msg. /// /// \return The return value is true, if warnings are fatal. -- cgit v1.1 From c5ac87d067861309fb461b9c53f9e429fbe0d067 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Tue, 16 Oct 2012 20:16:20 +0000 Subject: [ms-inline asm] Add the helper function, isParseringInlineAsm(). To be used in a future commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166054 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index 08758cd..52948f7 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -75,6 +75,7 @@ public: virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0; virtual void setParsingInlineAsm(bool V) = 0; + virtual bool isParsingInlineAsm() = 0; /// ParseStatement - Parse the next statement. virtual bool ParseStatement() = 0; -- cgit v1.1 From b1f8c139c5c1b1a50bf65b8141dd57434c793e54 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 18 Oct 2012 15:49:34 +0000 Subject: [ms-inline asm] Move most of the AsmParsing logic in clang back into the MC layer. Add the ParseMSInlineAsm() function, which is the new interface to clang. Also expose the new MCAsmParserSemaCallback interface, which is used by the back-end to do name lookup in Sema. Finally, remove the now defunct APIs introduced in r165946. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166183 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index 52948f7..ea20c15 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -20,6 +20,8 @@ class MCAsmLexer; class MCAsmParserExtension; class MCContext; class MCExpr; +class MCInstPrinter; +class MCInstrInfo; class MCParsedAsmOperand; class MCStreamer; class MCTargetAsmParser; @@ -29,6 +31,13 @@ class SourceMgr; class StringRef; class Twine; +/// MCAsmParserSemaCallback - Generic Sema callback for assembly parser. +class MCAsmParserSemaCallback { +public: + virtual void *LookupInlineAsmIdentifier(StringRef Name, void *Loc, + void **IdentifierInfoPtr) = 0; +}; + /// MCAsmParser - Generic assembler parser interface, for use by target specific /// assembly parsers. class MCAsmParser { @@ -77,25 +86,20 @@ public: virtual void setParsingInlineAsm(bool V) = 0; virtual bool isParsingInlineAsm() = 0; + /// ParseMSInlineAsm - Parse ms-style inline assembly. + virtual bool ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, + unsigned &NumOutputs, unsigned &NumInputs, + SmallVectorImpl &Names, + SmallVectorImpl &Constraints, + SmallVectorImpl &Exprs, + SmallVectorImpl &Clobbers, + const MCInstrInfo *MII, + const MCInstPrinter *IP, + MCAsmParserSemaCallback &SI) = 0; + /// ParseStatement - Parse the next statement. virtual bool ParseStatement() = 0; - /// getNumParsedOperands - Returns the number of MCAsmParsedOperands from the - /// previously parsed statement. - virtual unsigned getNumParsedOperands() = 0; - - /// getParsedOperand - Get a MCAsmParsedOperand. - virtual MCParsedAsmOperand &getParsedOperand(unsigned OpNum) = 0; - - /// freeParsedOperands - Free the MCAsmParsedOperands. - virtual void freeParsedOperands() = 0; - - /// isInstruction - Was the previously parsed statement an instruction? - virtual bool isInstruction() = 0; - - /// getOpcode - Get the opcode from the previously parsed instruction. - virtual unsigned getOpcode() = 0; - /// Warning - Emit a warning at the location \p L, with the message \p Msg. /// /// \return The return value is true, if warnings are fatal. -- cgit v1.1 From c8dd27e58301af85979facf291b817802d3523e5 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 18 Oct 2012 19:39:30 +0000 Subject: [ms-inline asm] Have the LookupInlineAsmIdentifier() callback function return a *NamedDecl. In turn, build the expressions after we're finished parsing the asm. This avoids a crasher if the lookup fails. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166212 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index ea20c15..bb71a46 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -34,8 +34,7 @@ class Twine; /// MCAsmParserSemaCallback - Generic Sema callback for assembly parser. class MCAsmParserSemaCallback { public: - virtual void *LookupInlineAsmIdentifier(StringRef Name, void *Loc, - void **IdentifierInfoPtr) = 0; + virtual void *LookupInlineAsmIdentifier(StringRef Name, void *Loc) = 0; }; /// MCAsmParser - Generic assembler parser interface, for use by target specific @@ -89,9 +88,8 @@ public: /// ParseMSInlineAsm - Parse ms-style inline assembly. virtual bool ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, - SmallVectorImpl &Names, + SmallVectorImpl &OpDecls, SmallVectorImpl &Constraints, - SmallVectorImpl &Exprs, SmallVectorImpl &Clobbers, const MCInstrInfo *MII, const MCInstPrinter *IP, -- cgit v1.1 From 3298959540ca744ec16b4c65db244534a929a862 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 18 Oct 2012 20:27:15 +0000 Subject: [ms-inline asm] Add a size argument to the LookupInlineAsmIdentifier() callback, which will be used by the asm matcher in the near future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166222 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index bb71a46..554cdfa 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -34,7 +34,8 @@ class Twine; /// MCAsmParserSemaCallback - Generic Sema callback for assembly parser. class MCAsmParserSemaCallback { public: - virtual void *LookupInlineAsmIdentifier(StringRef Name, void *Loc) = 0; + virtual void *LookupInlineAsmIdentifier(StringRef Name, void *Loc, + unsigned &Size) = 0; }; /// MCAsmParser - Generic assembler parser interface, for use by target specific -- cgit v1.1 From 0d7d11d57f81d2318a730d7599bbdaa67a721150 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 19 Oct 2012 07:00:09 +0000 Subject: Pacify -Wnon-virtual-dtor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166270 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index 554cdfa..fcf5b6a 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -34,6 +34,7 @@ class Twine; /// MCAsmParserSemaCallback - Generic Sema callback for assembly parser. class MCAsmParserSemaCallback { public: + virtual ~MCAsmParserSemaCallback(); virtual void *LookupInlineAsmIdentifier(StringRef Name, void *Loc, unsigned &Size) = 0; }; -- cgit v1.1 From 2128aaebd850edc0415ab8f37b907077651d4399 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 22 Oct 2012 23:58:19 +0000 Subject: [ms-inline-asm] Implement _emit directive (which is roughly equivalent to .byte). . git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166451 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index fcf5b6a..fe7bda0 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -97,9 +97,6 @@ public: const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) = 0; - /// ParseStatement - Parse the next statement. - virtual bool ParseStatement() = 0; - /// Warning - Emit a warning at the location \p L, with the message \p Msg. /// /// \return The return value is true, if warnings are fatal. -- cgit v1.1 From 5a719fcb5ea91ec4e7af6fc2e48ec31774a859dd Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Tue, 23 Oct 2012 17:43:43 +0000 Subject: [ms-inline asm] Add an implementation of the offset operator. This is a follow on patch to r166433. rdar://12470317 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166488 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index fe7bda0..8a5f37c 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -90,7 +90,7 @@ public: /// ParseMSInlineAsm - Parse ms-style inline assembly. virtual bool ParseMSInlineAsm(void *AsmLoc, std::string &AsmString, unsigned &NumOutputs, unsigned &NumInputs, - SmallVectorImpl &OpDecls, + SmallVectorImpl > &OpDecls, SmallVectorImpl &Constraints, SmallVectorImpl &Clobbers, const MCInstrInfo *MII, -- cgit v1.1 From ec13022c392747ef166e6be738fc6f00bd7c52d3 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Thu, 25 Oct 2012 21:51:10 +0000 Subject: [ms-inline asm] Perform field lookups with the dot operator. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166724 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index 8a5f37c..a71d3c3 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -37,6 +37,8 @@ public: virtual ~MCAsmParserSemaCallback(); virtual void *LookupInlineAsmIdentifier(StringRef Name, void *Loc, unsigned &Size) = 0; + virtual bool LookupInlineAsmField(StringRef Base, StringRef Member, + unsigned &Offset) = 0; }; /// MCAsmParser - Generic assembler parser interface, for use by target specific -- cgit v1.1 From 255f89faee13dc491cb64fbeae3c763e7e2ea4e6 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 3 Dec 2012 17:02:12 +0000 Subject: Sort the #include lines for the include/... tree with the script. AKA: Recompile *ALL* the source code! This one went much better. No manual edits here. I spot-checked for silliness and grep-checked for really broken edits and everything seemed good. It all still compiles. Yell if you see something that looks goofy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169133 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCParser/MCAsmParser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/llvm/MC/MCParser/MCAsmParser.h') diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index a71d3c3..b9490fa 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -10,8 +10,8 @@ #ifndef LLVM_MC_MCASMPARSER_H #define LLVM_MC_MCASMPARSER_H -#include "llvm/Support/DataTypes.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/DataTypes.h" namespace llvm { class AsmToken; -- cgit v1.1