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();
497 Out.emitInstruction(MCB, STI);
504bool HexagonAsmParser::matchBundleOptions() {
505 MCAsmParser &Parser = getParser();
510 char const *MemNoShuffMsg =
511 "invalid instruction packet: mem_noshuf specifier not "
512 "supported with this architecture";
523 if (getSTI().
hasFeature(Hexagon::FeatureMemNoShuf))
526 return getParser().Error(IDLoc, MemNoShuffMsg);
530 return getParser().Error(IDLoc, llvm::Twine(
"'") + Option +
531 "' is not a valid bundle option");
539void HexagonAsmParser::canonicalizeImmediates(MCInst &MCI) {
542 for (MCOperand &
I : MCI)
544 int64_t
Value(
I.getImm());
550 Warning(MCI.getLoc(),
"Signed/Unsigned mismatch");
556bool HexagonAsmParser::matchOneInstruction(MCInst &MCI, SMLoc IDLoc,
559 bool MatchingInlineAsm) {
562 MatchInstructionImpl(InstOperands, MCI, ErrorInfo, MatchingInlineAsm);
563 if (result == Match_Success) {
565 canonicalizeImmediates(MCI);
566 result = processInstruction(MCI, InstOperands, IDLoc);
584 case Match_MissingFeature:
585 return Error(IDLoc,
"invalid instruction");
586 case Match_MnemonicFail:
587 return Error(IDLoc,
"unrecognized instruction");
588 case Match_InvalidOperand:
590 case Match_InvalidTiedOperand:
591 SMLoc ErrorLoc = IDLoc;
592 if (ErrorInfo != ~0U) {
593 if (ErrorInfo >= InstOperands.
size())
594 return Error(IDLoc,
"too few operands for instruction");
596 ErrorLoc = (
static_cast<HexagonOperand *
>(InstOperands[ErrorInfo].get()))
598 if (ErrorLoc == SMLoc())
601 return Error(ErrorLoc,
"invalid operand for instruction");
606void HexagonAsmParser::eatToEndOfPacket() {
608 AsmLexer &Lexer = getLexer();
615bool HexagonAsmParser::matchAndEmitInstruction(SMLoc IDLoc,
unsigned &Opcode,
619 bool MatchingInlineAsm) {
624 HexagonOperand &FirstOperand =
static_cast<HexagonOperand &
>(*
Operands[0]);
625 if (FirstOperand.isToken() && FirstOperand.getToken() ==
"{") {
626 assert(
Operands.size() == 1 &&
"Brackets should be by themselves");
628 getParser().Error(IDLoc,
"Already in a packet");
635 if (FirstOperand.isToken() && FirstOperand.getToken() ==
"}") {
636 assert(
Operands.size() == 1 &&
"Brackets should be by themselves");
638 getParser().Error(IDLoc,
"Not in a packet");
642 if (matchBundleOptions())
644 return finishBundle(IDLoc, Out);
646 MCInst *SubInst = getParser().getContext().createMCInst();
647 if (matchOneInstruction(*SubInst, IDLoc,
Operands, ErrorInfo,
648 MatchingInlineAsm)) {
654 getParser().
getContext(), MII, MCB, *SubInst);
657 return finishBundle(IDLoc, Out);
663bool HexagonAsmParser::parseDirectiveAttribute(SMLoc L) {
664 MCAsmParser &Parser = getParser();
672 return Error(TagLoc,
"attribute name not recognized: " + Name);
676 const MCExpr *AttrExpr;
683 if (check(!CE, TagLoc,
"expected numeric constant"))
686 Tag =
CE->getValue();
693 int64_t IntegerValue = 0;
695 const MCExpr *ValueExpr;
701 return Error(ValueExprLoc,
"expected numeric constant");
702 IntegerValue =
CE->getValue();
707 getTargetStreamer().emitAttribute(
Tag, IntegerValue);
712bool HexagonAsmParser::ParseDirective(AsmToken DirectiveID) {
714 if (IDVal.
lower() ==
".falign")
715 return ParseDirectiveFalign(256, DirectiveID.
getLoc());
716 if ((IDVal.
lower() ==
".lcomm") || (IDVal.
lower() ==
".lcommon"))
717 return ParseDirectiveComm(
true, DirectiveID.
getLoc());
718 if ((IDVal.
lower() ==
".comm") || (IDVal.
lower() ==
".common"))
719 return ParseDirectiveComm(
false, DirectiveID.
getLoc());
720 if (IDVal.
lower() ==
".subsection")
721 return ParseDirectiveSubsection(DirectiveID.
getLoc());
722 if (IDVal ==
".attribute")
723 return parseDirectiveAttribute(DirectiveID.
getLoc());
727bool HexagonAsmParser::ParseDirectiveSubsection(SMLoc L) {
728 const MCExpr *Subsection =
nullptr;
732 "Invalid subsection directive");
733 getParser().parseExpression(Subsection);
735 if (!Subsection->evaluateAsAbsolute(Res))
736 return Error(L,
"Cannot evaluate subsection number");
739 return TokError(
"unexpected token in directive");
745 if ((Res < 0) && (Res > -8193))
747 getStreamer().switchSection(getStreamer().getCurrentSectionOnly(), Res);
752bool HexagonAsmParser::ParseDirectiveFalign(
unsigned Size, SMLoc L) {
754 int64_t MaxBytesToFill = 15;
762 if (!getParser().parseExpression(
Value)) {
765 uint64_t IntValue = MCE->getValue();
767 return Error(ExprLoc,
"literal value out of range (256) for falign");
768 MaxBytesToFill = IntValue;
771 return Error(ExprLoc,
"not a valid expression for falign directive");
775 getTargetStreamer().emitFAlign(16, MaxBytesToFill);
787bool HexagonAsmParser::ParseDirectiveComm(
bool IsLocal, SMLoc Loc) {
790 if (getStreamer().hasRawTextSupport())
794 if (getParser().parseIdentifier(Name))
795 return TokError(
"expected identifier in directive");
800 return TokError(
"unexpected token in directive");
804 SMLoc SizeLoc = getLexer().getLoc();
805 if (getParser().parseAbsoluteExpression(
Size))
809 SMLoc ByteAlignmentLoc;
812 ByteAlignmentLoc = getLexer().getLoc();
813 if (getParser().parseAbsoluteExpression(ByteAlignment))
816 return Error(ByteAlignmentLoc,
"alignment must be a power of 2");
819 int64_t AccessAlignment = 0;
823 SMLoc AccessAlignmentLoc;
825 AccessAlignmentLoc = getLexer().getLoc();
826 if (getParser().parseAbsoluteExpression(AccessAlignment))
830 return Error(AccessAlignmentLoc,
"access alignment must be a power of 2");
834 return TokError(
"unexpected token in '.comm' or '.lcomm' directive");
841 return Error(SizeLoc,
"invalid '.comm' or '.lcomm' directive size, can't "
842 "be less than zero");
847 if (ByteAlignment < 0)
848 return Error(ByteAlignmentLoc,
"invalid '.comm' or '.lcomm' directive "
849 "alignment, can't be less than zero");
852 return Error(Loc,
"invalid symbol redefinition");
854 HexagonMCELFStreamer &HexagonELFStreamer =
855 static_cast<HexagonMCELFStreamer &
>(getStreamer());
858 Sym,
Size,
Align(ByteAlignment), AccessAlignment);
868bool HexagonAsmParser::RegisterMatchesArch(MCRegister MatchNum)
const {
869 if (getHexagonMCRegisterClass(Hexagon::V62RegsRegClassID).
contains(MatchNum))
883#define GET_MATCHER_IMPLEMENTATION
884#define GET_REGISTER_MATCHER
885#include "HexagonGenAsmMatcher.inc"
894 return static_cast<HexagonOperand &
>(Operand).
getToken().equals_insensitive(
907 AsmToken
const &Token = getParser().getTok();
909 SMLoc Loc = Token.
getLoc();
912 std::pair<StringRef, StringRef> HeadTail =
String.split(
'.');
913 if (!HeadTail.first.empty())
915 HexagonOperand::CreateToken(
getContext(), HeadTail.first, Loc));
916 if (!HeadTail.second.empty())
917 Operands.push_back(HexagonOperand::CreateToken(
920 }
while (!
String.empty());
928 AsmLexer &Lexer = getLexer();
940 Warning(Begin,
"Missing parenthesis around predicate register");
941 static char const *LParen =
"(";
942 static char const *RParen =
")";
944 HexagonOperand::CreateToken(
getContext(), LParen, Begin));
947 const AsmToken &MaybeDotNew = Lexer.
getTok();
948 if (MaybeDotNew.
is(AsmToken::TokenKind::Identifier) &&
952 HexagonOperand::CreateToken(
getContext(), RParen, Begin));
958 Warning(Begin,
"Missing parenthesis around predicate register");
959 static char const *LParen =
"(";
960 static char const *RParen =
")";
965 const AsmToken &MaybeDotNew = Lexer.
getTok();
966 if (MaybeDotNew.
is(AsmToken::TokenKind::Identifier) &&
970 HexagonOperand::CreateToken(
getContext(), RParen, Begin));
982bool HexagonAsmParser::isLabel(AsmToken &Token) {
983 AsmLexer &Lexer = getLexer();
984 AsmToken
const &Second = Lexer.
getTok();
985 AsmToken Third = Lexer.
peekTok();
987 if (Token.
is(AsmToken::TokenKind::LCurly) ||
988 Token.
is(AsmToken::TokenKind::RCurly))
994 if (!Token.
is(AsmToken::TokenKind::Identifier))
996 if (!matchRegister(
String.lower()))
1001 std::string Collapsed = std::string(Raw);
1003 StringRef Whole = Collapsed;
1004 std::pair<StringRef, StringRef> DotSplit = Whole.
split(
'.');
1005 if (!matchRegister(DotSplit.first.lower()))
1014bool HexagonAsmParser::handleNoncontigiousRegister(
bool Contigious,
1017 Error(Loc,
"Register name is not contigious");
1021 Warning(Loc,
"Register name is not contigious");
1025bool HexagonAsmParser::parseRegister(MCRegister &
Reg, SMLoc &StartLoc,
1027 return !tryParseRegister(
Reg, StartLoc, EndLoc).isSuccess();
1030ParseStatus HexagonAsmParser::tryParseRegister(MCRegister &
Reg, SMLoc &StartLoc,
1032 AsmLexer &Lexer = getLexer();
1033 StartLoc = getLexer().getLoc();
1037 bool NeededWorkaround =
false;
1039 AsmToken
const &Token = Lexer.
getTok();
1040 RawString = StringRef(RawString.data(), Token.
getString().
data() -
1046 Lookahead.
back().getString().data() +
1047 Lookahead.
back().getString().size();
1053 Again = (Contigious &&
Type) || (Workaround &&
Type);
1054 NeededWorkaround = NeededWorkaround || (Again && !(Contigious &&
Type));
1056 std::string Collapsed = std::string(RawString);
1058 StringRef FullString = Collapsed;
1059 std::pair<StringRef, StringRef> DotSplit = FullString.
split(
'.');
1060 MCRegister DotReg = matchRegister(DotSplit.first.lower());
1061 if (DotReg && RegisterMatchesArch(DotReg)) {
1062 if (DotSplit.second.empty()) {
1065 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1070 size_t First = RawString.find(
'.');
1071 StringRef DotString (RawString.data() +
First, RawString.size() -
First);
1074 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1079 std::pair<StringRef, StringRef> ColonSplit = StringRef(FullString).split(
':');
1080 MCRegister ColonReg = matchRegister(ColonSplit.first.lower());
1081 if (ColonReg && RegisterMatchesArch(DotReg)) {
1087 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1091 while (!Lookahead.
empty()) {
1111bool HexagonAsmParser::parseExpression(MCExpr
const *&Expr) {
1113 AsmLexer &Lexer = getLexer();
1115 static char const *
Comma =
",";
1119 switch (Tokens.
back().getKind()) {
1120 case AsmToken::TokenKind::Hash:
1121 if (Tokens.
size() > 1)
1122 if ((Tokens.
end() - 2)->getKind() == AsmToken::TokenKind::Plus) {
1124 AsmToken(AsmToken::TokenKind::Comma, Comma));
1128 case AsmToken::TokenKind::RCurly:
1129 case AsmToken::TokenKind::EndOfStatement:
1130 case AsmToken::TokenKind::Eof:
1137 while (!Tokens.
empty()) {
1141 SMLoc Loc = Lexer.
getLoc();
1142 return getParser().parseExpression(Expr, Loc);
1146 if (implicitExpressionLocation(
Operands)) {
1147 MCAsmParser &Parser = getParser();
1149 MCExpr
const *Expr =
nullptr;
1150 bool Error = parseExpression(Expr);
1154 HexagonOperand::CreateImm(
getContext(), Expr, Loc, Loc));
1162 MCAsmParser &Parser = getParser();
1163 AsmLexer &Lexer = getLexer();
1165 AsmToken
const &Token = Parser.
getTok();
1175 Operands.push_back(HexagonOperand::CreateToken(
1182 Operands.push_back(HexagonOperand::CreateToken(
1198 Operands.push_back(HexagonOperand::CreateToken(
1200 Operands.push_back(HexagonOperand::CreateToken(
1206 bool MustNotExtend =
false;
1207 bool ImplicitExpression = implicitExpressionLocation(
Operands);
1208 SMLoc ExprLoc = Lexer.
getLoc();
1209 if (!ImplicitExpression)
1210 Operands.push_back(HexagonOperand::CreateToken(
1213 bool MustExtend =
false;
1214 bool HiOnly =
false;
1215 bool LoOnly =
false;
1219 }
else if (ImplicitExpression)
1220 MustNotExtend =
true;
1221 AsmToken
const &Token = Parser.
getTok();
1224 if (
String.lower() ==
"hi") {
1226 }
else if (
String.lower() ==
"lo") {
1229 if (HiOnly || LoOnly) {
1230 AsmToken LParen = Lexer.
peekTok();
1239 MCExpr
const *Expr =
nullptr;
1240 if (parseExpression(Expr))
1245 if (Expr->evaluateAsAbsolute(
Value)) {
1249 if (HiOnly || LoOnly)
1255 if (!
Value.isAbsolute()) {
1260 MustNotExtend = !MustExtend;
1271 std::unique_ptr<HexagonOperand> Operand =
1272 HexagonOperand::CreateImm(
getContext(), Expr, ExprLoc, ExprLoc);
1273 Operands.push_back(std::move(Operand));
1279 if (parseExpressionOrOperand(
Operands))
1284bool HexagonAsmParser::parseInstruction(ParseInstructionInfo &Info,
1285 StringRef Name, AsmToken ID,
1287 getLexer().UnLex(ID);
1304unsigned HexagonAsmParser::validateTargetOperandClass(MCParsedAsmOperand &AsmOp,
1306 HexagonOperand *
Op =
static_cast<HexagonOperand *
>(&AsmOp);
1311 return Op->isImm() &&
Op->Imm.Val->evaluateAsAbsolute(
Value) &&
Value == 0
1313 : Match_InvalidOperand;
1317 return Op->isImm() &&
Op->Imm.Val->evaluateAsAbsolute(
Value) &&
Value == 1
1319 : Match_InvalidOperand;
1322 if (
Op->Kind == HexagonOperand::Token && Kind != InvalidMatchClass) {
1323 StringRef myStringRef = StringRef(
Op->Tok.Data,
Op->Tok.Length);
1324 if (matchTokenString(myStringRef.
lower()) == (MatchClassKind)Kind)
1325 return Match_Success;
1326 if (matchTokenString(myStringRef.
upper()) == (MatchClassKind)Kind)
1327 return Match_Success;
1334 return Match_InvalidOperand;
1338bool HexagonAsmParser::OutOfRange(SMLoc IDLoc,
long long Val,
long long Max) {
1340 raw_string_ostream ES(errStr);
1341 ES <<
"value " << Val <<
"(" <<
format_hex(Val, 0) <<
") out of range: ";
1345 ES <<
Max <<
"-" << (-
Max - 1);
1349int HexagonAsmParser::processInstruction(MCInst &Inst,
1352 MCContext &
Context = getParser().getContext();
1353 const MCRegisterInfo *RI =
getContext().getRegisterInfo();
1354 const std::string r =
"r";
1355 const std::string Colon =
":";
1356 using RegPairVals = std::pair<unsigned, unsigned>;
1357 auto GetRegPair = [
this, r](RegPairVals RegPair) {
1358 const std::string R1 = r +
utostr(RegPair.first);
1359 const std::string
R2 = r +
utostr(RegPair.second);
1361 return std::make_pair(matchRegister(R1), matchRegister(
R2));
1363 auto GetScalarRegs = [RI, GetRegPair](MCRegister RegPair) {
1365 const RegPairVals RegPair_ = std::make_pair(
Lower + 1,
Lower);
1367 return GetRegPair(RegPair_);
1369 auto GetVecRegs = [GetRegPair](MCRegister VecRegPair) {
1370 const RegPairVals RegPair =
1373 return GetRegPair(RegPair);
1376 bool is32bit =
false;
1380 SMDiagnostic Diag = getSourceManager().GetMessage(
1382 "Found pseudo instruction with no expansion");
1388 case Hexagon::J2_trap1:
1389 if (!getSTI().
hasFeature(Hexagon::ArchV65)) {
1392 if (Rx.
getReg() != Hexagon::R0 || Ry.
getReg() != Hexagon::R0) {
1393 Error(IDLoc,
"trap1 can only have register r0 as operand");
1394 return Match_InvalidOperand;
1399 case Hexagon::A2_iconst: {
1411 case Hexagon::M4_mpyrr_addr:
1412 case Hexagon::S4_addi_asl_ri:
1413 case Hexagon::S4_addi_lsr_ri:
1414 case Hexagon::S4_andi_asl_ri:
1415 case Hexagon::S4_andi_lsr_ri:
1416 case Hexagon::S4_ori_asl_ri:
1417 case Hexagon::S4_ori_lsr_ri:
1418 case Hexagon::S4_or_andix:
1419 case Hexagon::S4_subi_asl_ri:
1420 case Hexagon::S4_subi_lsr_ri: {
1424 return Match_InvalidOperand;
1428 case Hexagon::C2_cmpgei: {
1438 case Hexagon::C2_cmpgeui: {
1464 case Hexagon::A2_tfrp: {
1466 const std::pair<MCRegister, MCRegister> RegPair =
1467 GetScalarRegs(MO.
getReg());
1468 MO.
setReg(RegPair.first);
1474 case Hexagon::A2_tfrpt:
1475 case Hexagon::A2_tfrpf: {
1477 const std::pair<MCRegister, MCRegister> RegPair =
1478 GetScalarRegs(MO.
getReg());
1479 MO.
setReg(RegPair.first);
1482 ? Hexagon::C2_ccombinewt
1483 : Hexagon::C2_ccombinewf);
1486 case Hexagon::A2_tfrptnew:
1487 case Hexagon::A2_tfrpfnew: {
1489 const std::pair<MCRegister, MCRegister> RegPair =
1490 GetScalarRegs(MO.
getReg());
1491 MO.
setReg(RegPair.first);
1494 ? Hexagon::C2_ccombinewnewt
1495 : Hexagon::C2_ccombinewnewf);
1500 case Hexagon::V6_vassignp: {
1502 const std::pair<MCRegister, MCRegister> RegPair = GetVecRegs(MO.
getReg());
1503 MO.
setReg(RegPair.first);
1510 case Hexagon::CONST32:
1514 case Hexagon::CONST64:
1517 MCELFStreamer *MES =
static_cast<MCELFStreamer *
>(&Parser.
getStreamer());
1524 std::string myCharStr;
1525 MCSectionELF *mySection;
1535 myCharStr = StringRef(
".gnu.linkonce.l4.CONST_00000000")
1536 .drop_back(myImmStr.size())
1541 myCharStr = StringRef(
".gnu.linkonce.l8.CONST_0000000000000000")
1542 .drop_back(myImmStr.size())
1549 }
else if (MO_1.
isExpr()) {
1551 myCharStr =
".lita";
1558 unsigned byteSize = is32bit ? 4 : 8;
1567 Sym =
getContext().getOrCreateSymbol(StringRef(myCharStr.c_str() + 16));
1569 getStreamer().emitLabel(Sym);
1570 getStreamer().emitSymbolAttribute(Sym,
MCSA_Global);
1573 }
else if (MO_1.
isExpr()) {
1574 const char *StringStart =
nullptr;
1575 const char *StringEnd =
nullptr;
1577 StringStart =
Operands[5]->getStartLoc().getPointer();
1578 StringEnd =
Operands[6]->getStartLoc().getPointer();
1580 StringStart =
Operands[4]->getStartLoc().getPointer();
1581 StringEnd =
Operands[5]->getStartLoc().getPointer();
1584 unsigned size = StringEnd - StringStart;
1585 std::string DotConst =
".CONST_";
1586 Sym =
getContext().getOrCreateSymbol(DotConst +
1587 StringRef(StringStart,
size));
1591 getStreamer().emitLabel(Sym);
1592 getStreamer().emitSymbolAttribute(Sym,
MCSA_Local);
1593 getStreamer().emitValue(MO_1.
getExpr(), 4);
1603 TmpInst.
setOpcode(Hexagon::L2_loadrigp);
1605 TmpInst.
setOpcode(Hexagon::L2_loadrdgp);
1616 case Hexagon::A2_tfrpi: {
1628 case Hexagon::TFRI64_V4: {
1635 OutOfRange(IDLoc, s8, -128);
1653 case Hexagon::TFRI64_V2_ext: {
1660 if (s8 < -128 || s8 > 127)
1661 OutOfRange(IDLoc, s8, -128);
1668 case Hexagon::A4_combineii: {
1674 if (s8 < -128 || s8 > 127)
1675 OutOfRange(IDLoc, s8, -128);
1682 case Hexagon::S2_tableidxb_goodsyntax:
1686 case Hexagon::S2_tableidxh_goodsyntax: {
1696 TmpInst.
setOpcode(Hexagon::S2_tableidxh);
1706 case Hexagon::S2_tableidxw_goodsyntax: {
1716 TmpInst.
setOpcode(Hexagon::S2_tableidxw);
1726 case Hexagon::S2_tableidxd_goodsyntax: {
1736 TmpInst.
setOpcode(Hexagon::S2_tableidxd);
1746 case Hexagon::M2_mpyui:
1749 case Hexagon::M2_mpysmi: {
1755 MCExpr
const &Expr = *
Imm.getExpr();
1758 return Match_InvalidOperand;
1761 return Match_InvalidOperand;
1775 case Hexagon::S2_asr_i_r_rnd_goodsyntax: {
1781 return Match_InvalidOperand;
1793 TmpInst.
setOpcode(Hexagon::S2_asr_i_r_rnd);
1804 case Hexagon::S2_asr_i_p_rnd_goodsyntax: {
1811 return Match_InvalidOperand;
1815 std::string R1 = r +
utostr(RegPairNum + 1);
1817 Rss.
setReg(matchRegister(Reg1));
1819 std::string
R2 = r +
utostr(RegPairNum);
1821 TmpInst.
setOpcode(Hexagon::A2_combinew);
1831 Inst.
setOpcode(Hexagon::S2_asr_i_p_rnd);
1836 case Hexagon::A4_boundscheck: {
1840 Inst.
setOpcode(Hexagon::A4_boundscheck_hi);
1842 StringRef RegPair =
Name;
1843 Rs.
setReg(matchRegister(RegPair));
1845 Inst.
setOpcode(Hexagon::A4_boundscheck_lo);
1847 StringRef RegPair =
Name;
1848 Rs.
setReg(matchRegister(RegPair));
1853 case Hexagon::A2_addsp: {
1859 StringRef RegPair =
Name;
1860 Rs.
setReg(matchRegister(RegPair));
1864 StringRef RegPair =
Name;
1865 Rs.
setReg(matchRegister(RegPair));
1870 case Hexagon::M2_vrcmpys_s1: {
1874 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1_h);
1876 StringRef RegPair =
Name;
1877 Rt.
setReg(matchRegister(RegPair));
1879 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1_l);
1881 StringRef RegPair =
Name;
1882 Rt.
setReg(matchRegister(RegPair));
1887 case Hexagon::M2_vrcmpys_acc_s1: {
1894 TmpInst.
setOpcode(Hexagon::M2_vrcmpys_acc_s1_h);
1896 StringRef RegPair =
Name;
1897 Rt.
setReg(matchRegister(RegPair));
1899 TmpInst.
setOpcode(Hexagon::M2_vrcmpys_acc_s1_l);
1901 StringRef RegPair =
Name;
1902 Rt.
setReg(matchRegister(RegPair));
1913 case Hexagon::M2_vrcmpys_s1rp: {
1917 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1rp_h);
1919 StringRef RegPair =
Name;
1920 Rt.
setReg(matchRegister(RegPair));
1922 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1rp_l);
1924 StringRef RegPair =
Name;
1925 Rt.
setReg(matchRegister(RegPair));
1930 case Hexagon::S5_asrhub_rnd_sat_goodsyntax: {
1935 return Match_InvalidOperand;
1943 Inst.
setOpcode(Hexagon::S5_asrhub_rnd_sat);
1948 case Hexagon::S5_vasrhrnd_goodsyntax: {
1955 return Match_InvalidOperand;
1959 std::string R1 = r +
utostr(RegPairNum + 1);
1961 Rss.
setReg(matchRegister(Reg1));
1963 std::string
R2 = r +
utostr(RegPairNum);
1965 TmpInst.
setOpcode(Hexagon::A2_combinew);
1980 case Hexagon::A2_not: {
1992 case Hexagon::PS_loadrubabs:
1996 case Hexagon::PS_loadrbabs:
2000 case Hexagon::PS_loadruhabs:
2004 case Hexagon::PS_loadrhabs:
2008 case Hexagon::PS_loadriabs:
2012 case Hexagon::PS_loadrdabs:
2016 case Hexagon::PS_storerbabs:
2020 case Hexagon::PS_storerhabs:
2024 case Hexagon::PS_storerfabs:
2028 case Hexagon::PS_storeriabs:
2032 case Hexagon::PS_storerdabs:
2036 case Hexagon::PS_storerbnewabs:
2038 Inst.
setOpcode(Hexagon::S2_storerbnewgp);
2040 case Hexagon::PS_storerhnewabs:
2042 Inst.
setOpcode(Hexagon::S2_storerhnewgp);
2044 case Hexagon::PS_storerinewabs:
2046 Inst.
setOpcode(Hexagon::S2_storerinewgp);
2048 case Hexagon::A2_zxtb: {
2056 return Match_Success;
2059MCRegister 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")
#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 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.
@ End
Run the machine verifier once, at the end of the pipeline.
@ MCSA_Global
.type _foo, @gnu_unique_object
RegisterMCAsmParser - Helper template for registering a target specific assembly parser,...