From d9f952948e7f17a13b6068818238e66cf9ff7e2b Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Fri, 7 Aug 2009 22:46:00 +0000 Subject: Added Mac OS X assembler style conditional assembly. I may come back and see if I can clean this up a bit more and do way with the TheCondState and just use the top element on the TheCondStack if not empty. Also may tweak the code around ParseConditionalAssemblyDirectives() to simplify the AsmParser code. llvm-svn: 78423 --- llvm/tools/llvm-mc/AsmParser.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'llvm/tools/llvm-mc/AsmParser.h') diff --git a/llvm/tools/llvm-mc/AsmParser.h b/llvm/tools/llvm-mc/AsmParser.h index 7a4c8322e5c..c6f6f63e482 100644 --- a/llvm/tools/llvm-mc/AsmParser.h +++ b/llvm/tools/llvm-mc/AsmParser.h @@ -14,12 +14,15 @@ #ifndef ASMPARSER_H #define ASMPARSER_H +#include #include "AsmLexer.h" +#include "AsmCond.h" #include "llvm/MC/MCAsmParser.h" #include "llvm/MC/MCStreamer.h" namespace llvm { class AsmExpr; +class AsmCond; class MCContext; class MCInst; class MCStreamer; @@ -33,7 +36,10 @@ private: MCContext &Ctx; MCStreamer &Out; TargetAsmParser *TargetParser; - + + AsmCond TheCondState; + std::vector TheCondStack; + public: AsmParser(SourceMgr &_SM, MCContext &_Ctx, MCStreamer &_Out) : Lexer(_SM), Ctx(_Ctx), Out(_Out), TargetParser(0) {} @@ -67,6 +73,8 @@ private: bool TokError(const char *Msg); + bool ParseConditionalAssemblyDirectives(StringRef Directive, + SMLoc DirectiveLoc); void EatToEndOfStatement(); bool ParseAssignment(const StringRef &Name, bool IsDotSet); @@ -118,6 +126,12 @@ private: bool ParseDirectiveAbort(); // ".abort" bool ParseDirectiveInclude(); // ".include" + + bool ParseDirectiveIf(SMLoc DirectiveLoc); // ".if" + bool ParseDirectiveElseIf(SMLoc DirectiveLoc); // ".elseif" + bool ParseDirectiveElse(SMLoc DirectiveLoc); // ".else" + bool ParseDirectiveEndIf(SMLoc DirectiveLoc); // .endif + }; } // end namespace llvm -- cgit v1.2.3