llvm.org GIT mirror llvm / 94b9550
Rename TargetAsmParser to MCTargetAsmParser and TargetAsmLexer to MCTargetAsmLexer; rename createAsmLexer to createMCAsmLexer and createAsmParser to createMCAsmParser. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136027 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 8 years ago
40 changed file(s) with 437 addition(s) and 437 deletion(s). Raw diff Collapse all Expand all
3535 // Real values.
3636 Real,
3737
38 // Register values (stored in IntVal). Only used by TargetAsmLexer.
38 // Register values (stored in IntVal). Only used by MCTargetAsmLexer.
3939 Register,
4040
4141 // No-value.
1919 class MCContext;
2020 class MCExpr;
2121 class MCStreamer;
22 class MCTargetAsmParser;
2223 class SMLoc;
2324 class SourceMgr;
2425 class StringRef;
2526 class Target;
26 class TargetAsmParser;
2727 class Twine;
2828
2929 /// MCAsmParser - Generic assembler parser interface, for use by target specific
3636 MCAsmParser(const MCAsmParser &); // DO NOT IMPLEMENT
3737 void operator=(const MCAsmParser &); // DO NOT IMPLEMENT
3838
39 TargetAsmParser *TargetParser;
39 MCTargetAsmParser *TargetParser;
4040
4141 unsigned ShowParsedOperands : 1;
4242
5959 /// getStreamer - Return the output streamer for the assembler.
6060 virtual MCStreamer &getStreamer() = 0;
6161
62 TargetAsmParser &getTargetParser() const { return *TargetParser; }
63 void setTargetParser(TargetAsmParser &P);
62 MCTargetAsmParser &getTargetParser() const { return *TargetParser; }
63 void setTargetParser(MCTargetAsmParser &P);
6464
6565 bool getShowParsedOperands() const { return ShowParsedOperands; }
6666 void setShowParsedOperands(bool Value) { ShowParsedOperands = Value; }
0 //===-- llvm/MC/MCTargetAsmLexer.h - Target Assembly Lexer ------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_MC_MCTARGETASMLEXER_H
10 #define LLVM_MC_MCTARGETASMLEXER_H
11
12 #include "llvm/MC/MCParser/MCAsmLexer.h"
13
14 namespace llvm {
15 class Target;
16
17 /// MCTargetAsmLexer - Generic interface to target specific assembly lexers.
18 class MCTargetAsmLexer {
19 /// The current token
20 AsmToken CurTok;
21
22 /// The location and description of the current error
23 SMLoc ErrLoc;
24 std::string Err;
25
26 MCTargetAsmLexer(const MCTargetAsmLexer &); // DO NOT IMPLEMENT
27 void operator=(const MCTargetAsmLexer &); // DO NOT IMPLEMENT
28 protected: // Can only create subclasses.
29 MCTargetAsmLexer(const Target &);
30
31 virtual AsmToken LexToken() = 0;
32
33 void SetError(const SMLoc &errLoc, const std::string &err) {
34 ErrLoc = errLoc;
35 Err = err;
36 }
37
38 /// TheTarget - The Target that this machine was created for.
39 const Target &TheTarget;
40 MCAsmLexer *Lexer;
41
42 public:
43 virtual ~MCTargetAsmLexer();
44
45 const Target &getTarget() const { return TheTarget; }
46
47 /// InstallLexer - Set the lexer to get tokens from lower-level lexer \arg L.
48 void InstallLexer(MCAsmLexer &L) {
49 Lexer = &L;
50 }
51
52 MCAsmLexer *getLexer() {
53 return Lexer;
54 }
55
56 /// Lex - Consume the next token from the input stream and return it.
57 const AsmToken &Lex() {
58 return CurTok = LexToken();
59 }
60
61 /// getTok - Get the current (last) lexed token.
62 const AsmToken &getTok() {
63 return CurTok;
64 }
65
66 /// getErrLoc - Get the current error location
67 const SMLoc &getErrLoc() {
68 return ErrLoc;
69 }
70
71 /// getErr - Get the current error string
72 const std::string &getErr() {
73 return Err;
74 }
75
76 /// getKind - Get the kind of current token.
77 AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
78
79 /// is - Check if the current token has kind \arg K.
80 bool is(AsmToken::TokenKind K) const { return CurTok.is(K); }
81
82 /// isNot - Check if the current token has kind \arg K.
83 bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); }
84 };
85
86 } // End llvm namespace
87
88 #endif
0 //===-- llvm/MC/MCTargetAsmParser.h - Target Assembly Parser ----*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_MC_TARGETPARSER_H
10 #define LLVM_MC_TARGETPARSER_H
11
12 #include "llvm/MC/MCParser/MCAsmParserExtension.h"
13
14 namespace llvm {
15 class MCStreamer;
16 class StringRef;
17 class SMLoc;
18 class AsmToken;
19 class MCParsedAsmOperand;
20 template class SmallVectorImpl;
21
22 /// MCTargetAsmParser - Generic interface to target specific assembly parsers.
23 class MCTargetAsmParser : public MCAsmParserExtension {
24 MCTargetAsmParser(const MCTargetAsmParser &); // DO NOT IMPLEMENT
25 void operator=(const MCTargetAsmParser &); // DO NOT IMPLEMENT
26 protected: // Can only create subclasses.
27 MCTargetAsmParser();
28
29 /// AvailableFeatures - The current set of available features.
30 unsigned AvailableFeatures;
31
32 public:
33 virtual ~MCTargetAsmParser();
34
35 unsigned getAvailableFeatures() const { return AvailableFeatures; }
36 void setAvailableFeatures(unsigned Value) { AvailableFeatures = Value; }
37
38 virtual bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
39 SMLoc &EndLoc) = 0;
40
41 /// ParseInstruction - Parse one assembly instruction.
42 ///
43 /// The parser is positioned following the instruction name. The target
44 /// specific instruction parser should parse the entire instruction and
45 /// construct the appropriate MCInst, or emit an error. On success, the entire
46 /// line should be parsed up to and including the end-of-statement token. On
47 /// failure, the parser is not required to read to the end of the line.
48 //
49 /// \param Name - The instruction name.
50 /// \param NameLoc - The source location of the name.
51 /// \param Operands [out] - The list of parsed operands, this returns
52 /// ownership of them to the caller.
53 /// \return True on failure.
54 virtual bool ParseInstruction(StringRef Name, SMLoc NameLoc,
55 SmallVectorImpl &Operands) = 0;
56
57 /// ParseDirective - Parse a target specific assembler directive
58 ///
59 /// The parser is positioned following the directive name. The target
60 /// specific directive parser should parse the entire directive doing or
61 /// recording any target specific work, or return true and do nothing if the
62 /// directive is not target specific. If the directive is specific for
63 /// the target, the entire line is parsed up to and including the
64 /// end-of-statement token and false is returned.
65 ///
66 /// \param DirectiveID - the identifier token of the directive.
67 virtual bool ParseDirective(AsmToken DirectiveID) = 0;
68
69 /// MatchAndEmitInstruction - Recognize a series of operands of a parsed
70 /// instruction as an actual MCInst and emit it to the specified MCStreamer.
71 /// This returns false on success and returns true on failure to match.
72 ///
73 /// On failure, the target parser is responsible for emitting a diagnostic
74 /// explaining the match failure.
75 virtual bool
76 MatchAndEmitInstruction(SMLoc IDLoc,
77 SmallVectorImpl &Operands,
78 MCStreamer &Out) = 0;
79
80 };
81
82 } // End llvm namespace
83
84 #endif
+0
-89
include/llvm/MC/TargetAsmLexer.h less more
None //===-- llvm/Target/TargetAsmLexer.h - Target Assembly Lexer ----*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_MC_TARGETASMLEXER_H
10 #define LLVM_MC_TARGETASMLEXER_H
11
12 #include "llvm/MC/MCParser/MCAsmLexer.h"
13
14 namespace llvm {
15 class Target;
16
17 /// TargetAsmLexer - Generic interface to target specific assembly lexers.
18 class TargetAsmLexer {
19 /// The current token
20 AsmToken CurTok;
21
22 /// The location and description of the current error
23 SMLoc ErrLoc;
24 std::string Err;
25
26 TargetAsmLexer(const TargetAsmLexer &); // DO NOT IMPLEMENT
27 void operator=(const TargetAsmLexer &); // DO NOT IMPLEMENT
28 protected: // Can only create subclasses.
29 TargetAsmLexer(const Target &);
30
31 virtual AsmToken LexToken() = 0;
32
33 void SetError(const SMLoc &errLoc, const std::string &err) {
34 ErrLoc = errLoc;
35 Err = err;
36 }
37
38 /// TheTarget - The Target that this machine was created for.
39 const Target &TheTarget;
40 MCAsmLexer *Lexer;
41
42 public:
43 virtual ~TargetAsmLexer();
44
45 const Target &getTarget() const { return TheTarget; }
46
47 /// InstallLexer - Set the lexer to get tokens from lower-level lexer \arg L.
48 void InstallLexer(MCAsmLexer &L) {
49 Lexer = &L;
50 }
51
52 MCAsmLexer *getLexer() {
53 return Lexer;
54 }
55
56 /// Lex - Consume the next token from the input stream and return it.
57 const AsmToken &Lex() {
58 return CurTok = LexToken();
59 }
60
61 /// getTok - Get the current (last) lexed token.
62 const AsmToken &getTok() {
63 return CurTok;
64 }
65
66 /// getErrLoc - Get the current error location
67 const SMLoc &getErrLoc() {
68 return ErrLoc;
69 }
70
71 /// getErr - Get the current error string
72 const std::string &getErr() {
73 return Err;
74 }
75
76 /// getKind - Get the kind of current token.
77 AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
78
79 /// is - Check if the current token has kind \arg K.
80 bool is(AsmToken::TokenKind K) const { return CurTok.is(K); }
81
82 /// isNot - Check if the current token has kind \arg K.
83 bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); }
84 };
85
86 } // End llvm namespace
87
88 #endif
+0
-85
include/llvm/MC/TargetAsmParser.h less more
None //===-- llvm/Target/TargetAsmParser.h - Target Assembly Parser --*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_MC_TARGETPARSER_H
10 #define LLVM_MC_TARGETPARSER_H
11
12 #include "llvm/MC/MCParser/MCAsmParserExtension.h"
13
14 namespace llvm {
15 class MCStreamer;
16 class StringRef;
17 class SMLoc;
18 class AsmToken;
19 class MCParsedAsmOperand;
20 template class SmallVectorImpl;
21
22 /// TargetAsmParser - Generic interface to target specific assembly parsers.
23 class TargetAsmParser : public MCAsmParserExtension {
24 TargetAsmParser(const TargetAsmParser &); // DO NOT IMPLEMENT
25 void operator=(const TargetAsmParser &); // DO NOT IMPLEMENT
26 protected: // Can only create subclasses.
27 TargetAsmParser();
28
29 /// AvailableFeatures - The current set of available features.
30 unsigned AvailableFeatures;
31
32 public:
33 virtual ~TargetAsmParser();
34
35 unsigned getAvailableFeatures() const { return AvailableFeatures; }
36 void setAvailableFeatures(unsigned Value) { AvailableFeatures = Value; }
37
38 virtual bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc,
39 SMLoc &EndLoc) = 0;
40
41 /// ParseInstruction - Parse one assembly instruction.
42 ///
43 /// The parser is positioned following the instruction name. The target
44 /// specific instruction parser should parse the entire instruction and
45 /// construct the appropriate MCInst, or emit an error. On success, the entire
46 /// line should be parsed up to and including the end-of-statement token. On
47 /// failure, the parser is not required to read to the end of the line.
48 //
49 /// \param Name - The instruction name.
50 /// \param NameLoc - The source location of the name.
51 /// \param Operands [out] - The list of parsed operands, this returns
52 /// ownership of them to the caller.
53 /// \return True on failure.
54 virtual bool ParseInstruction(StringRef Name, SMLoc NameLoc,
55 SmallVectorImpl &Operands) = 0;
56
57 /// ParseDirective - Parse a target specific assembler directive
58 ///
59 /// The parser is positioned following the directive name. The target
60 /// specific directive parser should parse the entire directive doing or
61 /// recording any target specific work, or return true and do nothing if the
62 /// directive is not target specific. If the directive is specific for
63 /// the target, the entire line is parsed up to and including the
64 /// end-of-statement token and false is returned.
65 ///
66 /// \param DirectiveID - the identifier token of the directive.
67 virtual bool ParseDirective(AsmToken DirectiveID) = 0;
68
69 /// MatchAndEmitInstruction - Recognize a series of operands of a parsed
70 /// instruction as an actual MCInst and emit it to the specified MCStreamer.
71 /// This returns false on success and returns true on failure to match.
72 ///
73 /// On failure, the target parser is responsible for emitting a diagnostic
74 /// explaining the match failure.
75 virtual bool
76 MatchAndEmitInstruction(SMLoc IDLoc,
77 SmallVectorImpl &Operands,
78 MCStreamer &Out) = 0;
79
80 };
81
82 } // End llvm namespace
83
84 #endif
2727 class AsmPrinter;
2828 class Module;
2929 class MCAssembler;
30 class MCAsmBackend;
3031 class MCAsmInfo;
3132 class MCAsmParser;
3233 class MCCodeEmitter;
34 class MCCodeGenInfo;
3335 class MCContext;
3436 class MCDisassembler;
3537 class MCInstPrinter;
3739 class MCRegisterInfo;
3840 class MCStreamer;
3941 class MCSubtargetInfo;
40 class MCCodeGenInfo;
41 class MCAsmBackend;
42 class TargetAsmLexer;
43 class TargetAsmParser;
42 class MCTargetAsmLexer;
43 class MCTargetAsmParser;
4444 class TargetMachine;
4545 class raw_ostream;
4646 class formatted_raw_ostream;
8686 typedef AsmPrinter *(*AsmPrinterCtorTy)(TargetMachine &TM,
8787 MCStreamer &Streamer);
8888 typedef MCAsmBackend *(*MCAsmBackendCtorTy)(const Target &T, StringRef TT);
89 typedef TargetAsmLexer *(*AsmLexerCtorTy)(const Target &T,
90 const MCRegisterInfo &MRI,
91 const MCAsmInfo &MAI);
92 typedef TargetAsmParser *(*AsmParserCtorTy)(MCSubtargetInfo &STI,
93 MCAsmParser &P);
89 typedef MCTargetAsmLexer *(*MCAsmLexerCtorTy)(const Target &T,
90 const MCRegisterInfo &MRI,
91 const MCAsmInfo &MAI);
92 typedef MCTargetAsmParser *(*MCAsmParserCtorTy)(MCSubtargetInfo &STI,
93 MCAsmParser &P);
9494 typedef MCDisassembler *(*MCDisassemblerCtorTy)(const Target &T);
9595 typedef MCInstPrinter *(*MCInstPrinterCtorTy)(const Target &T,
9696 unsigned SyntaxVariant,
162162 /// MCAsmBackend, if registered.
163163 MCAsmBackendCtorTy MCAsmBackendCtorFn;
164164
165 /// AsmLexerCtorFn - Construction function for this target's TargetAsmLexer,
166 /// if registered.
167 AsmLexerCtorTy AsmLexerCtorFn;
168
169 /// AsmParserCtorFn - Construction function for this target's
170 /// TargetAsmParser, if registered.
171 AsmParserCtorTy AsmParserCtorFn;
165 /// MCAsmLexerCtorFn - Construction function for this target's
166 /// MCTargetAsmLexer, if registered.
167 MCAsmLexerCtorTy MCAsmLexerCtorFn;
168
169 /// MCAsmParserCtorFn - Construction function for this target's
170 /// MCTargetAsmParser, if registered.
171 MCAsmParserCtorTy MCAsmParserCtorFn;
172172
173173 /// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
174174 /// if registered.
222222 /// hasMCAsmBackend - Check if this target supports .o generation.
223223 bool hasMCAsmBackend() const { return MCAsmBackendCtorFn != 0; }
224224
225 /// hasAsmLexer - Check if this target supports .s lexing.
226 bool hasAsmLexer() const { return AsmLexerCtorFn != 0; }
225 /// hasMCAsmLexer - Check if this target supports .s lexing.
226 bool hasMCAsmLexer() const { return MCAsmLexerCtorFn != 0; }
227227
228228 /// hasAsmParser - Check if this target supports .s parsing.
229 bool hasAsmParser() const { return AsmParserCtorFn != 0; }
229 bool hasMCAsmParser() const { return MCAsmParserCtorFn != 0; }
230230
231231 /// hasAsmPrinter - Check if this target supports .s printing.
232232 bool hasAsmPrinter() const { return AsmPrinterCtorFn != 0; }
330330 return MCAsmBackendCtorFn(*this, Triple);
331331 }
332332
333 /// createAsmLexer - Create a target specific assembly lexer.
334 ///
335 TargetAsmLexer *createAsmLexer(const MCRegisterInfo &MRI,
336 const MCAsmInfo &MAI) const {
337 if (!AsmLexerCtorFn)
338 return 0;
339 return AsmLexerCtorFn(*this, MRI, MAI);
340 }
341
342 /// createAsmParser - Create a target specific assembly parser.
333 /// createMCAsmLexer - Create a target specific assembly lexer.
334 ///
335 MCTargetAsmLexer *createMCAsmLexer(const MCRegisterInfo &MRI,
336 const MCAsmInfo &MAI) const {
337 if (!MCAsmLexerCtorFn)
338 return 0;
339 return MCAsmLexerCtorFn(*this, MRI, MAI);
340 }
341
342 /// createMCAsmParser - Create a target specific assembly parser.
343343 ///
344344 /// \arg Parser - The target independent parser implementation to use for
345345 /// parsing and lexing.
346 TargetAsmParser *createAsmParser(MCSubtargetInfo &STI,
347 MCAsmParser &Parser) const {
348 if (!AsmParserCtorFn)
349 return 0;
350 return AsmParserCtorFn(STI, Parser);
346 MCTargetAsmParser *createMCAsmParser(MCSubtargetInfo &STI,
347 MCAsmParser &Parser) const {
348 if (!MCAsmParserCtorFn)
349 return 0;
350 return MCAsmParserCtorFn(STI, Parser);
351351 }
352352
353353 /// createAsmPrinter - Create a target specific assembly printer pass. This
617617 T.MCAsmBackendCtorFn = Fn;
618618 }
619619
620 /// RegisterAsmLexer - Register a TargetAsmLexer implementation for the
620 /// RegisterMCAsmLexer - Register a MCTargetAsmLexer implementation for the
621621 /// given target.
622622 ///
623623 /// Clients are responsible for ensuring that registration doesn't occur
625625 /// this is done by initializing all targets at program startup.
626626 ///
627627 /// @param T - The target being registered.
628 /// @param Fn - A function to construct an AsmLexer for the target.
629 static void RegisterAsmLexer(Target &T, Target::AsmLexerCtorTy Fn) {
630 if (!T.AsmLexerCtorFn)
631 T.AsmLexerCtorFn = Fn;
632 }
633
634 /// RegisterAsmParser - Register a TargetAsmParser implementation for the
635 /// given target.
636 ///
637 /// Clients are responsible for ensuring that registration doesn't occur
638 /// while another thread is attempting to access the registry. Typically
639 /// this is done by initializing all targets at program startup.
640 ///
641 /// @param T - The target being registered.
642 /// @param Fn - A function to construct an AsmParser for the target.
643 static void RegisterAsmParser(Target &T, Target::AsmParserCtorTy Fn) {
644 if (!T.AsmParserCtorFn)
645 T.AsmParserCtorFn = Fn;
628 /// @param Fn - A function to construct an MCAsmLexer for the target.
629 static void RegisterMCAsmLexer(Target &T, Target::MCAsmLexerCtorTy Fn) {
630 if (!T.MCAsmLexerCtorFn)
631 T.MCAsmLexerCtorFn = Fn;
632 }
633
634 /// RegisterMCAsmParser - Register a MCTargetAsmParser implementation for
635 /// the given target.
636 ///
637 /// Clients are responsible for ensuring that registration doesn't occur
638 /// while another thread is attempting to access the registry. Typically
639 /// this is done by initializing all targets at program startup.
640 ///
641 /// @param T - The target being registered.
642 /// @param Fn - A function to construct an MCTargetAsmParser for the target.
643 static void RegisterMCAsmParser(Target &T, Target::MCAsmParserCtorTy Fn) {
644 if (!T.MCAsmParserCtorFn)
645 T.MCAsmParserCtorFn = Fn;
646646 }
647647
648648 /// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
973973 }
974974 };
975975
976 /// RegisterAsmLexer - Helper template for registering a target specific
976 /// RegisterMCAsmLexer - Helper template for registering a target specific
977977 /// assembly lexer, for use in the target machine initialization
978978 /// function. Usage:
979979 ///
980 /// extern "C" void LLVMInitializeFooAsmLexer() {
981 /// extern Target TheFooTarget;
982 /// RegisterAsmLexer X(TheFooTarget);
983 /// }
984 template
985 struct RegisterAsmLexer {
986 RegisterAsmLexer(Target &T) {
987 TargetRegistry::RegisterAsmLexer(T, &Allocator);
988 }
989
990 private:
991 static TargetAsmLexer *Allocator(const Target &T, const MCRegisterInfo &MRI,
992 const MCAsmInfo &MAI) {
993 return new AsmLexerImpl(T, MRI, MAI);
994 }
995 };
996
997 /// RegisterAsmParser - Helper template for registering a target specific
980 /// extern "C" void LLVMInitializeFooMCAsmLexer() {
981 /// extern Target TheFooTarget;
982 /// RegisterMCAsmLexer X(TheFooTarget);
983 /// }
984 template
985 struct RegisterMCAsmLexer {
986 RegisterMCAsmLexer(Target &T) {
987 TargetRegistry::RegisterMCAsmLexer(T, &Allocator);
988 }
989
990 private:
991 static MCTargetAsmLexer *Allocator(const Target &T,
992 const MCRegisterInfo &MRI,
993 const MCAsmInfo &MAI) {
994 return new MCAsmLexerImpl(T, MRI, MAI);
995 }
996 };
997
998 /// RegisterMCAsmParser - Helper template for registering a target specific
998999 /// assembly parser, for use in the target machine initialization
9991000 /// function. Usage:
10001001 ///
1001 /// extern "C" void LLVMInitializeFooAsmParser() {
1002 /// extern Target TheFooTarget;
1003 /// RegisterAsmParser X(TheFooTarget);
1004 /// }
1005 template
1006 struct RegisterAsmParser {
1007 RegisterAsmParser(Target &T) {
1008 TargetRegistry::RegisterAsmParser(T, &Allocator);
1009 }
1010
1011 private:
1012 static TargetAsmParser *Allocator(MCSubtargetInfo &STI, MCAsmParser &P) {
1013 return new AsmParserImpl(STI, P);
1002 /// extern "C" void LLVMInitializeFooMCAsmParser() {
1003 /// extern Target TheFooTarget;
1004 /// RegisterMCAsmParser X(TheFooTarget);
1005 /// }
1006 template
1007 struct RegisterMCAsmParser {
1008 RegisterMCAsmParser(Target &T) {
1009 TargetRegistry::RegisterMCAsmParser(T, &Allocator);
1010 }
1011
1012 private:
1013 static MCTargetAsmParser *Allocator(MCSubtargetInfo &STI, MCAsmParser &P) {
1014 return new MCAsmParserImpl(STI, P);
10141015 }
10151016 };
10161017
2222 #include "llvm/MC/MCStreamer.h"
2323 #include "llvm/MC/MCSubtargetInfo.h"
2424 #include "llvm/MC/MCSymbol.h"
25 #include "llvm/MC/TargetAsmParser.h"
25 #include "llvm/MC/MCTargetAsmParser.h"
2626 #include "llvm/Target/TargetMachine.h"
2727 #include "llvm/Target/TargetRegistry.h"
2828 #include "llvm/ADT/OwningPtr.h"
120120 STI(TM.getTarget().createMCSubtargetInfo(TM.getTargetTriple(),
121121 TM.getTargetCPU(),
122122 TM.getTargetFeatureString()));
123 OwningPtr<TargetAsmParser> TAP(TM.getTarget().createAsmParser(*STI, *Parser));
123 OwningPtr<MCTargetAsmParser>
124 TAP(TM.getTarget().createMCAsmParser(*STI, *Parser));
124125 if (!TAP)
125126 report_fatal_error("Inline asm not supported by this streamer because"
126127 " we don't have an asm parser for this target\n");
3838 WinCOFFObjectWriter.cpp
3939 SubtargetFeature.cpp
4040 MCAsmBackend.cpp
41 TargetAsmLexer.cpp
41 MCTargetAsmLexer.cpp
4242 )
4343
4444 add_subdirectory(MCParser)
2727 #include "llvm/MC/MCParser/AsmLexer.h"
2828 #include "llvm/MC/MCParser/MCAsmParser.h"
2929 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
30 #include "llvm/MC/TargetAsmLexer.h"
31 #include "llvm/MC/TargetAsmParser.h"
30 #include "llvm/MC/MCTargetAsmLexer.h"
31 #include "llvm/MC/MCTargetAsmParser.h"
3232 #include "llvm/Support/MemoryBuffer.h"
3333 #include "llvm/Support/MemoryObject.h"
3434 #include "llvm/Support/SourceMgr.h"
192192 return;
193193
194194 GenericAsmLexer.reset(new AsmLexer(*AsmInfo));
195 SpecificAsmLexer.reset(Tgt->createAsmLexer(*MRI, *AsmInfo));
195 SpecificAsmLexer.reset(Tgt->createMCAsmLexer(*MRI, *AsmInfo));
196196 SpecificAsmLexer->InstallLexer(*GenericAsmLexer);
197197
198198 initMaps(*MRI);
367367
368368 StringRef triple = tripleFromArch(Key.Arch);
369369 OwningPtr STI(Tgt->createMCSubtargetInfo(triple, "", ""));
370 OwningPtr TargetParser(Tgt->createAsmParser(*STI,
371 *genericParser));
370 OwningPtr
371 TargetParser(Tgt->createMCAsmParser(*STI, *genericParser));
372372
373373 AsmToken OpcodeToken = genericParser->Lex();
374374 AsmToken NextToken = genericParser->Lex(); // consume next token, because specificParser expects us to
4040 class MCRegisterInfo;
4141 class MCStreamer;
4242 class MCSubtargetInfo;
43 class MCTargetAsmLexer;
44 class MCTargetAsmParser;
4345 template class SmallVectorImpl;
4446 class SourceMgr;
4547 class Target;
46 class TargetAsmLexer;
47 class TargetAsmParser;
4848
4949 struct EDInstInfo;
5050 struct EDInst;
158158 /// The target-specific lexer for use in tokenizing strings, in
159159 /// target-independent and target-specific portions
160160 llvm::OwningPtr GenericAsmLexer;
161 llvm::OwningPtrTargetAsmLexer> SpecificAsmLexer;
161 llvm::OwningPtrMCTargetAsmLexer> SpecificAsmLexer;
162162 /// The guard for the above
163163 llvm::sys::Mutex ParserMutex;
164164 /// The LLVM number used for the target disassembly syntax variant
1717 #include "llvm/ADT/Twine.h"
1818 #include "llvm/MC/MCAsmInfo.h"
1919 #include "llvm/MC/MCContext.h"
20 #include "llvm/MC/MCDwarf.h"
2021 #include "llvm/MC/MCExpr.h"
2122 #include "llvm/MC/MCParser/AsmCond.h"
2223 #include "llvm/MC/MCParser/AsmLexer.h"
2627 #include "llvm/MC/MCSectionMachO.h"
2728 #include "llvm/MC/MCStreamer.h"
2829 #include "llvm/MC/MCSymbol.h"
29 #include "llvm/MC/MCDwarf.h"
30 #include "llvm/MC/TargetAsmParser.h"
30 #include "llvm/MC/MCTargetAsmParser.h"
3131 #include "llvm/Support/CommandLine.h"
3232 #include "llvm/Support/MathExtras.h"
3333 #include "llvm/Support/MemoryBuffer.h"
66 MCAsmLexer.cpp
77 MCAsmParser.cpp
88 MCAsmParserExtension.cpp
9 TargetAsmParser.cpp
9 MCTargetAsmParser.cpp
1010 )
1616 #include "llvm/MC/MCSectionCOFF.h"
1717 #include "llvm/MC/MCStreamer.h"
1818 #include "llvm/MC/MCExpr.h"
19 #include "llvm/MC/TargetAsmParser.h"
19 #include "llvm/MC/MCTargetAsmParser.h"
2020 #include "llvm/Support/COFF.h"
2121 using namespace llvm;
2222
99 #include "llvm/MC/MCParser/MCAsmParser.h"
1010 #include "llvm/MC/MCParser/MCAsmLexer.h"
1111 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
12 #include "llvm/MC/TargetAsmParser.h"
12 #include "llvm/MC/MCTargetAsmParser.h"
1313 #include "llvm/Support/SourceMgr.h"
1414 #include "llvm/Support/raw_ostream.h"
1515 #include "llvm/Support/Debug.h"
2222 MCAsmParser::~MCAsmParser() {
2323 }
2424
25 void MCAsmParser::setTargetParser(TargetAsmParser &P) {
25 void MCAsmParser::setTargetParser(MCTargetAsmParser &P) {
2626 assert(!TargetParser && "Target parser is already initialized!");
2727 TargetParser = &P;
2828 TargetParser->Initialize(*this);
0 //===-- MCTargetAsmParser.cpp - Target Assembly Parser ---------------------==//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/MC/MCTargetAsmParser.h"
10 using namespace llvm;
11
12 MCTargetAsmParser::MCTargetAsmParser()
13 : AvailableFeatures(0)
14 {
15 }
16
17 MCTargetAsmParser::~MCTargetAsmParser() {
18 }
+0
-19
lib/MC/MCParser/TargetAsmParser.cpp less more
None //===-- TargetAsmParser.cpp - Target Assembly Parser -----------------------==//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/MC/TargetAsmParser.h"
10 using namespace llvm;
11
12 TargetAsmParser::TargetAsmParser()
13 : AvailableFeatures(0)
14 {
15 }
16
17 TargetAsmParser::~TargetAsmParser() {
18 }
0 //===-- llvm/MC/MCTargetAsmLexer.cpp - Target Assembly Lexer --------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/MC/MCTargetAsmLexer.h"
10 using namespace llvm;
11
12 MCTargetAsmLexer::MCTargetAsmLexer(const Target &T)
13 : TheTarget(T), Lexer(NULL) {
14 }
15 MCTargetAsmLexer::~MCTargetAsmLexer() {}
+0
-14
lib/MC/TargetAsmLexer.cpp less more
None //===-- llvm/MC/TargetAsmLexer.cpp - Target Assembly Lexer ----------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/MC/TargetAsmLexer.h"
10 using namespace llvm;
11
12 TargetAsmLexer::TargetAsmLexer(const Target &T) : TheTarget(T), Lexer(NULL) {}
13 TargetAsmLexer::~TargetAsmLexer() {}
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "ARM.h"
9 #include "MCTargetDesc/ARMBaseInfo.h"
1010
1111 #include "llvm/MC/MCAsmInfo.h"
1212 #include "llvm/MC/MCParser/MCAsmLexer.h"
1313 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
1414 #include "llvm/MC/MCRegisterInfo.h"
15 #include "llvm/MC/TargetAsmLexer.h"
15 #include "llvm/MC/MCTargetAsmLexer.h"
1616
1717 #include "llvm/Target/TargetRegistry.h"
1818
2828
2929 namespace {
3030
31 class ARMBaseAsmLexer : public TargetAsmLexer {
31 class ARMBaseAsmLexer : public MCTargetAsmLexer {
3232 const MCAsmInfo &AsmInfo;
3333
3434 const AsmToken &lexDefinite() {
7575 }
7676 public:
7777 ARMBaseAsmLexer(const Target &T, const MCAsmInfo &MAI)
78 : TargetAsmLexer(T), AsmInfo(MAI) {
78 : MCTargetAsmLexer(T), AsmInfo(MAI) {
7979 }
8080 };
8181
137137 }
138138
139139 extern "C" void LLVMInitializeARMAsmLexer() {
140 RegisterAsmLexer X(TheARMTarget);
141 RegisterAsmLexer Y(TheThumbTarget);
140 RegisterMCAsmLexer X(TheARMTarget);
141 RegisterMCAsmLexer Y(TheThumbTarget);
142142 }
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "ARM.h"
10 #include "ARMBaseRegisterInfo.h"
11 #include "ARMSubtarget.h"
9 #include "MCTargetDesc/ARMBaseInfo.h"
1210 #include "MCTargetDesc/ARMAddressingModes.h"
1311 #include "MCTargetDesc/ARMMCExpr.h"
1412 #include "llvm/MC/MCParser/MCAsmLexer.h"
1917 #include "llvm/MC/MCStreamer.h"
2018 #include "llvm/MC/MCExpr.h"
2119 #include "llvm/MC/MCInst.h"
20 #include "llvm/MC/MCRegisterInfo.h"
2221 #include "llvm/MC/MCSubtargetInfo.h"
23 #include "llvm/MC/TargetAsmParser.h"
22 #include "llvm/MC/MCTargetAsmParser.h"
2423 #include "llvm/Target/TargetRegistry.h"
2524 #include "llvm/Support/SourceMgr.h"
2625 #include "llvm/Support/raw_ostream.h"
2726 #include "llvm/ADT/OwningPtr.h"
27 #include "llvm/ADT/STLExtras.h"
2828 #include "llvm/ADT/SmallVector.h"
2929 #include "llvm/ADT/StringExtras.h"
3030 #include "llvm/ADT/StringSwitch.h"
3636
3737 class ARMOperand;
3838
39 class ARMAsmParser : public TargetAsmParser {
39 class ARMAsmParser : public MCTargetAsmParser {
4040 MCSubtargetInfo &STI;
4141 MCAsmParser &Parser;
4242
140140
141141 public:
142142 ARMAsmParser(MCSubtargetInfo &_STI, MCAsmParser &_Parser)
143 : TargetAsmParser(), STI(_STI), Parser(_Parser) {
143 : MCTargetAsmParser(), STI(_STI), Parser(_Parser) {
144144 MCAsmParserExtension::Initialize(_Parser);
145145
146146 // Initialize the set of available features.
26642664
26652665 /// Force static initialization.
26662666 extern "C" void LLVMInitializeARMAsmParser() {
2667 RegisterAsmParser X(TheARMTarget);
2668 RegisterAsmParser Y(TheThumbTarget);
2667 RegisterMCAsmParser X(TheARMTarget);
2668 RegisterMCAsmParser Y(TheThumbTarget);
26692669 LLVMInitializeARMAsmLexer();
26702670 }
26712671
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "MBlaze.h"
9 #include "MCTargetDesc/MBlazeBaseInfo.h"
1010
1111 #include "llvm/ADT/OwningPtr.h"
1212 #include "llvm/ADT/SmallVector.h"
1616 #include "llvm/MC/MCParser/MCAsmLexer.h"
1717 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
1818 #include "llvm/MC/MCRegisterInfo.h"
19 #include "llvm/MC/TargetAsmLexer.h"
19 #include "llvm/MC/MCTargetAsmLexer.h"
2020
2121 #include "llvm/Target/TargetRegistry.h"
2222
2727
2828 namespace {
2929
30 class MBlazeBaseAsmLexer : public TargetAsmLexer {
30 class MBlazeBaseAsmLexer : public MCTargetAsmLexer {
3131 const MCAsmInfo &AsmInfo;
3232
3333 const AsmToken &lexDefinite() {
7474 }
7575 public:
7676 MBlazeBaseAsmLexer(const Target &T, const MCAsmInfo &MAI)
77 : TargetAsmLexer(T), AsmInfo(MAI) {
77 : MCTargetAsmLexer(T), AsmInfo(MAI) {
7878 }
7979 };
8080
117117 }
118118
119119 extern "C" void LLVMInitializeMBlazeAsmLexer() {
120 RegisterAsmLexer X(TheMBlazeTarget);
120 RegisterMCAsmLexer X(TheMBlazeTarget);
121121 }
122122
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "MBlaze.h"
10 #include "MBlazeSubtarget.h"
11 #include "MBlazeRegisterInfo.h"
12 #include "MBlazeISelLowering.h"
9 #include "MCTargetDesc/MBlazeBaseInfo.h"
1310 #include "llvm/MC/MCParser/MCAsmLexer.h"
1411 #include "llvm/MC/MCParser/MCAsmParser.h"
1512 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
1613 #include "llvm/MC/MCStreamer.h"
1714 #include "llvm/MC/MCExpr.h"
1815 #include "llvm/MC/MCInst.h"
19 #include "llvm/MC/TargetAsmParser.h"
16 #include "llvm/MC/MCTargetAsmParser.h"
2017 #include "llvm/Target/TargetRegistry.h"
2118 #include "llvm/Support/SourceMgr.h"
2219 #include "llvm/Support/raw_ostream.h"
2926 namespace {
3027 struct MBlazeOperand;
3128
32 class MBlazeAsmParser : public TargetAsmParser {
29 class MBlazeAsmParser : public MCTargetAsmParser {
3330 MCAsmParser &Parser;
3431
3532 MCAsmParser &getParser() const { return Parser; }
6360
6461 public:
6562 MBlazeAsmParser(MCSubtargetInfo &_STI, MCAsmParser &_Parser)
66 : TargetAsmParser(), Parser(_Parser) {}
63 : MCTargetAsmParser(), Parser(_Parser) {}
6764
6865 virtual bool ParseInstruction(StringRef Name, SMLoc NameLoc,
6966 SmallVectorImpl &Operands);
557554
558555 /// Force static initialization.
559556 extern "C" void LLVMInitializeMBlazeAsmParser() {
560 RegisterAsmParser X(TheMBlazeTarget);
557 RegisterMCAsmParser X(TheMBlazeTarget);
561558 LLVMInitializeMBlazeAsmLexer();
562559 }
563560
1212
1313 #define DEBUG_TYPE "asm-printer"
1414 #include "PPCInstPrinter.h"
15 #include "PPCPredicates.h"
15 #include "MCTargetDesc/PPCBaseInfo.h"
16 #include "MCTargetDesc/PPCPredicates.h"
1617 #include "llvm/MC/MCExpr.h"
1718 #include "llvm/MC/MCInst.h"
1819 #include "llvm/Support/raw_ostream.h"
22 PPCMCTargetDesc.cpp
33 PPCMCAsmInfo.cpp
44 PPCMCCodeEmitter.cpp
5 PPCPredicates.cpp
56 )
67 add_dependencies(LLVMPowerPCDesc PowerPCCommonTableGen)
0 //===-- PPCPredicates.cpp - PPC Branch Predicate Information --------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the PowerPC branch predicates.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "PPCPredicates.h"
14 #include "llvm/Support/ErrorHandling.h"
15 #include
16 using namespace llvm;
17
18 PPC::Predicate PPC::InvertPredicate(PPC::Predicate Opcode) {
19 switch (Opcode) {
20 default: llvm_unreachable("Unknown PPC branch opcode!");
21 case PPC::PRED_EQ: return PPC::PRED_NE;
22 case PPC::PRED_NE: return PPC::PRED_EQ;
23 case PPC::PRED_LT: return PPC::PRED_GE;
24 case PPC::PRED_GE: return PPC::PRED_LT;
25 case PPC::PRED_GT: return PPC::PRED_LE;
26 case PPC::PRED_LE: return PPC::PRED_GT;
27 case PPC::PRED_NU: return PPC::PRED_UN;
28 case PPC::PRED_UN: return PPC::PRED_NU;
29 }
30 }
0 //===-- PPCPredicates.h - PPC Branch Predicate Information ------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file describes the PowerPC branch predicates.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H
14 #define LLVM_TARGET_POWERPC_PPCPREDICATES_H
15
16 namespace llvm {
17 namespace PPC {
18 /// Predicate - These are "(BI << 5) | BO" for various predicates.
19 enum Predicate {
20 PRED_ALWAYS = (0 << 5) | 20,
21 PRED_LT = (0 << 5) | 12,
22 PRED_LE = (1 << 5) | 4,
23 PRED_EQ = (2 << 5) | 12,
24 PRED_GE = (0 << 5) | 4,
25 PRED_GT = (1 << 5) | 12,
26 PRED_NE = (2 << 5) | 4,
27 PRED_UN = (3 << 5) | 12,
28 PRED_NU = (3 << 5) | 4
29 };
30
31 /// Invert the specified predicate. != -> ==, < -> >=.
32 Predicate InvertPredicate(Predicate Opcode);
33 }
34 }
35
36 #endif
1717
1818 #define DEBUG_TYPE "asmprinter"
1919 #include "PPC.h"
20 #include "PPCPredicates.h"
2120 #include "PPCTargetMachine.h"
2221 #include "PPCSubtarget.h"
22 #include "MCTargetDesc/PPCPredicates.h"
2323 #include "llvm/Analysis/DebugInfo.h"
2424 #include "llvm/Constants.h"
2525 #include "llvm/DerivedTypes.h"
1818 #include "PPC.h"
1919 #include "PPCInstrBuilder.h"
2020 #include "PPCInstrInfo.h"
21 #include "PPCPredicates.h"
21 #include "MCTargetDesc/PPCPredicates.h"
2222 #include "llvm/CodeGen/MachineFunctionPass.h"
2323 #include "llvm/Target/TargetMachine.h"
2424 #include "llvm/ADT/Statistic.h"
1313
1414 #define DEBUG_TYPE "ppc-codegen"
1515 #include "PPC.h"
16 #include "PPCPredicates.h"
1716 #include "PPCTargetMachine.h"
17 #include "MCTargetDesc/PPCPredicates.h"
1818 #include "llvm/CodeGen/MachineInstrBuilder.h"
1919 #include "llvm/CodeGen/MachineFunction.h"
2020 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
1313 #include "PPCISelLowering.h"
1414 #include "PPCMachineFunctionInfo.h"
1515 #include "PPCPerfectShuffle.h"
16 #include "PPCPredicates.h"
1716 #include "PPCTargetMachine.h"
17 #include "MCTargetDesc/PPCPredicates.h"
1818 #include "llvm/ADT/STLExtras.h"
1919 #include "llvm/ADT/VectorExtras.h"
2020 #include "llvm/CodeGen/CallingConvLower.h"
1414 #include "PPC.h"
1515 #include "PPCInstrBuilder.h"
1616 #include "PPCMachineFunctionInfo.h"
17 #include "PPCPredicates.h"
1817 #include "PPCTargetMachine.h"
1918 #include "PPCHazardRecognizers.h"
19 #include "MCTargetDesc/PPCPredicates.h"
2020 #include "llvm/CodeGen/MachineFrameInfo.h"
2121 #include "llvm/CodeGen/MachineInstrBuilder.h"
2222 #include "llvm/CodeGen/MachineMemOperand.h"
+0
-31
lib/Target/PowerPC/PPCPredicates.cpp less more
None //===-- PPCPredicates.cpp - PPC Branch Predicate Information --------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the PowerPC branch predicates.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "PPCPredicates.h"
14 #include "llvm/Support/ErrorHandling.h"
15 #include
16 using namespace llvm;
17
18 PPC::Predicate PPC::InvertPredicate(PPC::Predicate Opcode) {
19 switch (Opcode) {
20 default: llvm_unreachable("Unknown PPC branch opcode!");
21 case PPC::PRED_EQ: return PPC::PRED_NE;
22 case PPC::PRED_NE: return PPC::PRED_EQ;
23 case PPC::PRED_LT: return PPC::PRED_GE;
24 case PPC::PRED_GE: return PPC::PRED_LT;
25 case PPC::PRED_GT: return PPC::PRED_LE;
26 case PPC::PRED_LE: return PPC::PRED_GT;
27 case PPC::PRED_NU: return PPC::PRED_UN;
28 case PPC::PRED_UN: return PPC::PRED_NU;
29 }
30 }
+0
-39
lib/Target/PowerPC/PPCPredicates.h less more
None //===-- PPCPredicates.h - PPC Branch Predicate Information ------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file describes the PowerPC branch predicates.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H
14 #define LLVM_TARGET_POWERPC_PPCPREDICATES_H
15
16 #include "PPC.h"
17
18 namespace llvm {
19 namespace PPC {
20 /// Predicate - These are "(BI << 5) | BO" for various predicates.
21 enum Predicate {
22 PRED_ALWAYS = (0 << 5) | 20,
23 PRED_LT = (0 << 5) | 12,
24 PRED_LE = (1 << 5) | 4,
25 PRED_EQ = (2 << 5) | 12,
26 PRED_GE = (0 << 5) | 4,
27 PRED_GT = (1 << 5) | 12,
28 PRED_NE = (2 << 5) | 4,
29 PRED_UN = (3 << 5) | 12,
30 PRED_NU = (3 << 5) | 4
31 };
32
33 /// Invert the specified predicate. != -> ==, < -> >=.
34 Predicate InvertPredicate(Predicate Opcode);
35 }
36 }
37
38 #endif
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "MCTargetDesc/X86BaseInfo.h"
910 #include "llvm/MC/MCAsmInfo.h"
1011 #include "llvm/MC/MCParser/MCAsmLexer.h"
1112 #include "llvm/MC/MCParser/MCParsedAsmOperand.h"
12 #include "llvm/MC/TargetAsmLexer.h"
13 #include "llvm/MC/MCTargetAsmLexer.h"
1314 #include "llvm/Target/TargetRegistry.h"
1415 #include "llvm/ADT/SmallVector.h"
1516 #include "llvm/ADT/StringExtras.h"
16 #include "X86.h"
1717
1818 using namespace llvm;
1919
2020 namespace {
2121
22 class X86AsmLexer : public TargetAsmLexer {
22 class X86AsmLexer : public MCTargetAsmLexer {
2323 const MCAsmInfo &AsmInfo;
2424
2525 bool tentativeIsValid;
6060 }
6161 public:
6262 X86AsmLexer(const Target &T, const MCRegisterInfo &MRI, const MCAsmInfo &MAI)
63 : TargetAsmLexer(T), AsmInfo(MAI), tentativeIsValid(false) {
63 : MCTargetAsmLexer(T), AsmInfo(MAI), tentativeIsValid(false) {
6464 }
6565 };
6666
159159 }
160160
161161 extern "C" void LLVMInitializeX86AsmLexer() {
162 RegisterAsmLexer X(TheX86_32Target);
163 RegisterAsmLexer Y(TheX86_64Target);
162 RegisterMCAsmLexer X(TheX86_32Target);
163 RegisterMCAsmLexer Y(TheX86_64Target);
164164 }
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "llvm/MC/TargetAsmParser.h"
10 #include "X86.h"
11 #include "X86Subtarget.h"
9 #include "MCTargetDesc/X86BaseInfo.h"
10 #include "llvm/MC/MCTargetAsmParser.h"
1211 #include "llvm/Target/TargetRegistry.h"
1312 #include "llvm/MC/MCStreamer.h"
1413 #include "llvm/MC/MCExpr.h"
3130 namespace {
3231 struct X86Operand;
3332
34 class X86ATTAsmParser : public TargetAsmParser {
33 class X86ATTAsmParser : public MCTargetAsmParser {
3534 MCSubtargetInfo &STI;
3635 MCAsmParser &Parser;
3736
7473
7574 public:
7675 X86ATTAsmParser(MCSubtargetInfo &sti, MCAsmParser &parser)
77 : TargetAsmParser(), STI(sti), Parser(parser) {
76 : MCTargetAsmParser(), STI(sti), Parser(parser) {
7877
7978 // Initialize the set of available features.
8079 setAvailableFeatures(ComputeAvailableFeatures(STI.getFeatureBits()));
11291128
11301129 // Force static initialization.
11311130 extern "C" void LLVMInitializeX86AsmParser() {
1132 RegisterAsmParser X(TheX86_32Target);
1133 RegisterAsmParser Y(TheX86_64Target);
1131 RegisterMCAsmParser X(TheX86_32Target);
1132 RegisterMCAsmParser Y(TheX86_64Target);
11341133 LLVMInitializeX86AsmLexer();
11351134 }
11361135
1313
1414 #include "X86InstComments.h"
1515 #include "MCTargetDesc/X86MCTargetDesc.h"
16 #include "Utils/X86ShuffleDecode.h"
1617 #include "llvm/MC/MCInst.h"
1718 #include "llvm/Support/raw_ostream.h"
18 #include "../Utils/X86ShuffleDecode.h"
1919 using namespace llvm;
2020
2121 //===----------------------------------------------------------------------===//
2323 #include "llvm/MC/MCSectionMachO.h"
2424 #include "llvm/MC/MCStreamer.h"
2525 #include "llvm/MC/MCSubtargetInfo.h"
26 #include "llvm/MC/MCTargetAsmParser.h"
2627 #include "llvm/MC/SubtargetFeature.h"
27 #include "llvm/MC/TargetAsmParser.h"
2828 #include "llvm/Target/TargetRegistry.h"
2929 #include "llvm/Target/TargetSelect.h"
3030 #include "llvm/ADT/OwningPtr.h"
393393
394394 OwningPtr Parser(createMCAsmParser(*TheTarget, SrcMgr, Ctx,
395395 *Str.get(), *MAI));
396 OwningPtr<TargetAsmParser> TAP(TheTarget->createAsmParser(*STI, *Parser));
396 OwningPtr<MCTargetAsmParser> TAP(TheTarget->createMCAsmParser(*STI, *Parser));
397397 if (!TAP) {
398398 errs() << ProgName
399399 << ": error: this target does not support assembly parsing.\n";
3737 #include "llvm/MC/MCSubtargetInfo.h"
3838 #include "llvm/MC/MCSymbol.h"
3939 #include "llvm/MC/SubtargetFeature.h"
40 #include "llvm/MC/TargetAsmParser.h"
40 #include "llvm/MC/MCTargetAsmParser.h"
4141 #include "llvm/Target/TargetMachine.h"
4242 #include "llvm/Target/TargetRegisterInfo.h"
4343 #include "llvm/Target/TargetRegistry.h"
625625 createMCSubtargetInfo(_target->getTargetTriple(),
626626 _target->getTargetCPU(),
627627 _target->getTargetFeatureString()));
628 OwningPtr
629 TAP(_target->getTarget().createAsmParser(*STI, *Parser.get()));
628 OwningPtr
629 TAP(_target->getTarget().createMCAsmParser(*STI, *Parser.get()));
630630 Parser->setTargetParser(*TAP);
631631 int Res = Parser->Run(false);
632632 if (Res)
21712171 OS << "\n#ifdef GET_ASSEMBLER_HEADER\n";
21722172 OS << "#undef GET_ASSEMBLER_HEADER\n";
21732173 OS << " // This should be included into the middle of the declaration of\n";
2174 OS << " // your subclasses implementation of TargetAsmParser.\n";
2174 OS << " // your subclasses implementation of MCTargetAsmParser.\n";
21752175 OS << " unsigned ComputeAvailableFeatures(uint64_t FeatureBits) const;\n";
21762176 OS << " enum MatchResultTy {\n";
21772177 OS << " Match_ConversionFail,\n";