59#define DEBUG_TYPE "mcasmparser"
64 "mwarn-missing-parenthesis",
65 cl::desc(
"Warn for missing parenthesis around predicate registers"),
68 "merror-missing-parenthesis",
69 cl::desc(
"Error for missing parenthesis around predicate registers"),
72 "mwarn-sign-mismatch",
73 cl::desc(
"Warn for mismatching a signed and unsigned value"),
76 "mwarn-noncontigious-register",
79 "merror-noncontigious-register",
80 cl::desc(
"Error for register names that aren't contigious"),
98 MCAsmParser &getParser()
const {
return Parser; }
99 MCAssembler *getAssembler()
const {
100 MCAssembler *Assembler =
nullptr;
102 if (!Parser.getStreamer().hasRawTextSupport()) {
103 MCELFStreamer *MES =
static_cast<MCELFStreamer *
>(&Parser.getStreamer());
109 AsmLexer &getLexer()
const {
return Parser.getLexer(); }
111 bool equalIsAsmAssignment()
override {
return false; }
112 bool isLabel(AsmToken &Token)
override;
115 void Warning(SMLoc L,
const Twine &
Msg) { Parser.Warning(L,
Msg); }
116 bool Error(SMLoc L,
const Twine &
Msg) {
return Parser.Error(L,
Msg); }
117 bool ParseDirectiveFalign(
unsigned Size, SMLoc L);
119 bool parseRegister(MCRegister &
Reg, SMLoc &StartLoc, SMLoc &EndLoc)
override;
120 ParseStatus tryParseRegister(MCRegister &
Reg, SMLoc &StartLoc,
121 SMLoc &EndLoc)
override;
122 bool ParseDirectiveSubsection(SMLoc L);
123 bool ParseDirectiveComm(
bool IsLocal, SMLoc L);
125 bool parseDirectiveAttribute(SMLoc L);
127 bool RegisterMatchesArch(MCRegister MatchNum)
const;
129 bool matchBundleOptions();
130 bool handleNoncontigiousRegister(
bool Contigious, SMLoc &Loc);
131 bool finishBundle(SMLoc IDLoc, MCStreamer &Out);
132 void canonicalizeImmediates(MCInst &MCI);
133 bool matchOneInstruction(MCInst &MCB, SMLoc IDLoc,
135 bool MatchingInlineAsm);
136 void eatToEndOfPacket();
137 bool matchAndEmitInstruction(SMLoc IDLoc,
unsigned &Opcode,
140 bool MatchingInlineAsm)
override;
142 unsigned validateTargetOperandClass(MCParsedAsmOperand &
Op,
143 unsigned Kind)
override;
144 bool OutOfRange(SMLoc IDLoc,
long long Val,
long long Max);
148 MCRegister matchRegister(StringRef Name);
153#define GET_ASSEMBLER_HEADER
154#include "HexagonGenAsmMatcher.inc"
163 setAvailableFeatures(ComputeAvailableFeatures(getSTI().getFeatureBits()));
172 getTargetStreamer().emitTargetAttributes(*STI);
180 bool parseExpression(MCExpr
const *&Expr);
182 bool parseInstruction(ParseInstructionInfo &Info, StringRef Name,
187 bool parseInstruction(ParseInstructionInfo &Info, StringRef Name, AsmToken ID,
190 bool ParseDirective(AsmToken DirectiveID)
override;
196 enum KindTy { Token, Immediate, Register } Kind;
199 SMLoc StartLoc, EndLoc;
220 HexagonOperand(KindTy K, MCContext &Context) : Kind(
K), Context(Context) {}
223 HexagonOperand(
const HexagonOperand &o)
224 : MCParsedAsmOperand(), Context(
o.Context) {
226 StartLoc =
o.StartLoc;
242 SMLoc getStartLoc()
const override {
return StartLoc; }
245 SMLoc getEndLoc()
const override {
return EndLoc; }
247 MCRegister
getReg()
const override {
248 assert(Kind == Register &&
"Invalid access!");
252 const MCExpr *
getImm()
const {
253 assert(Kind == Immediate &&
"Invalid access!");
257 bool isToken()
const override {
return Kind == Token; }
258 bool isImm()
const override {
return Kind == Immediate; }
260 bool isReg()
const override {
return Kind == Register; }
262 bool CheckImmRange(
int immBits,
int zeroBits,
bool isSigned,
263 bool isRelocatable,
bool Extendable)
const {
264 if (Kind == Immediate) {
269 if (myMCExpr->evaluateAsAbsolute(Res)) {
270 int bits = immBits + zeroBits;
273 if (Res & ((1 << zeroBits) - 1))
276 if (Res < (1LL << (bits - 1)) && Res >= -(1LL << (bits - 1)))
284 const int64_t high_bit_set = 1ULL << 63;
298 bool isa30_2Imm()
const {
return CheckImmRange(30, 2,
true,
true,
true); }
299 bool isb30_2Imm()
const {
return CheckImmRange(30, 2,
true,
true,
true); }
300 bool isb15_2Imm()
const {
return CheckImmRange(15, 2,
true,
true,
false); }
301 bool isb13_2Imm()
const {
return CheckImmRange(13, 2,
true,
true,
false); }
303 bool ism32_0Imm()
const {
return true; }
305 bool isf32Imm()
const {
return false; }
306 bool isf64Imm()
const {
return false; }
307 bool iss32_0Imm()
const {
return true; }
308 bool iss31_1Imm()
const {
return true; }
309 bool iss30_2Imm()
const {
return true; }
310 bool iss29_3Imm()
const {
return true; }
311 bool iss27_2Imm()
const {
return CheckImmRange(27, 2,
true,
true,
false); }
312 bool iss10_0Imm()
const {
return CheckImmRange(10, 0,
true,
false,
false); }
313 bool iss10_6Imm()
const {
return CheckImmRange(10, 6,
true,
false,
false); }
314 bool iss9_0Imm()
const {
return CheckImmRange(9, 0,
true,
false,
false); }
315 bool iss8_0Imm()
const {
return CheckImmRange(8, 0,
true,
false,
false); }
316 bool iss8_0Imm64()
const {
return CheckImmRange(8, 0,
true,
true,
false); }
317 bool iss7_0Imm()
const {
return CheckImmRange(7, 0,
true,
false,
false); }
318 bool iss6_0Imm()
const {
return CheckImmRange(6, 0,
true,
false,
false); }
319 bool iss6_3Imm()
const {
return CheckImmRange(6, 3,
true,
false,
false); }
320 bool iss4_0Imm()
const {
return CheckImmRange(4, 0,
true,
false,
false); }
321 bool iss4_1Imm()
const {
return CheckImmRange(4, 1,
true,
false,
false); }
322 bool iss4_2Imm()
const {
return CheckImmRange(4, 2,
true,
false,
false); }
323 bool iss4_3Imm()
const {
return CheckImmRange(4, 3,
true,
false,
false); }
324 bool iss3_0Imm()
const {
return CheckImmRange(3, 0,
true,
false,
false); }
326 bool isu64_0Imm()
const {
return CheckImmRange(64, 0,
false,
true,
true); }
327 bool isu32_0Imm()
const {
return true; }
328 bool isu31_1Imm()
const {
return true; }
329 bool isu30_2Imm()
const {
return true; }
330 bool isu29_3Imm()
const {
return true; }
331 bool isu26_6Imm()
const {
return CheckImmRange(26, 6,
false,
true,
false); }
332 bool isu16_0Imm()
const {
return CheckImmRange(16, 0,
false,
true,
false); }
333 bool isu16_1Imm()
const {
return CheckImmRange(16, 1,
false,
true,
false); }
334 bool isu16_2Imm()
const {
return CheckImmRange(16, 2,
false,
true,
false); }
335 bool isu16_3Imm()
const {
return CheckImmRange(16, 3,
false,
true,
false); }
336 bool isu11_3Imm()
const {
return CheckImmRange(11, 3,
false,
false,
false); }
337 bool isu10_0Imm()
const {
return CheckImmRange(10, 0,
false,
false,
false); }
338 bool isu9_0Imm()
const {
return CheckImmRange(9, 0,
false,
false,
false); }
339 bool isu8_0Imm()
const {
return CheckImmRange(8, 0,
false,
false,
false); }
340 bool isu7_0Imm()
const {
return CheckImmRange(7, 0,
false,
false,
false); }
341 bool isu6_0Imm()
const {
return CheckImmRange(6, 0,
false,
false,
false); }
342 bool isu6_1Imm()
const {
return CheckImmRange(6, 1,
false,
false,
false); }
343 bool isu6_2Imm()
const {
return CheckImmRange(6, 2,
false,
false,
false); }
344 bool isu6_3Imm()
const {
return CheckImmRange(6, 3,
false,
false,
false); }
345 bool isu5_0Imm()
const {
return CheckImmRange(5, 0,
false,
false,
false); }
346 bool isu5_2Imm()
const {
return CheckImmRange(5, 2,
false,
false,
false); }
347 bool isu5_3Imm()
const {
return CheckImmRange(5, 3,
false,
false,
false); }
348 bool isu4_0Imm()
const {
return CheckImmRange(4, 0,
false,
false,
false); }
349 bool isu4_2Imm()
const {
return CheckImmRange(4, 2,
false,
false,
false); }
350 bool isu3_0Imm()
const {
return CheckImmRange(3, 0,
false,
false,
false); }
351 bool isu3_1Imm()
const {
return CheckImmRange(3, 1,
false,
false,
false); }
352 bool isu2_0Imm()
const {
return CheckImmRange(2, 0,
false,
false,
false); }
353 bool isu1_0Imm()
const {
return CheckImmRange(1, 0,
false,
false,
false); }
355 bool isn1Const()
const {
363 bool issgp10Const()
const {
366 return getReg() == Hexagon::SGP1_0;
368 bool iss11_0Imm()
const {
369 return CheckImmRange(11 + 26, 0,
true,
true,
true);
371 bool iss11_1Imm()
const {
372 return CheckImmRange(11 + 26, 1,
true,
true,
true);
374 bool iss11_2Imm()
const {
375 return CheckImmRange(11 + 26, 2,
true,
true,
true);
377 bool iss11_3Imm()
const {
378 return CheckImmRange(11 + 26, 3,
true,
true,
true);
380 bool isu32_0MustExt()
const {
return isImm(); }
382 void addRegOperands(MCInst &Inst,
unsigned N)
const {
383 assert(
N == 1 &&
"Invalid number of operands!");
387 void addImmOperands(MCInst &Inst,
unsigned N)
const {
388 assert(
N == 1 &&
"Invalid number of operands!");
392 void addSignedImmOperands(MCInst &Inst,
unsigned N)
const {
393 assert(
N == 1 &&
"Invalid number of operands!");
394 HexagonMCExpr *Expr =
404 if ((Extended < 0) != (
Value < 0))
411 void addn1ConstOperands(MCInst &Inst,
unsigned N)
const {
412 addImmOperands(Inst,
N);
414 void addsgp10ConstOperands(MCInst &Inst,
unsigned N)
const {
415 addRegOperands(Inst,
N);
419 assert(Kind == Token &&
"Invalid access!");
420 return StringRef(Tok.Data, Tok.Length);
423 void print(raw_ostream &OS,
const MCAsmInfo &MAI)
const override;
425 static std::unique_ptr<HexagonOperand> CreateToken(MCContext &Context,
426 StringRef Str, SMLoc S) {
427 HexagonOperand *
Op =
new HexagonOperand(Token, Context);
428 Op->Tok.Data = Str.data();
429 Op->Tok.Length = Str.size();
432 return std::unique_ptr<HexagonOperand>(
Op);
435 static std::unique_ptr<HexagonOperand>
436 CreateReg(MCContext &Context, MCRegister
Reg, SMLoc S, SMLoc
E) {
437 HexagonOperand *
Op =
new HexagonOperand(Register, Context);
438 Op->Reg.RegNum =
Reg;
441 return std::unique_ptr<HexagonOperand>(
Op);
444 static std::unique_ptr<HexagonOperand>
445 CreateImm(MCContext &Context,
const MCExpr *Val, SMLoc S, SMLoc
E) {
446 HexagonOperand *
Op =
new HexagonOperand(Immediate, Context);
450 return std::unique_ptr<HexagonOperand>(
Op);
471bool HexagonAsmParser::finishBundle(SMLoc IDLoc, MCStreamer &Out) {
479 const MCRegisterInfo *RI =
getContext().getRegisterInfo();
480 MCSubtargetInfo
const &STI = getSTI();
482 MCInst OrigBundle = MCB;
505bool HexagonAsmParser::matchBundleOptions() {
506 MCAsmParser &Parser = getParser();
511 char const *MemNoShuffMsg =
512 "invalid instruction packet: mem_noshuf specifier not "
513 "supported with this architecture";
524 if (getSTI().
hasFeature(Hexagon::FeatureMemNoShuf))
527 return getParser().Error(IDLoc, MemNoShuffMsg);
531 return getParser().Error(IDLoc, llvm::Twine(
"'") + Option +
532 "' is not a valid bundle option");
540void HexagonAsmParser::canonicalizeImmediates(MCInst &MCI) {
543 for (MCOperand &
I : MCI)
545 int64_t
Value(
I.getImm());
551 Warning(MCI.getLoc(),
"Signed/Unsigned mismatch");
557bool HexagonAsmParser::matchOneInstruction(MCInst &MCI, SMLoc IDLoc,
560 bool MatchingInlineAsm) {
563 MatchInstructionImpl(InstOperands, MCI, ErrorInfo, MatchingInlineAsm);
564 if (result == Match_Success) {
566 canonicalizeImmediates(MCI);
567 result = processInstruction(MCI, InstOperands, IDLoc);
585 case Match_MissingFeature:
586 return Error(IDLoc,
"invalid instruction");
587 case Match_MnemonicFail:
588 return Error(IDLoc,
"unrecognized instruction");
589 case Match_InvalidOperand:
591 case Match_InvalidTiedOperand:
592 SMLoc ErrorLoc = IDLoc;
593 if (ErrorInfo != ~0U) {
594 if (ErrorInfo >= InstOperands.
size())
595 return Error(IDLoc,
"too few operands for instruction");
597 ErrorLoc = (
static_cast<HexagonOperand *
>(InstOperands[ErrorInfo].get()))
599 if (ErrorLoc == SMLoc())
602 return Error(ErrorLoc,
"invalid operand for instruction");
607void HexagonAsmParser::eatToEndOfPacket() {
609 AsmLexer &Lexer = getLexer();
616bool HexagonAsmParser::matchAndEmitInstruction(SMLoc IDLoc,
unsigned &Opcode,
620 bool MatchingInlineAsm) {
625 HexagonOperand &FirstOperand =
static_cast<HexagonOperand &
>(*
Operands[0]);
626 if (FirstOperand.isToken() && FirstOperand.getToken() ==
"{") {
627 assert(
Operands.size() == 1 &&
"Brackets should be by themselves");
629 getParser().Error(IDLoc,
"Already in a packet");
636 if (FirstOperand.isToken() && FirstOperand.getToken() ==
"}") {
637 assert(
Operands.size() == 1 &&
"Brackets should be by themselves");
639 getParser().Error(IDLoc,
"Not in a packet");
643 if (matchBundleOptions())
645 return finishBundle(IDLoc, Out);
647 MCInst *SubInst = getParser().getContext().createMCInst();
648 if (matchOneInstruction(*SubInst, IDLoc,
Operands, ErrorInfo,
649 MatchingInlineAsm)) {
655 getParser().
getContext(), MII, MCB, *SubInst);
658 return finishBundle(IDLoc, Out);
664bool HexagonAsmParser::parseDirectiveAttribute(SMLoc L) {
665 MCAsmParser &Parser = getParser();
673 return Error(TagLoc,
"attribute name not recognized: " + Name);
677 const MCExpr *AttrExpr;
684 if (check(!CE, TagLoc,
"expected numeric constant"))
687 Tag =
CE->getValue();
694 int64_t IntegerValue = 0;
696 const MCExpr *ValueExpr;
702 return Error(ValueExprLoc,
"expected numeric constant");
703 IntegerValue =
CE->getValue();
708 getTargetStreamer().emitAttribute(
Tag, IntegerValue);
713bool HexagonAsmParser::ParseDirective(AsmToken DirectiveID) {
715 if (IDVal.
lower() ==
".falign")
716 return ParseDirectiveFalign(256, DirectiveID.
getLoc());
717 if ((IDVal.
lower() ==
".lcomm") || (IDVal.
lower() ==
".lcommon"))
718 return ParseDirectiveComm(
true, DirectiveID.
getLoc());
719 if ((IDVal.
lower() ==
".comm") || (IDVal.
lower() ==
".common"))
720 return ParseDirectiveComm(
false, DirectiveID.
getLoc());
721 if (IDVal.
lower() ==
".subsection")
722 return ParseDirectiveSubsection(DirectiveID.
getLoc());
723 if (IDVal ==
".attribute")
724 return parseDirectiveAttribute(DirectiveID.
getLoc());
728bool HexagonAsmParser::ParseDirectiveSubsection(SMLoc L) {
729 const MCExpr *Subsection =
nullptr;
733 "Invalid subsection directive");
734 getParser().parseExpression(Subsection);
736 if (!Subsection->evaluateAsAbsolute(Res))
737 return Error(L,
"Cannot evaluate subsection number");
740 return TokError(
"unexpected token in directive");
746 if ((Res < 0) && (Res > -8193))
748 getStreamer().switchSection(getStreamer().getCurrentSectionOnly(), Res);
753bool HexagonAsmParser::ParseDirectiveFalign(
unsigned Size, SMLoc L) {
755 int64_t MaxBytesToFill = 15;
763 if (!getParser().parseExpression(
Value)) {
766 uint64_t IntValue = MCE->getValue();
768 return Error(ExprLoc,
"literal value out of range (256) for falign");
769 MaxBytesToFill = IntValue;
772 return Error(ExprLoc,
"not a valid expression for falign directive");
776 getTargetStreamer().emitFAlign(16, MaxBytesToFill);
788bool HexagonAsmParser::ParseDirectiveComm(
bool IsLocal, SMLoc Loc) {
791 if (getStreamer().hasRawTextSupport())
795 if (getParser().parseIdentifier(Name))
796 return TokError(
"expected identifier in directive");
801 return TokError(
"unexpected token in directive");
805 SMLoc SizeLoc = getLexer().getLoc();
806 if (getParser().parseAbsoluteExpression(
Size))
810 SMLoc ByteAlignmentLoc;
813 ByteAlignmentLoc = getLexer().getLoc();
814 if (getParser().parseAbsoluteExpression(ByteAlignment))
817 return Error(ByteAlignmentLoc,
"alignment must be a power of 2");
820 int64_t AccessAlignment = 0;
824 SMLoc AccessAlignmentLoc;
826 AccessAlignmentLoc = getLexer().getLoc();
827 if (getParser().parseAbsoluteExpression(AccessAlignment))
831 return Error(AccessAlignmentLoc,
"access alignment must be a power of 2");
835 return TokError(
"unexpected token in '.comm' or '.lcomm' directive");
842 return Error(SizeLoc,
"invalid '.comm' or '.lcomm' directive size, can't "
843 "be less than zero");
848 if (ByteAlignment < 0)
849 return Error(ByteAlignmentLoc,
"invalid '.comm' or '.lcomm' directive "
850 "alignment, can't be less than zero");
853 return Error(Loc,
"invalid symbol redefinition");
855 HexagonMCELFStreamer &HexagonELFStreamer =
856 static_cast<HexagonMCELFStreamer &
>(getStreamer());
859 Sym,
Size,
Align(ByteAlignment), AccessAlignment);
869bool HexagonAsmParser::RegisterMatchesArch(MCRegister MatchNum)
const {
870 if (getHexagonMCRegisterClass(Hexagon::V62RegsRegClassID).
contains(MatchNum))
884#define GET_MATCHER_IMPLEMENTATION
885#define GET_REGISTER_MATCHER
886#include "HexagonGenAsmMatcher.inc"
895 return static_cast<HexagonOperand &
>(Operand).
getToken().equals_insensitive(
908 AsmToken
const &Token = getParser().getTok();
910 SMLoc Loc = Token.
getLoc();
913 std::pair<StringRef, StringRef> HeadTail =
String.split(
'.');
914 if (!HeadTail.first.empty())
916 HexagonOperand::CreateToken(
getContext(), HeadTail.first, Loc));
917 if (!HeadTail.second.empty())
918 Operands.push_back(HexagonOperand::CreateToken(
921 }
while (!
String.empty());
929 AsmLexer &Lexer = getLexer();
930 if (!parseRegister(
Register, Begin, End)) {
941 Warning(Begin,
"Missing parenthesis around predicate register");
942 static char const *LParen =
"(";
943 static char const *RParen =
")";
945 HexagonOperand::CreateToken(
getContext(), LParen, Begin));
948 const AsmToken &MaybeDotNew = Lexer.
getTok();
949 if (MaybeDotNew.
is(AsmToken::TokenKind::Identifier) &&
953 HexagonOperand::CreateToken(
getContext(), RParen, Begin));
959 Warning(Begin,
"Missing parenthesis around predicate register");
960 static char const *LParen =
"(";
961 static char const *RParen =
")";
966 const AsmToken &MaybeDotNew = Lexer.
getTok();
967 if (MaybeDotNew.
is(AsmToken::TokenKind::Identifier) &&
971 HexagonOperand::CreateToken(
getContext(), RParen, Begin));
983bool HexagonAsmParser::isLabel(AsmToken &Token) {
984 AsmLexer &Lexer = getLexer();
985 AsmToken
const &Second = Lexer.
getTok();
986 AsmToken Third = Lexer.
peekTok();
988 if (Token.
is(AsmToken::TokenKind::LCurly) ||
989 Token.
is(AsmToken::TokenKind::RCurly))
995 if (!Token.
is(AsmToken::TokenKind::Identifier))
997 if (!matchRegister(
String.lower()))
1002 std::string Collapsed = std::string(Raw);
1004 StringRef Whole = Collapsed;
1005 std::pair<StringRef, StringRef> DotSplit = Whole.
split(
'.');
1006 if (!matchRegister(DotSplit.first.lower()))
1015bool HexagonAsmParser::handleNoncontigiousRegister(
bool Contigious,
1018 Error(Loc,
"Register name is not contigious");
1022 Warning(Loc,
"Register name is not contigious");
1026bool HexagonAsmParser::parseRegister(MCRegister &
Reg, SMLoc &StartLoc,
1028 return !tryParseRegister(
Reg, StartLoc, EndLoc).isSuccess();
1031ParseStatus HexagonAsmParser::tryParseRegister(MCRegister &
Reg, SMLoc &StartLoc,
1033 AsmLexer &Lexer = getLexer();
1034 StartLoc = getLexer().getLoc();
1038 bool NeededWorkaround =
false;
1040 AsmToken
const &Token = Lexer.
getTok();
1041 RawString = StringRef(RawString.data(), Token.
getString().
data() -
1047 Lookahead.
back().getString().data() +
1048 Lookahead.
back().getString().size();
1054 Again = (Contigious &&
Type) || (Workaround &&
Type);
1055 NeededWorkaround = NeededWorkaround || (Again && !(Contigious &&
Type));
1057 std::string Collapsed = std::string(RawString);
1059 StringRef FullString = Collapsed;
1060 std::pair<StringRef, StringRef> DotSplit = FullString.
split(
'.');
1061 MCRegister DotReg = matchRegister(DotSplit.first.lower());
1062 if (DotReg && RegisterMatchesArch(DotReg)) {
1063 if (DotSplit.second.empty()) {
1066 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1071 size_t First = RawString.find(
'.');
1072 StringRef DotString (RawString.data() +
First, RawString.size() -
First);
1075 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1080 std::pair<StringRef, StringRef> ColonSplit = StringRef(FullString).split(
':');
1081 MCRegister ColonReg = matchRegister(ColonSplit.first.lower());
1082 if (ColonReg && RegisterMatchesArch(DotReg)) {
1088 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1092 while (!Lookahead.
empty()) {
1112bool HexagonAsmParser::parseExpression(MCExpr
const *&Expr) {
1114 AsmLexer &Lexer = getLexer();
1116 static char const *
Comma =
",";
1120 switch (Tokens.
back().getKind()) {
1121 case AsmToken::TokenKind::Hash:
1122 if (Tokens.
size() > 1)
1123 if ((Tokens.
end() - 2)->getKind() == AsmToken::TokenKind::Plus) {
1125 AsmToken(AsmToken::TokenKind::Comma, Comma));
1129 case AsmToken::TokenKind::RCurly:
1130 case AsmToken::TokenKind::EndOfStatement:
1131 case AsmToken::TokenKind::Eof:
1138 while (!Tokens.
empty()) {
1142 SMLoc Loc = Lexer.
getLoc();
1143 return getParser().parseExpression(Expr, Loc);
1147 if (implicitExpressionLocation(
Operands)) {
1148 MCAsmParser &Parser = getParser();
1150 MCExpr
const *Expr =
nullptr;
1151 bool Error = parseExpression(Expr);
1155 HexagonOperand::CreateImm(
getContext(), Expr, Loc, Loc));
1163 MCAsmParser &Parser = getParser();
1164 AsmLexer &Lexer = getLexer();
1166 AsmToken
const &Token = Parser.
getTok();
1176 Operands.push_back(HexagonOperand::CreateToken(
1183 Operands.push_back(HexagonOperand::CreateToken(
1199 Operands.push_back(HexagonOperand::CreateToken(
1201 Operands.push_back(HexagonOperand::CreateToken(
1207 bool MustNotExtend =
false;
1208 bool ImplicitExpression = implicitExpressionLocation(
Operands);
1209 SMLoc ExprLoc = Lexer.
getLoc();
1210 if (!ImplicitExpression)
1211 Operands.push_back(HexagonOperand::CreateToken(
1214 bool MustExtend =
false;
1215 bool HiOnly =
false;
1216 bool LoOnly =
false;
1220 }
else if (ImplicitExpression)
1221 MustNotExtend =
true;
1222 AsmToken
const &Token = Parser.
getTok();
1225 if (
String.lower() ==
"hi") {
1227 }
else if (
String.lower() ==
"lo") {
1230 if (HiOnly || LoOnly) {
1231 AsmToken LParen = Lexer.
peekTok();
1240 MCExpr
const *Expr =
nullptr;
1241 if (parseExpression(Expr))
1246 if (Expr->evaluateAsAbsolute(
Value)) {
1250 if (HiOnly || LoOnly)
1256 if (!
Value.isAbsolute()) {
1261 MustNotExtend = !MustExtend;
1272 std::unique_ptr<HexagonOperand> Operand =
1273 HexagonOperand::CreateImm(
getContext(), Expr, ExprLoc, ExprLoc);
1274 Operands.push_back(std::move(Operand));
1280 if (parseExpressionOrOperand(
Operands))
1285bool HexagonAsmParser::parseInstruction(ParseInstructionInfo &Info,
1286 StringRef Name, AsmToken ID,
1288 getLexer().UnLex(ID);
1305unsigned HexagonAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
1307 HexagonOperand *
Op =
static_cast<HexagonOperand *
>(&AsmOp);
1312 return Op->isImm() &&
Op->Imm.Val->evaluateAsAbsolute(
Value) &&
Value == 0
1314 : Match_InvalidOperand;
1318 return Op->isImm() &&
Op->Imm.Val->evaluateAsAbsolute(
Value) &&
Value == 1
1320 : Match_InvalidOperand;
1323 if (
Op->Kind == HexagonOperand::Token && Kind != InvalidMatchClass) {
1324 StringRef myStringRef = StringRef(
Op->Tok.Data,
Op->Tok.Length);
1325 if (matchTokenString(myStringRef.
lower()) == (MatchClassKind)Kind)
1326 return Match_Success;
1327 if (matchTokenString(myStringRef.
upper()) == (MatchClassKind)Kind)
1328 return Match_Success;
1335 return Match_InvalidOperand;
1339bool HexagonAsmParser::OutOfRange(SMLoc IDLoc,
long long Val,
long long Max) {
1341 raw_string_ostream ES(errStr);
1342 ES <<
"value " << Val <<
"(" <<
format_hex(Val, 0) <<
") out of range: ";
1346 ES <<
Max <<
"-" << (-
Max - 1);
1350int HexagonAsmParser::processInstruction(MCInst &Inst,
1353 MCContext &
Context = getParser().getContext();
1354 const MCRegisterInfo *RI =
getContext().getRegisterInfo();
1355 const std::string r =
"r";
1356 const std::string Colon =
":";
1357 using RegPairVals = std::pair<unsigned, unsigned>;
1358 auto GetRegPair = [
this, r](RegPairVals RegPair) {
1359 const std::string R1 = r +
utostr(RegPair.first);
1360 const std::string
R2 = r +
utostr(RegPair.second);
1362 return std::make_pair(matchRegister(R1), matchRegister(
R2));
1364 auto GetScalarRegs = [RI, GetRegPair](MCRegister RegPair) {
1366 const RegPairVals RegPair_ = std::make_pair(
Lower + 1,
Lower);
1368 return GetRegPair(RegPair_);
1370 auto GetVecRegs = [GetRegPair](MCRegister VecRegPair) {
1371 const RegPairVals RegPair =
1374 return GetRegPair(RegPair);
1377 bool is32bit =
false;
1381 SMDiagnostic Diag = getSourceManager().GetMessage(
1383 "Found pseudo instruction with no expansion");
1389 case Hexagon::J2_trap1:
1390 if (!getSTI().
hasFeature(Hexagon::ArchV65)) {
1393 if (Rx.
getReg() != Hexagon::R0 || Ry.
getReg() != Hexagon::R0) {
1394 Error(IDLoc,
"trap1 can only have register r0 as operand");
1395 return Match_InvalidOperand;
1400 case Hexagon::A2_iconst: {
1412 case Hexagon::M4_mpyrr_addr:
1413 case Hexagon::S4_addi_asl_ri:
1414 case Hexagon::S4_addi_lsr_ri:
1415 case Hexagon::S4_andi_asl_ri:
1416 case Hexagon::S4_andi_lsr_ri:
1417 case Hexagon::S4_ori_asl_ri:
1418 case Hexagon::S4_ori_lsr_ri:
1419 case Hexagon::S4_or_andix:
1420 case Hexagon::S4_subi_asl_ri:
1421 case Hexagon::S4_subi_lsr_ri: {
1425 return Match_InvalidOperand;
1429 case Hexagon::C2_cmpgei: {
1439 case Hexagon::C2_cmpgeui: {
1465 case Hexagon::A2_tfrp: {
1467 const std::pair<MCRegister, MCRegister> RegPair =
1468 GetScalarRegs(MO.
getReg());
1469 MO.
setReg(RegPair.first);
1475 case Hexagon::A2_tfrpt:
1476 case Hexagon::A2_tfrpf: {
1478 const std::pair<MCRegister, MCRegister> RegPair =
1479 GetScalarRegs(MO.
getReg());
1480 MO.
setReg(RegPair.first);
1483 ? Hexagon::C2_ccombinewt
1484 : Hexagon::C2_ccombinewf);
1487 case Hexagon::A2_tfrptnew:
1488 case Hexagon::A2_tfrpfnew: {
1490 const std::pair<MCRegister, MCRegister> RegPair =
1491 GetScalarRegs(MO.
getReg());
1492 MO.
setReg(RegPair.first);
1495 ? Hexagon::C2_ccombinewnewt
1496 : Hexagon::C2_ccombinewnewf);
1501 case Hexagon::V6_vassignp: {
1503 const std::pair<MCRegister, MCRegister> RegPair = GetVecRegs(MO.
getReg());
1504 MO.
setReg(RegPair.first);
1511 case Hexagon::CONST32:
1515 case Hexagon::CONST64:
1518 MCELFStreamer *MES =
static_cast<MCELFStreamer *
>(&Parser.
getStreamer());
1525 std::string myCharStr;
1526 MCSectionELF *mySection;
1536 myCharStr = StringRef(
".gnu.linkonce.l4.CONST_00000000")
1537 .drop_back(myImmStr.size())
1542 myCharStr = StringRef(
".gnu.linkonce.l8.CONST_0000000000000000")
1543 .drop_back(myImmStr.size())
1550 }
else if (MO_1.
isExpr()) {
1552 myCharStr =
".lita";
1559 unsigned byteSize = is32bit ? 4 : 8;
1568 Sym =
getContext().getOrCreateSymbol(StringRef(myCharStr.c_str() + 16));
1570 getStreamer().emitLabel(Sym);
1571 getStreamer().emitSymbolAttribute(Sym,
MCSA_Global);
1574 }
else if (MO_1.
isExpr()) {
1575 const char *StringStart =
nullptr;
1576 const char *StringEnd =
nullptr;
1578 StringStart =
Operands[5]->getStartLoc().getPointer();
1579 StringEnd =
Operands[6]->getStartLoc().getPointer();
1581 StringStart =
Operands[4]->getStartLoc().getPointer();
1582 StringEnd =
Operands[5]->getStartLoc().getPointer();
1585 unsigned size = StringEnd - StringStart;
1586 std::string DotConst =
".CONST_";
1587 Sym =
getContext().getOrCreateSymbol(DotConst +
1588 StringRef(StringStart,
size));
1592 getStreamer().emitLabel(Sym);
1593 getStreamer().emitSymbolAttribute(Sym,
MCSA_Local);
1594 getStreamer().emitValue(MO_1.
getExpr(), 4);
1604 TmpInst.
setOpcode(Hexagon::L2_loadrigp);
1606 TmpInst.
setOpcode(Hexagon::L2_loadrdgp);
1617 case Hexagon::A2_tfrpi: {
1629 case Hexagon::TFRI64_V4: {
1636 OutOfRange(IDLoc, s8, -128);
1654 case Hexagon::TFRI64_V2_ext: {
1661 if (s8 < -128 || s8 > 127)
1662 OutOfRange(IDLoc, s8, -128);
1669 case Hexagon::A4_combineii: {
1675 if (s8 < -128 || s8 > 127)
1676 OutOfRange(IDLoc, s8, -128);
1683 case Hexagon::S2_tableidxb_goodsyntax:
1687 case Hexagon::S2_tableidxh_goodsyntax: {
1697 TmpInst.
setOpcode(Hexagon::S2_tableidxh);
1707 case Hexagon::S2_tableidxw_goodsyntax: {
1717 TmpInst.
setOpcode(Hexagon::S2_tableidxw);
1727 case Hexagon::S2_tableidxd_goodsyntax: {
1737 TmpInst.
setOpcode(Hexagon::S2_tableidxd);
1747 case Hexagon::M2_mpyui:
1750 case Hexagon::M2_mpysmi: {
1756 MCExpr
const &Expr = *
Imm.getExpr();
1759 return Match_InvalidOperand;
1762 return Match_InvalidOperand;
1776 case Hexagon::S2_asr_i_r_rnd_goodsyntax: {
1782 return Match_InvalidOperand;
1794 TmpInst.
setOpcode(Hexagon::S2_asr_i_r_rnd);
1805 case Hexagon::S2_asr_i_p_rnd_goodsyntax: {
1812 return Match_InvalidOperand;
1816 std::string R1 = r +
utostr(RegPairNum + 1);
1818 Rss.
setReg(matchRegister(Reg1));
1820 std::string
R2 = r +
utostr(RegPairNum);
1822 TmpInst.
setOpcode(Hexagon::A2_combinew);
1832 Inst.
setOpcode(Hexagon::S2_asr_i_p_rnd);
1837 case Hexagon::A4_boundscheck: {
1841 Inst.
setOpcode(Hexagon::A4_boundscheck_hi);
1843 StringRef RegPair =
Name;
1844 Rs.
setReg(matchRegister(RegPair));
1846 Inst.
setOpcode(Hexagon::A4_boundscheck_lo);
1848 StringRef RegPair =
Name;
1849 Rs.
setReg(matchRegister(RegPair));
1854 case Hexagon::A2_addsp: {
1860 StringRef RegPair =
Name;
1861 Rs.
setReg(matchRegister(RegPair));
1865 StringRef RegPair =
Name;
1866 Rs.
setReg(matchRegister(RegPair));
1871 case Hexagon::M2_vrcmpys_s1: {
1875 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1_h);
1877 StringRef RegPair =
Name;
1878 Rt.
setReg(matchRegister(RegPair));
1880 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1_l);
1882 StringRef RegPair =
Name;
1883 Rt.
setReg(matchRegister(RegPair));
1888 case Hexagon::M2_vrcmpys_acc_s1: {
1895 TmpInst.
setOpcode(Hexagon::M2_vrcmpys_acc_s1_h);
1897 StringRef RegPair =
Name;
1898 Rt.
setReg(matchRegister(RegPair));
1900 TmpInst.
setOpcode(Hexagon::M2_vrcmpys_acc_s1_l);
1902 StringRef RegPair =
Name;
1903 Rt.
setReg(matchRegister(RegPair));
1914 case Hexagon::M2_vrcmpys_s1rp: {
1918 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1rp_h);
1920 StringRef RegPair =
Name;
1921 Rt.
setReg(matchRegister(RegPair));
1923 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1rp_l);
1925 StringRef RegPair =
Name;
1926 Rt.
setReg(matchRegister(RegPair));
1931 case Hexagon::S5_asrhub_rnd_sat_goodsyntax: {
1936 return Match_InvalidOperand;
1944 Inst.
setOpcode(Hexagon::S5_asrhub_rnd_sat);
1949 case Hexagon::S5_vasrhrnd_goodsyntax: {
1956 return Match_InvalidOperand;
1960 std::string R1 = r +
utostr(RegPairNum + 1);
1962 Rss.
setReg(matchRegister(Reg1));
1964 std::string
R2 = r +
utostr(RegPairNum);
1966 TmpInst.
setOpcode(Hexagon::A2_combinew);
1981 case Hexagon::A2_not: {
1993 case Hexagon::PS_loadrubabs:
1997 case Hexagon::PS_loadrbabs:
2001 case Hexagon::PS_loadruhabs:
2005 case Hexagon::PS_loadrhabs:
2009 case Hexagon::PS_loadriabs:
2013 case Hexagon::PS_loadrdabs:
2017 case Hexagon::PS_storerbabs:
2021 case Hexagon::PS_storerhabs:
2025 case Hexagon::PS_storerfabs:
2029 case Hexagon::PS_storeriabs:
2033 case Hexagon::PS_storerdabs:
2037 case Hexagon::PS_storerbnewabs:
2039 Inst.
setOpcode(Hexagon::S2_storerbnewgp);
2041 case Hexagon::PS_storerhnewabs:
2043 Inst.
setOpcode(Hexagon::S2_storerhnewgp);
2045 case Hexagon::PS_storerinewabs:
2047 Inst.
setOpcode(Hexagon::S2_storerinewgp);
2049 case Hexagon::A2_zxtb: {
2057 return Match_Success;
2060MCRegister HexagonAsmParser::matchRegister(StringRef Name) {
static MCRegister MatchRegisterName(StringRef Name)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isNot(const MachineRegisterInfo &MRI, const MachineInstr &MI)
static MCRegister MatchRegisterAltName(StringRef Name)
Maps from the set of all alternative registernames to a register number.
static size_t byteSize(BTF::CommonType *Type)
static constexpr unsigned long long mask(BlockVerifier::State S)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static cl::opt< bool > AddBuildAttributes("csky-add-build-attributes", cl::init(true))
#define LLVM_EXTERNAL_VISIBILITY
static bool isSigned(unsigned Opcode)
static cl::opt< bool > WarnSignedMismatch("mwarn-sign-mismatch", cl::desc("Warn for mismatching a signed and unsigned value"), cl::init(false))
static cl::opt< bool > ErrorMissingParenthesis("merror-missing-parenthesis", cl::desc("Error for missing parenthesis around predicate registers"), cl::init(false))
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonAsmParser()
Force static initialization.
static cl::opt< bool > WarnNoncontigiousRegister("mwarn-noncontigious-register", cl::desc("Warn for register names that aren't contigious"), cl::init(true))
static cl::opt< bool > ErrorNoncontigiousRegister("merror-noncontigious-register", cl::desc("Error for register names that aren't contigious"), cl::init(false))
static bool previousEqual(OperandVector &Operands, size_t Index, StringRef String)
static MCInst makeCombineInst(int opCode, MCOperand &Rdd, MCOperand &MO1, MCOperand &MO2)
static bool previousIsLoop(OperandVector &Operands, size_t Index)
static cl::opt< bool > WarnMissingParenthesis("mwarn-missing-parenthesis", cl::desc("Warn for missing parenthesis around predicate registers"), cl::init(true))
static cl::opt< bool > AddBuildAttributes("hexagon-add-build-attributes")
Value * getPointer(Value *Ptr)
static bool hasFeature(StringRef Feature, const FeatureBitset &FeatureBits, ArrayRef< SubtargetFeatureKV > ProcFeatures)
Promote Memory to Register
static MCRegister getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
static bool isReg(const MCInst &MI, unsigned OpNo)
Func getContext().diagnose(DiagnosticInfoUnsupported(Func
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
This file defines the SmallVector class.
SMLoc getLoc() const
Get the current source location.
const AsmToken peekTok(bool ShouldSkipSpace=true)
Look ahead at the next token to be lexed.
void UnLex(AsmToken const &Token)
const AsmToken & getTok() const
Get the current (last) lexed token.
bool is(AsmToken::TokenKind K) const
Check if the current token has kind K.
const AsmToken & Lex()
Consume the next token from the input stream and return it.
LLVM_ABI SMLoc getLoc() const
StringRef getString() const
Get the string for the current token, this includes all characters (for example, the quotes on string...
bool is(TokenKind K) const
TokenKind getKind() const
StringRef getIdentifier() const
Get the identifier string for the current token, which should be an identifier or a string.
void HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, unsigned AccessSize)
void HexagonMCEmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, unsigned AccessSize)
void setMustNotExtend(bool Val=true)
bool mustNotExtend() const
static HexagonMCExpr * create(MCExpr const *Expr, MCContext &Ctx)
void setMustExtend(bool Val=true)
void setSignMismatch(bool Val=true)
This class is intended to be used as a base class for asm properties and features specific to the tar...
void printExpr(raw_ostream &, const MCExpr &) const
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
Generic assembler parser interface, for use by target specific assembly parsers.
virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc)=0
Parse an arbitrary expression.
const AsmToken & getTok() const
Get the current AsmToken from the stream.
virtual const AsmToken & Lex()=0
Get the next AsmToken in the stream, possibly handling file inclusion first.
virtual void addAliasForDirective(StringRef Directive, StringRef Alias)=0
virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range={})=0
Emit an error at the location L, with the message Msg.
MCStreamer & getStreamer()
static const MCBinaryExpr * createLShr(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static const MCBinaryExpr * createAnd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static const MCBinaryExpr * createSub(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
LLVM_ABI bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm) const
Try to evaluate the expression to a relocatable value, i.e.
@ Unary
Unary expressions.
@ SymbolRef
References to labels and assigned expressions.
@ Binary
Binary expressions.
LLVM_ABI bool evaluateAsAbsolute(int64_t &Res) const
Try to evaluate the expression to an absolute value.
Instances of this class represent a single low-level machine instruction.
unsigned getOpcode() const
LLVM_ABI void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer=nullptr, StringRef Separator=" ", const MCContext *Ctx=nullptr) const
Dump the MCInst as prettily as possible using the additional MC structures, if given.
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
const MCOperand & getOperand(unsigned i) const
Interface to description of machine instruction set.
MCAssembler & getAssembler()
Instances of this class represent operands of the MCInst class.
static MCOperand createExpr(const MCExpr *Val)
void setExpr(const MCExpr *Val)
static MCOperand createReg(MCRegister Reg)
static MCOperand createImm(int64_t Val)
void setReg(MCRegister Reg)
Set the register number.
MCRegister getReg() const
Returns the register number.
const MCExpr * getExpr() const
static MCOperand createInst(const MCInst *Val)
MCParsedAsmOperand - This abstract class represents a source-level assembly instruction operand.
virtual bool isToken() const =0
isToken - Is this a token operand?
uint16_t getEncodingValue(MCRegister Reg) const
Returns the encoding for Reg.
constexpr unsigned id() const
virtual bool popSection()
Restore the current and previous section from the section stack.
virtual void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI)
Emit the given Instruction into the current section.
virtual bool hasRawTextSupport() const
Return true if this asm streamer supports emitting unformatted text to the .s file with EmitRawText.
MCTargetStreamer * getTargetStreamer()
void pushSection()
Save the current and previous section on the section stack.
virtual void switchSection(MCSection *Section, uint32_t Subsec=0)
Set the current section where code is being emitted to Section.
Generic base class for all target subtargets.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
MCTargetAsmParser - Generic interface to target specific assembly parsers.
Target specific streamer interface.
MCStreamer & getStreamer()
static constexpr StatusTy Success
static constexpr StatusTy NoMatch
LLVM_ABI void print(const char *ProgName, raw_ostream &S, bool ShowColors=true, bool ShowKindLabel=true, bool ShowLocation=true) const
reference emplace_back(ArgTypes &&... Args)
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
LLVM_ABI std::string upper() const
Convert the given ASCII string to uppercase.
constexpr size_t size() const
Get the string size.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
LLVM_ABI std::string lower() const
bool equals_insensitive(StringRef RHS) const
Check for string equality, ignoring case.
LLVM_ABI int compare_insensitive(StringRef RHS) const
Compare two strings, ignoring case.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
LLVM_ABI std::optional< unsigned > attrTypeFromString(StringRef tag, TagNameMap tagNameMap)
LLVM_ABI const TagNameMap & getHexagonAttributeTags()
std::pair< unsigned, unsigned > GetVecRegPairIndices(MCRegister VecRegPair)
Returns an ordered pair of the constituent register ordinals for each of the elements of VecRegPair.
void setOuterLoop(MCInst &MCI)
bool isOuterLoop(MCInst const &MCI)
size_t bundleSize(MCInst const &MCI)
void setS27_2_reloc(MCExpr const &Expr, bool Val=true)
void setInnerLoop(MCInst &MCI)
MCInstrDesc const & getDesc(MCInstrInfo const &MCII, MCInst const &MCI)
void setMemReorderDisabled(MCInst &MCI)
bool isBundle(MCInst const &MCI)
MCExpr const & getExpr(MCExpr const &Expr)
bool isInnerLoop(MCInst const &MCI)
bool canonicalizePacket(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCContext &Context, MCInst &MCB, HexagonMCChecker *Checker, bool AttemptCompatibility=false)
void setMustNotExtend(MCExpr const &Expr, bool Val=true)
void extendIfNeeded(MCContext &Context, MCInstrInfo const &MCII, MCInst &MCB, MCInst const &MCI)
bool mustExtend(MCExpr const &Expr)
void setMustExtend(MCExpr const &Expr, bool Val=true)
@ CE
Windows NT (Windows on ARM)
bool isPseudo(uint64_t TSFlags)
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
static bool isMem(const MachineInstr &MI, unsigned Op)
LLVM_ABI std::pair< StringRef, StringRef > getToken(StringRef Source, StringRef Delimiters=" \t\n\v\f\r")
getToken - This function extracts one token from source, ignoring any leading characters that appear ...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
constexpr bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
std::string utohexstr(uint64_t X, bool LowerCase=false, unsigned Width=0)
std::string utostr(uint64_t X, bool isNeg=false)
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
Target & getTheHexagonTarget()
SmallVectorImpl< std::unique_ptr< MCParsedAsmOperand > > OperandVector
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
constexpr uint32_t Hi_32(uint64_t Value)
Return the high 32 bits of a 64 bit value.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
constexpr uint32_t Lo_32(uint64_t Value)
Return the low 32 bits of a 64 bit value.
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
bool isSpace(char C)
Checks whether character C is whitespace in the "C" locale.
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
@ MCSA_Global
.type _foo, @gnu_unique_object
RegisterMCAsmParser - Helper template for registering a target specific assembly parser,...