60#define DEBUG_TYPE "mcasmparser"
65 "mwarn-missing-parenthesis",
66 cl::desc(
"Warn for missing parenthesis around predicate registers"),
69 "merror-missing-parenthesis",
70 cl::desc(
"Error for missing parenthesis around predicate registers"),
73 "mwarn-sign-mismatch",
74 cl::desc(
"Warn for mismatching a signed and unsigned value"),
77 "mwarn-noncontigious-register",
80 "merror-noncontigious-register",
81 cl::desc(
"Error for register names that aren't contigious"),
117 bool ParseDirectiveFalign(
unsigned Size,
SMLoc L);
121 SMLoc &EndLoc)
override;
122 bool ParseDirectiveSubsection(
SMLoc L);
123 bool ParseDirectiveComm(
bool IsLocal,
SMLoc L);
125 bool parseDirectiveAttribute(
SMLoc L);
127 bool RegisterMatchesArch(
unsigned MatchNum)
const;
129 bool matchBundleOptions();
130 bool handleNoncontigiousRegister(
bool Contigious,
SMLoc &Loc);
132 void canonicalizeImmediates(
MCInst &MCI);
135 bool MatchingInlineAsm);
136 void eatToEndOfPacket();
140 bool MatchingInlineAsm)
override;
143 unsigned Kind)
override;
144 bool OutOfRange(
SMLoc IDLoc,
long long Val,
long long Max);
153#define GET_ASSEMBLER_HEADER
154#include "HexagonGenAsmMatcher.inc"
173 getTargetStreamer().emitTargetAttributes(*STI);
181 bool parseExpression(
MCExpr const *&Expr);
200 SMLoc StartLoc, EndLoc;
221 HexagonOperand(KindTy K,
MCContext &Context) :
Kind(
K), Context(Context) {}
224 HexagonOperand(
const HexagonOperand &o)
227 StartLoc =
o.StartLoc;
243 SMLoc getStartLoc()
const override {
return StartLoc; }
246 SMLoc getEndLoc()
const override {
return EndLoc; }
253 const MCExpr *getImm()
const {
254 assert(Kind == Immediate &&
"Invalid access!");
258 bool isToken()
const override {
return Kind == Token; }
259 bool isImm()
const override {
return Kind == Immediate; }
263 bool CheckImmRange(
int immBits,
int zeroBits,
bool isSigned,
264 bool isRelocatable,
bool Extendable)
const {
265 if (Kind == Immediate) {
270 if (myMCExpr->evaluateAsAbsolute(Res)) {
271 int bits = immBits + zeroBits;
274 if (Res & ((1 << zeroBits) - 1))
277 if (Res < (1LL << (bits - 1)) && Res >= -(1LL << (bits - 1)))
285 const int64_t high_bit_set = 1ULL << 63;
299 bool isa30_2Imm()
const {
return CheckImmRange(30, 2,
true,
true,
true); }
300 bool isb30_2Imm()
const {
return CheckImmRange(30, 2,
true,
true,
true); }
301 bool isb15_2Imm()
const {
return CheckImmRange(15, 2,
true,
true,
false); }
302 bool isb13_2Imm()
const {
return CheckImmRange(13, 2,
true,
true,
false); }
304 bool ism32_0Imm()
const {
return true; }
306 bool isf32Imm()
const {
return false; }
307 bool isf64Imm()
const {
return false; }
308 bool iss32_0Imm()
const {
return true; }
309 bool iss31_1Imm()
const {
return true; }
310 bool iss30_2Imm()
const {
return true; }
311 bool iss29_3Imm()
const {
return true; }
312 bool iss27_2Imm()
const {
return CheckImmRange(27, 2,
true,
true,
false); }
313 bool iss10_0Imm()
const {
return CheckImmRange(10, 0,
true,
false,
false); }
314 bool iss10_6Imm()
const {
return CheckImmRange(10, 6,
true,
false,
false); }
315 bool iss9_0Imm()
const {
return CheckImmRange(9, 0,
true,
false,
false); }
316 bool iss8_0Imm()
const {
return CheckImmRange(8, 0,
true,
false,
false); }
317 bool iss8_0Imm64()
const {
return CheckImmRange(8, 0,
true,
true,
false); }
318 bool iss7_0Imm()
const {
return CheckImmRange(7, 0,
true,
false,
false); }
319 bool iss6_0Imm()
const {
return CheckImmRange(6, 0,
true,
false,
false); }
320 bool iss6_3Imm()
const {
return CheckImmRange(6, 3,
true,
false,
false); }
321 bool iss4_0Imm()
const {
return CheckImmRange(4, 0,
true,
false,
false); }
322 bool iss4_1Imm()
const {
return CheckImmRange(4, 1,
true,
false,
false); }
323 bool iss4_2Imm()
const {
return CheckImmRange(4, 2,
true,
false,
false); }
324 bool iss4_3Imm()
const {
return CheckImmRange(4, 3,
true,
false,
false); }
325 bool iss3_0Imm()
const {
return CheckImmRange(3, 0,
true,
false,
false); }
327 bool isu64_0Imm()
const {
return CheckImmRange(64, 0,
false,
true,
true); }
328 bool isu32_0Imm()
const {
return true; }
329 bool isu31_1Imm()
const {
return true; }
330 bool isu30_2Imm()
const {
return true; }
331 bool isu29_3Imm()
const {
return true; }
332 bool isu26_6Imm()
const {
return CheckImmRange(26, 6,
false,
true,
false); }
333 bool isu16_0Imm()
const {
return CheckImmRange(16, 0,
false,
true,
false); }
334 bool isu16_1Imm()
const {
return CheckImmRange(16, 1,
false,
true,
false); }
335 bool isu16_2Imm()
const {
return CheckImmRange(16, 2,
false,
true,
false); }
336 bool isu16_3Imm()
const {
return CheckImmRange(16, 3,
false,
true,
false); }
337 bool isu11_3Imm()
const {
return CheckImmRange(11, 3,
false,
false,
false); }
338 bool isu10_0Imm()
const {
return CheckImmRange(10, 0,
false,
false,
false); }
339 bool isu9_0Imm()
const {
return CheckImmRange(9, 0,
false,
false,
false); }
340 bool isu8_0Imm()
const {
return CheckImmRange(8, 0,
false,
false,
false); }
341 bool isu7_0Imm()
const {
return CheckImmRange(7, 0,
false,
false,
false); }
342 bool isu6_0Imm()
const {
return CheckImmRange(6, 0,
false,
false,
false); }
343 bool isu6_1Imm()
const {
return CheckImmRange(6, 1,
false,
false,
false); }
344 bool isu6_2Imm()
const {
return CheckImmRange(6, 2,
false,
false,
false); }
345 bool isu6_3Imm()
const {
return CheckImmRange(6, 3,
false,
false,
false); }
346 bool isu5_0Imm()
const {
return CheckImmRange(5, 0,
false,
false,
false); }
347 bool isu5_2Imm()
const {
return CheckImmRange(5, 2,
false,
false,
false); }
348 bool isu5_3Imm()
const {
return CheckImmRange(5, 3,
false,
false,
false); }
349 bool isu4_0Imm()
const {
return CheckImmRange(4, 0,
false,
false,
false); }
350 bool isu4_2Imm()
const {
return CheckImmRange(4, 2,
false,
false,
false); }
351 bool isu3_0Imm()
const {
return CheckImmRange(3, 0,
false,
false,
false); }
352 bool isu3_1Imm()
const {
return CheckImmRange(3, 1,
false,
false,
false); }
353 bool isu2_0Imm()
const {
return CheckImmRange(2, 0,
false,
false,
false); }
354 bool isu1_0Imm()
const {
return CheckImmRange(1, 0,
false,
false,
false); }
356 bool isn1Const()
const {
360 if (!getImm()->evaluateAsAbsolute(
Value))
364 bool issgp10Const()
const {
367 return getReg() == Hexagon::SGP1_0;
369 bool iss11_0Imm()
const {
370 return CheckImmRange(11 + 26, 0,
true,
true,
true);
372 bool iss11_1Imm()
const {
373 return CheckImmRange(11 + 26, 1,
true,
true,
true);
375 bool iss11_2Imm()
const {
376 return CheckImmRange(11 + 26, 2,
true,
true,
true);
378 bool iss11_3Imm()
const {
379 return CheckImmRange(11 + 26, 3,
true,
true,
true);
381 bool isu32_0MustExt()
const {
return isImm(); }
383 void addRegOperands(
MCInst &Inst,
unsigned N)
const {
384 assert(
N == 1 &&
"Invalid number of operands!");
388 void addImmOperands(
MCInst &Inst,
unsigned N)
const {
389 assert(
N == 1 &&
"Invalid number of operands!");
393 void addSignedImmOperands(
MCInst &Inst,
unsigned N)
const {
394 assert(
N == 1 &&
"Invalid number of operands!");
405 if ((Extended < 0) != (
Value < 0))
412 void addn1ConstOperands(
MCInst &Inst,
unsigned N)
const {
413 addImmOperands(Inst,
N);
415 void addsgp10ConstOperands(
MCInst &Inst,
unsigned N)
const {
416 addRegOperands(Inst,
N);
420 assert(Kind == Token &&
"Invalid access!");
426 static std::unique_ptr<HexagonOperand> CreateToken(
MCContext &Context,
428 HexagonOperand *
Op =
new HexagonOperand(Token, Context);
429 Op->Tok.Data = Str.data();
430 Op->Tok.Length = Str.size();
433 return std::unique_ptr<HexagonOperand>(
Op);
436 static std::unique_ptr<HexagonOperand>
438 HexagonOperand *
Op =
new HexagonOperand(
Register, Context);
439 Op->Reg.RegNum = RegNum;
442 return std::unique_ptr<HexagonOperand>(
Op);
445 static std::unique_ptr<HexagonOperand>
447 HexagonOperand *
Op =
new HexagonOperand(Immediate, Context);
451 return std::unique_ptr<HexagonOperand>(
Op);
460 getImm()->print(
OS,
nullptr);
467 OS <<
"'" << getToken() <<
"'";
487 MII, STI, getContext(), MCB, &
Check,
true);
506bool HexagonAsmParser::matchBundleOptions() {
512 char const *MemNoShuffMsg =
513 "invalid instruction packet: mem_noshuf specifier not "
514 "supported with this architecture";
517 if (
Option.compare_insensitive(
"endloop01") == 0) {
520 }
else if (
Option.compare_insensitive(
"endloop0") == 0) {
522 }
else if (
Option.compare_insensitive(
"endloop1") == 0) {
524 }
else if (
Option.compare_insensitive(
"mem_noshuf") == 0) {
525 if (getSTI().hasFeature(Hexagon::FeatureMemNoShuf))
528 return getParser().Error(IDLoc, MemNoShuffMsg);
529 }
else if (
Option.compare_insensitive(
"mem_no_order") == 0) {
532 return getParser().Error(IDLoc,
llvm::Twine(
"'") + Option +
533 "' is not a valid bundle option");
541void HexagonAsmParser::canonicalizeImmediates(
MCInst &MCI) {
546 int64_t
Value(
I.getImm());
550 if (
I.isExpr() && cast<HexagonMCExpr>(
I.getExpr())->signMismatch() &&
552 Warning(MCI.getLoc(),
"Signed/Unsigned mismatch");
558bool HexagonAsmParser::matchOneInstruction(
MCInst &MCI,
SMLoc IDLoc,
561 bool MatchingInlineAsm) {
564 MatchInstructionImpl(InstOperands, MCI,
ErrorInfo, MatchingInlineAsm);
565 if (result == Match_Success) {
567 canonicalizeImmediates(MCI);
568 result = processInstruction(MCI, InstOperands, IDLoc);
586 case Match_MissingFeature:
587 return Error(IDLoc,
"invalid instruction");
588 case Match_MnemonicFail:
589 return Error(IDLoc,
"unrecognized instruction");
590 case Match_InvalidOperand:
592 case Match_InvalidTiedOperand:
593 SMLoc ErrorLoc = IDLoc;
596 return Error(IDLoc,
"too few operands for instruction");
598 ErrorLoc = (
static_cast<HexagonOperand *
>(InstOperands[
ErrorInfo].get()))
600 if (ErrorLoc ==
SMLoc())
603 return Error(ErrorLoc,
"invalid operand for instruction");
608void HexagonAsmParser::eatToEndOfPacket() {
617bool HexagonAsmParser::MatchAndEmitInstruction(
SMLoc IDLoc,
unsigned &Opcode,
621 bool MatchingInlineAsm) {
626 HexagonOperand &FirstOperand =
static_cast<HexagonOperand &
>(*
Operands[0]);
627 if (FirstOperand.isToken() && FirstOperand.getToken() ==
"{") {
628 assert(
Operands.size() == 1 &&
"Brackets should be by themselves");
630 getParser().Error(IDLoc,
"Already in a packet");
637 if (FirstOperand.isToken() && FirstOperand.getToken() ==
"}") {
638 assert(
Operands.size() == 1 &&
"Brackets should be by themselves");
640 getParser().Error(IDLoc,
"Not in a packet");
644 if (matchBundleOptions())
646 return finishBundle(IDLoc, Out);
648 MCInst *SubInst = getParser().getContext().createMCInst();
650 MatchingInlineAsm)) {
656 getParser().getContext(), MII, MCB, *SubInst);
659 return finishBundle(IDLoc, Out);
665bool HexagonAsmParser::parseDirectiveAttribute(
SMLoc L) {
674 return Error(TagLoc,
"attribute name not recognized: " +
Name);
685 if (check(!CE, TagLoc,
"expected numeric constant"))
688 Tag =
CE->getValue();
695 int64_t IntegerValue = 0;
703 return Error(ValueExprLoc,
"expected numeric constant");
704 IntegerValue =
CE->getValue();
709 getTargetStreamer().emitAttribute(
Tag, IntegerValue);
714bool HexagonAsmParser::ParseDirective(
AsmToken DirectiveID) {
716 if (IDVal.
lower() ==
".falign")
717 return ParseDirectiveFalign(256, DirectiveID.
getLoc());
718 if ((IDVal.
lower() ==
".lcomm") || (IDVal.
lower() ==
".lcommon"))
719 return ParseDirectiveComm(
true, DirectiveID.
getLoc());
720 if ((IDVal.
lower() ==
".comm") || (IDVal.
lower() ==
".common"))
721 return ParseDirectiveComm(
false, DirectiveID.
getLoc());
722 if (IDVal.
lower() ==
".subsection")
723 return ParseDirectiveSubsection(DirectiveID.
getLoc());
724 if (IDVal ==
".attribute")
725 return parseDirectiveAttribute(DirectiveID.
getLoc());
729bool HexagonAsmParser::ParseDirectiveSubsection(
SMLoc L) {
730 const MCExpr *Subsection =
nullptr;
734 "Invalid subsection directive");
735 getParser().parseExpression(Subsection);
737 if (!Subsection->evaluateAsAbsolute(Res))
738 return Error(L,
"Cannot evaluate subsection number");
741 return TokError(
"unexpected token in directive");
747 if ((Res < 0) && (Res > -8193))
749 getStreamer().switchSection(getStreamer().getCurrentSectionOnly(), Res);
754bool HexagonAsmParser::ParseDirectiveFalign(
unsigned Size,
SMLoc L) {
756 int64_t MaxBytesToFill = 15;
764 if (!getParser().parseExpression(
Value)) {
766 auto *MCE = cast<MCConstantExpr>(
Value);
767 uint64_t IntValue = MCE->getValue();
769 return Error(ExprLoc,
"literal value out of range (256) for falign");
770 MaxBytesToFill = IntValue;
773 return Error(ExprLoc,
"not a valid expression for falign directive");
777 getTargetStreamer().emitFAlign(16, MaxBytesToFill);
789bool HexagonAsmParser::ParseDirectiveComm(
bool IsLocal,
SMLoc Loc) {
792 if (getStreamer().hasRawTextSupport())
796 if (getParser().parseIdentifier(
Name))
797 return TokError(
"expected identifier in directive");
802 return TokError(
"unexpected token in directive");
806 SMLoc SizeLoc = getLexer().getLoc();
807 if (getParser().parseAbsoluteExpression(
Size))
811 SMLoc ByteAlignmentLoc;
814 ByteAlignmentLoc = getLexer().getLoc();
815 if (getParser().parseAbsoluteExpression(ByteAlignment))
818 return Error(ByteAlignmentLoc,
"alignment must be a power of 2");
821 int64_t AccessAlignment = 0;
825 SMLoc AccessAlignmentLoc;
827 AccessAlignmentLoc = getLexer().getLoc();
828 if (getParser().parseAbsoluteExpression(AccessAlignment))
832 return Error(AccessAlignmentLoc,
"access alignment must be a power of 2");
836 return TokError(
"unexpected token in '.comm' or '.lcomm' directive");
843 return Error(SizeLoc,
"invalid '.comm' or '.lcomm' directive size, can't "
844 "be less than zero");
849 if (ByteAlignment < 0)
850 return Error(ByteAlignmentLoc,
"invalid '.comm' or '.lcomm' directive "
851 "alignment, can't be less than zero");
853 if (!
Sym->isUndefined())
854 return Error(Loc,
"invalid symbol redefinition");
870bool HexagonAsmParser::RegisterMatchesArch(
unsigned MatchNum)
const {
871 if (HexagonMCRegisterClasses[Hexagon::V62RegsRegClassID].
contains(MatchNum))
872 if (!getSTI().hasFeature(Hexagon::ArchV62))
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();
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(
919 getContext(),
String.substr(HeadTail.first.size(), 1), Loc));
921 }
while (!
String.empty());
941 Warning(Begin,
"Missing parenthesis around predicate register");
942 static char const *LParen =
"(";
943 static char const *RParen =
")";
945 HexagonOperand::CreateToken(getContext(), LParen, Begin));
947 HexagonOperand::CreateReg(getContext(),
Register, Begin,
End));
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 =
")";
963 getContext(), LParen, Begin));
965 HexagonOperand::CreateReg(getContext(),
Register, Begin,
End));
967 if (MaybeDotNew.
is(AsmToken::TokenKind::Identifier) &&
971 HexagonOperand::CreateToken(getContext(), RParen, Begin));
977 HexagonOperand::CreateReg(getContext(),
Register, Begin,
End));
983bool HexagonAsmParser::isLabel(
AsmToken &Token) {
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);
1005 std::pair<StringRef, StringRef> DotSplit = Whole.
split(
'.');
1006 if (!matchRegister(DotSplit.first.lower()))
1011bool HexagonAsmParser::handleNoncontigiousRegister(
bool Contigious,
1014 Error(Loc,
"Register name is not contigious");
1018 Warning(Loc,
"Register name is not contigious");
1024 return !tryParseRegister(
Reg, StartLoc, EndLoc).isSuccess();
1030 StartLoc = getLexer().getLoc();
1034 bool NeededWorkaround =
false;
1043 Lookahead.
back().getString().data() +
1044 Lookahead.
back().getString().size();
1050 Again = (Contigious &&
Type) || (Workaround &&
Type);
1051 NeededWorkaround = NeededWorkaround || (Again && !(Contigious &&
Type));
1053 std::string Collapsed = std::string(RawString);
1056 std::pair<StringRef, StringRef> DotSplit = FullString.
split(
'.');
1057 unsigned DotReg = matchRegister(DotSplit.first.lower());
1058 if (DotReg != Hexagon::NoRegister && RegisterMatchesArch(DotReg)) {
1059 if (DotSplit.second.empty()) {
1062 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1067 size_t First = RawString.find(
'.');
1071 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1076 std::pair<StringRef, StringRef> ColonSplit =
StringRef(FullString).
split(
':');
1077 unsigned ColonReg = matchRegister(ColonSplit.first.lower());
1078 if (ColonReg != Hexagon::NoRegister && RegisterMatchesArch(DotReg)) {
1084 if (handleNoncontigiousRegister(!NeededWorkaround, StartLoc))
1088 while (!Lookahead.
empty()) {
1108bool HexagonAsmParser::parseExpression(
MCExpr const *&Expr) {
1112 static char const *
Comma =
",";
1116 switch (Tokens.
back().getKind()) {
1117 case AsmToken::TokenKind::Hash:
1118 if (Tokens.
size() > 1)
1119 if ((Tokens.
end() - 2)->getKind() == AsmToken::TokenKind::Plus) {
1121 AsmToken(AsmToken::TokenKind::Comma, Comma));
1125 case AsmToken::TokenKind::RCurly:
1126 case AsmToken::TokenKind::EndOfStatement:
1127 case AsmToken::TokenKind::Eof:
1134 while (!Tokens.
empty()) {
1139 return getParser().parseExpression(Expr, Loc);
1143 if (implicitExpressionLocation(
Operands)) {
1146 MCExpr const *Expr =
nullptr;
1147 bool Error = parseExpression(Expr);
1151 HexagonOperand::CreateImm(getContext(), Expr, Loc, Loc));
1172 Operands.push_back(HexagonOperand::CreateToken(
1179 Operands.push_back(HexagonOperand::CreateToken(
1195 Operands.push_back(HexagonOperand::CreateToken(
1197 Operands.push_back(HexagonOperand::CreateToken(
1203 bool MustNotExtend =
false;
1204 bool ImplicitExpression = implicitExpressionLocation(
Operands);
1206 if (!ImplicitExpression)
1207 Operands.push_back(HexagonOperand::CreateToken(
1210 bool MustExtend =
false;
1211 bool HiOnly =
false;
1212 bool LoOnly =
false;
1216 }
else if (ImplicitExpression)
1217 MustNotExtend =
true;
1221 if (
String.lower() ==
"hi") {
1223 }
else if (
String.lower() ==
"lo") {
1226 if (HiOnly || LoOnly) {
1236 MCExpr const *Expr =
nullptr;
1237 if (parseExpression(Expr))
1242 if (Expr->evaluateAsAbsolute(
Value)) {
1246 if (HiOnly || LoOnly)
1252 if (!
Value.isAbsolute()) {
1253 switch (
Value.getAccessVariant()) {
1254 case MCSymbolRefExpr::VariantKind::VK_TPREL:
1255 case MCSymbolRefExpr::VariantKind::VK_DTPREL:
1257 MustNotExtend = !MustExtend;
1268 std::unique_ptr<HexagonOperand> Operand =
1269 HexagonOperand::CreateImm(getContext(), Expr, ExprLoc, ExprLoc);
1270 Operands.push_back(std::move(Operand));
1276 if (parseExpressionOrOperand(
Operands))
1284 getLexer().UnLex(
ID);
1303 HexagonOperand *
Op =
static_cast<HexagonOperand *
>(&AsmOp);
1308 return Op->isImm() &&
Op->Imm.Val->evaluateAsAbsolute(
Value) &&
Value == 0
1310 : Match_InvalidOperand;
1314 return Op->isImm() &&
Op->Imm.Val->evaluateAsAbsolute(
Value) &&
Value == 1
1316 : Match_InvalidOperand;
1319 if (
Op->Kind == HexagonOperand::Token && Kind != InvalidMatchClass) {
1321 if (matchTokenString(myStringRef.
lower()) == (MatchClassKind)Kind)
1322 return Match_Success;
1323 if (matchTokenString(myStringRef.
upper()) == (MatchClassKind)Kind)
1324 return Match_Success;
1331 return Match_InvalidOperand;
1335bool HexagonAsmParser::OutOfRange(
SMLoc IDLoc,
long long Val,
long long Max) {
1338 ES <<
"value " << Val <<
"(" <<
format_hex(Val, 0) <<
") out of range: ";
1342 ES <<
Max <<
"-" << (-
Max - 1);
1346int HexagonAsmParser::processInstruction(
MCInst &Inst,
1349 MCContext &Context = getParser().getContext();
1351 const std::string r =
"r";
1352 const std::string
v =
"v";
1353 const std::string Colon =
":";
1354 using RegPairVals = std::pair<unsigned, unsigned>;
1355 auto GetRegPair = [
this, r](RegPairVals RegPair) {
1356 const std::string R1 = r + utostr(RegPair.first);
1357 const std::string
R2 = r + utostr(RegPair.second);
1359 return std::make_pair(matchRegister(R1), matchRegister(
R2));
1361 auto GetScalarRegs = [RI, GetRegPair](
unsigned RegPair) {
1363 const RegPairVals RegPair_ = std::make_pair(
Lower + 1,
Lower);
1365 return GetRegPair(RegPair_);
1367 auto GetVecRegs = [GetRegPair](
unsigned VecRegPair) {
1368 const RegPairVals RegPair =
1371 return GetRegPair(RegPair);
1374 bool is32bit =
false;
1380 "Found pseudo instruction with no expansion");
1386 case Hexagon::J2_trap1:
1387 if (!getSTI().hasFeature(Hexagon::ArchV65)) {
1390 if (Rx.
getReg() != Hexagon::R0 || Ry.
getReg() != Hexagon::R0) {
1391 Error(IDLoc,
"trap1 can only have register r0 as operand");
1392 return Match_InvalidOperand;
1397 case Hexagon::A2_iconst: {
1409 case Hexagon::M4_mpyrr_addr:
1410 case Hexagon::S4_addi_asl_ri:
1411 case Hexagon::S4_addi_lsr_ri:
1412 case Hexagon::S4_andi_asl_ri:
1413 case Hexagon::S4_andi_lsr_ri:
1414 case Hexagon::S4_ori_asl_ri:
1415 case Hexagon::S4_ori_lsr_ri:
1416 case Hexagon::S4_or_andix:
1417 case Hexagon::S4_subi_asl_ri:
1418 case Hexagon::S4_subi_lsr_ri: {
1422 return Match_InvalidOperand;
1426 case Hexagon::C2_cmpgei: {
1436 case Hexagon::C2_cmpgeui: {
1462 case Hexagon::A2_tfrp: {
1464 const std::pair<unsigned, unsigned> RegPair = GetScalarRegs(MO.
getReg());
1465 MO.
setReg(RegPair.first);
1471 case Hexagon::A2_tfrpt:
1472 case Hexagon::A2_tfrpf: {
1474 const std::pair<unsigned, unsigned> RegPair = GetScalarRegs(MO.
getReg());
1475 MO.
setReg(RegPair.first);
1478 ? Hexagon::C2_ccombinewt
1479 : Hexagon::C2_ccombinewf);
1482 case Hexagon::A2_tfrptnew:
1483 case Hexagon::A2_tfrpfnew: {
1485 const std::pair<unsigned, unsigned> RegPair = GetScalarRegs(MO.
getReg());
1486 MO.
setReg(RegPair.first);
1489 ? Hexagon::C2_ccombinewnewt
1490 : Hexagon::C2_ccombinewnewf);
1495 case Hexagon::V6_vassignp: {
1497 const std::pair<unsigned, unsigned> RegPair = GetVecRegs(MO.
getReg());
1498 MO.
setReg(RegPair.first);
1505 case Hexagon::CONST32:
1509 case Hexagon::CONST64:
1519 std::string myCharStr;
1529 std::string myImmStr = utohexstr(
static_cast<uint32_t>(
Value));
1530 myCharStr =
StringRef(
".gnu.linkonce.l4.CONST_00000000")
1535 std::string myImmStr = utohexstr(
Value);
1536 myCharStr =
StringRef(
".gnu.linkonce.l8.CONST_0000000000000000")
1544 }
else if (MO_1.
isExpr()) {
1546 myCharStr =
".lita";
1553 unsigned byteSize = is32bit ? 4 : 8;
1562 Sym = getContext().getOrCreateSymbol(
StringRef(myCharStr.c_str() + 16));
1563 if (
Sym->isUndefined()) {
1564 getStreamer().emitLabel(
Sym);
1568 }
else if (MO_1.
isExpr()) {
1569 const char *StringStart =
nullptr;
1570 const char *StringEnd =
nullptr;
1571 if (*
Operands[4]->getStartLoc().getPointer() ==
'#') {
1572 StringStart =
Operands[5]->getStartLoc().getPointer();
1573 StringEnd =
Operands[6]->getStartLoc().getPointer();
1575 StringStart =
Operands[4]->getStartLoc().getPointer();
1576 StringEnd =
Operands[5]->getStartLoc().getPointer();
1579 unsigned size = StringEnd - StringStart;
1580 std::string DotConst =
".CONST_";
1581 Sym = getContext().getOrCreateSymbol(DotConst +
1584 if (
Sym->isUndefined()) {
1586 getStreamer().emitLabel(
Sym);
1588 getStreamer().emitValue(MO_1.
getExpr(), 4);
1598 TmpInst.
setOpcode(Hexagon::L2_loadrigp);
1600 TmpInst.
setOpcode(Hexagon::L2_loadrdgp);
1611 case Hexagon::A2_tfrpi: {
1623 case Hexagon::TFRI64_V4: {
1630 OutOfRange(IDLoc, s8, -128);
1648 case Hexagon::TFRI64_V2_ext: {
1655 if (s8 < -128 || s8 > 127)
1656 OutOfRange(IDLoc, s8, -128);
1663 case Hexagon::A4_combineii: {
1669 if (s8 < -128 || s8 > 127)
1670 OutOfRange(IDLoc, s8, -128);
1677 case Hexagon::S2_tableidxb_goodsyntax:
1681 case Hexagon::S2_tableidxh_goodsyntax: {
1691 TmpInst.
setOpcode(Hexagon::S2_tableidxh);
1701 case Hexagon::S2_tableidxw_goodsyntax: {
1711 TmpInst.
setOpcode(Hexagon::S2_tableidxw);
1721 case Hexagon::S2_tableidxd_goodsyntax: {
1731 TmpInst.
setOpcode(Hexagon::S2_tableidxd);
1741 case Hexagon::M2_mpyui:
1744 case Hexagon::M2_mpysmi: {
1753 return Match_InvalidOperand;
1756 return Match_InvalidOperand;
1757 if (Value < 0 && Value > -256) {
1770 case Hexagon::S2_asr_i_r_rnd_goodsyntax: {
1776 return Match_InvalidOperand;
1788 TmpInst.
setOpcode(Hexagon::S2_asr_i_r_rnd);
1799 case Hexagon::S2_asr_i_p_rnd_goodsyntax: {
1806 return Match_InvalidOperand;
1810 std::string R1 = r + utostr(RegPairNum + 1);
1812 Rss.
setReg(matchRegister(Reg1));
1814 std::string
R2 = r + utostr(RegPairNum);
1816 TmpInst.
setOpcode(Hexagon::A2_combinew);
1826 Inst.
setOpcode(Hexagon::S2_asr_i_p_rnd);
1831 case Hexagon::A4_boundscheck: {
1835 Inst.
setOpcode(Hexagon::A4_boundscheck_hi);
1836 std::string
Name = r + utostr(RegNum) + Colon + utostr(RegNum - 1);
1838 Rs.
setReg(matchRegister(RegPair));
1840 Inst.
setOpcode(Hexagon::A4_boundscheck_lo);
1841 std::string
Name = r + utostr(RegNum + 1) + Colon + utostr(RegNum);
1843 Rs.
setReg(matchRegister(RegPair));
1848 case Hexagon::A2_addsp: {
1853 std::string
Name = r + utostr(RegNum) + Colon + utostr(RegNum - 1);
1855 Rs.
setReg(matchRegister(RegPair));
1858 std::string
Name = r + utostr(RegNum + 1) + Colon + utostr(RegNum);
1860 Rs.
setReg(matchRegister(RegPair));
1865 case Hexagon::M2_vrcmpys_s1: {
1869 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1_h);
1870 std::string
Name = r + utostr(RegNum) + Colon + utostr(RegNum - 1);
1872 Rt.
setReg(matchRegister(RegPair));
1874 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1_l);
1875 std::string
Name = r + utostr(RegNum + 1) + Colon + utostr(RegNum);
1877 Rt.
setReg(matchRegister(RegPair));
1882 case Hexagon::M2_vrcmpys_acc_s1: {
1889 TmpInst.
setOpcode(Hexagon::M2_vrcmpys_acc_s1_h);
1890 std::string
Name = r + utostr(RegNum) + Colon + utostr(RegNum - 1);
1892 Rt.
setReg(matchRegister(RegPair));
1894 TmpInst.
setOpcode(Hexagon::M2_vrcmpys_acc_s1_l);
1895 std::string
Name = r + utostr(RegNum + 1) + Colon + utostr(RegNum);
1897 Rt.
setReg(matchRegister(RegPair));
1908 case Hexagon::M2_vrcmpys_s1rp: {
1912 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1rp_h);
1913 std::string
Name = r + utostr(RegNum) + Colon + utostr(RegNum - 1);
1915 Rt.
setReg(matchRegister(RegPair));
1917 Inst.
setOpcode(Hexagon::M2_vrcmpys_s1rp_l);
1918 std::string
Name = r + utostr(RegNum + 1) + Colon + utostr(RegNum);
1920 Rt.
setReg(matchRegister(RegPair));
1925 case Hexagon::S5_asrhub_rnd_sat_goodsyntax: {
1930 return Match_InvalidOperand;
1938 Inst.
setOpcode(Hexagon::S5_asrhub_rnd_sat);
1943 case Hexagon::S5_vasrhrnd_goodsyntax: {
1950 return Match_InvalidOperand;
1954 std::string R1 = r + utostr(RegPairNum + 1);
1956 Rss.
setReg(matchRegister(Reg1));
1958 std::string
R2 = r + utostr(RegPairNum);
1960 TmpInst.
setOpcode(Hexagon::A2_combinew);
1975 case Hexagon::A2_not: {
1987 case Hexagon::PS_loadrubabs:
1991 case Hexagon::PS_loadrbabs:
1995 case Hexagon::PS_loadruhabs:
1999 case Hexagon::PS_loadrhabs:
2003 case Hexagon::PS_loadriabs:
2007 case Hexagon::PS_loadrdabs:
2011 case Hexagon::PS_storerbabs:
2015 case Hexagon::PS_storerhabs:
2019 case Hexagon::PS_storerfabs:
2023 case Hexagon::PS_storeriabs:
2027 case Hexagon::PS_storerdabs:
2031 case Hexagon::PS_storerbnewabs:
2033 Inst.
setOpcode(Hexagon::S2_storerbnewgp);
2035 case Hexagon::PS_storerhnewabs:
2037 Inst.
setOpcode(Hexagon::S2_storerhnewgp);
2039 case Hexagon::PS_storerinewabs:
2041 Inst.
setOpcode(Hexagon::S2_storerinewgp);
2043 case Hexagon::A2_zxtb: {
2051 return Match_Success;
static MCRegister MatchRegisterName(StringRef Name)
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 void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
static size_t byteSize(BTF::CommonType *Type)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Analysis containing CSE Info
#define LLVM_EXTERNAL_VISIBILITY
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static bool isSigned(unsigned int 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 > WarnNoncontigiousRegister("mwarn-noncontigious-register", cl::desc("Warn for register names that arent contigious"), cl::init(true))
static cl::opt< bool > ErrorMissingParenthesis("merror-missing-parenthesis", cl::desc("Error for missing parenthesis around predicate registers"), cl::init(false))
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)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeHexagonAsmParser()
Force static initialization.
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")
mir Rename Register Operands
static unsigned getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
static bool isReg(const MCInst &MI, unsigned OpNo)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isImm(const MachineOperand &MO, MachineRegisterInfo *MRI)
This file defines the SmallVector class.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Target independent representation for an assembler token.
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.
This class represents an Operation in the Expression.
Base class for user error types.
Lightweight error class with error context and mandatory checking.
Check for a valid bundle.
void HexagonMCEmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, unsigned AccessSize)
void HexagonMCEmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, unsigned AccessSize)
bool mustNotExtend() const
static HexagonMCExpr * create(MCExpr const *Expr, MCContext &Ctx)
Generic assembler lexer interface, for use by target specific assembly lexers.
void UnLex(AsmToken const &Token)
const AsmToken peekTok(bool ShouldSkipSpace=true)
Look ahead at the next token to be lexed.
SMLoc getLoc() const
Get the current source location.
const AsmToken & getTok() const
Get the current (last) lexed token.
const AsmToken & Lex()
Consume the next token from the input stream and return it.
bool is(AsmToken::TokenKind K) const
Check if the current token has kind K.
virtual void Initialize(MCAsmParser &Parser)
Initialize the extension for parsing using the given Parser.
MCAsmParser & getParser()
Generic assembler parser interface, for use by target specific assembly parsers.
virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range=std::nullopt)=0
Emit an error at the location L, with the message Msg.
virtual MCStreamer & getStreamer()=0
Return the output streamer for the assembler.
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 MCAsmLexer & getLexer()=0
virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range=std::nullopt)=0
Emit a warning at the location L, with the message Msg.
virtual void addAliasForDirective(StringRef Directive, StringRef Alias)=0
virtual MCContext & getContext()=0
bool Error(SMLoc L, const Twine &Msg, SMRange Range=std::nullopt)
Return an error at the location L, with the message Msg.
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 const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
bool evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm, const SectionAddrMap &Addrs) const
Try to evaluate the expression to an absolute value.
@ Unary
Unary expressions.
@ SymbolRef
References to labels and assigned expressions.
@ Binary
Binary expressions.
bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
Instances of this class represent a single low-level machine instruction.
void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer=nullptr, StringRef Separator=" ", const MCRegisterInfo *RegInfo=nullptr) const
Dump the MCInst as prettily as possible using the additional MC structures, if given.
unsigned getOpcode() const
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 createReg(unsigned Reg)
static MCOperand createExpr(const MCExpr *Val)
void setReg(unsigned Reg)
Set the register number.
void setExpr(const MCExpr *Val)
static MCOperand createImm(int64_t Val)
unsigned 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?
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
uint16_t getEncodingValue(MCRegister RegNo) const
Returns the encoding for RegNo.
Wrapper class representing physical registers. Should be passed by value.
This represents a section on linux, lots of unix variants and some bare metal systems.
Streaming machine code generation interface.
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)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MCTargetAsmParser - Generic interface to target specific assembly parsers.
virtual bool equalIsAsmAssignment()
virtual bool parseRegister(MCRegister &Reg, SMLoc &StartLoc, SMLoc &EndLoc)=0
virtual bool ParseDirective(AsmToken DirectiveID)
ParseDirective - Parse a target specific assembler directive This method is deprecated,...
virtual ParseStatus tryParseRegister(MCRegister &Reg, SMLoc &StartLoc, SMLoc &EndLoc)=0
tryParseRegister - parse one register if possible
virtual bool isLabel(AsmToken &Token)
void setAvailableFeatures(const FeatureBitset &Value)
const MCSubtargetInfo & getSTI() const
virtual unsigned validateTargetOperandClass(MCParsedAsmOperand &Op, unsigned Kind)
Allow a target to add special case operand matching for things that tblgen doesn't/can't handle effec...
virtual bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name, SMLoc NameLoc, OperandVector &Operands)=0
ParseInstruction - Parse one assembly instruction.
virtual bool MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode, OperandVector &Operands, MCStreamer &Out, uint64_t &ErrorInfo, bool MatchingInlineAsm)=0
MatchAndEmitInstruction - Recognize a series of operands of a parsed instruction as an actual MCInst ...
Target specific streamer interface.
MCStreamer & getStreamer()
This represents an "assembler immediate".
Ternary parse status returned by various parse* methods.
static constexpr StatusTy Success
static constexpr StatusTy NoMatch
Wrapper class representing virtual and physical registers.
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
void print(const char *ProgName, raw_ostream &S, bool ShowColors=true, bool ShowKindLabel=true, bool ShowLocation=true) const
Represents a location in source code.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
iterator insert(iterator I, T &&Elt)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - 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.
std::string str() const
str - Get the contents as an std::string.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
std::string upper() const
Convert the given ASCII string to uppercase.
constexpr size_t size() const
size - Get the string size.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
std::string lower() const
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
bool equals_insensitive(StringRef RHS) const
Check for string equality, ignoring case.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::optional< unsigned > attrTypeFromString(StringRef tag, TagNameMap tagNameMap)
const TagNameMap & getHexagonAttributeTags()
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)
std::pair< unsigned, unsigned > GetVecRegPairIndices(unsigned VecRegPair)
Returns an ordered pair of the constituent register ordinals for each of the elements of VecRegPair.
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.
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.
bool isUIntN(unsigned N, uint64_t x)
Checks if an unsigned integer fits into the given (dynamic) bit width.
static bool isMem(const MachineInstr &MI, unsigned Op)
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
Target & getTheHexagonTarget()
constexpr uint32_t Hi_32(uint64_t Value)
Return the high 32 bits of a 64 bit value.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
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.
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.
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
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 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
auto mask(ShuffFunc S, unsigned Length, OptArgs... args) -> MaskT
This struct is a compact representation of a valid (non-zero power of two) alignment.
RegisterMCAsmParser - Helper template for registering a target specific assembly parser,...