[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 06:01:08 PST 2025
================
@@ -7806,6 +7815,267 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired,
return false;
}
+bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) {
+ // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2
+ // parameters, e.g.: .aeabi_subsection (1)aeabi_feature_and_bits, (2)optional,
+ // (3)uleb128 separated by 2 commas.
+ MCAsmParser &Parser = getParser();
+
+ bool HasActiveSubsection = true;
+ std::unique_ptr<MCELFStreamer::AttributeSubSection> ActiveSubsection =
+ getTargetStreamer().getActiveAtributesSubsection();
+ if (nullptr == ActiveSubsection) {
+ HasActiveSubsection = false;
+ }
+
+ // Consume the name (subsection name)
+ StringRef SubsectionName;
+ AArch64BuildAttributes::VendorID SubsectionNameID;
+ if (Parser.getTok().is(AsmToken::Identifier)) {
+ SubsectionName = Parser.getTok().getIdentifier();
+ SubsectionNameID = AArch64BuildAttributes::getVendorID(SubsectionName);
+ } else {
+ Error(Parser.getTok().getLoc(), "subsection name not found");
+ return true;
+ }
+ Parser.Lex();
+ // consume a comma
+ // parseComma() return *false* on success, and call Lex(), no need to call
+ // Lex() again.
+ if (Parser.parseComma()) {
+ return true;
+ }
+
+ // Consume the first parameter (optionality parameter)
+ AArch64BuildAttributes::SubsectionOptional IsOptional;
+ // options: optional/required
+ if (Parser.getTok().is(AsmToken::Identifier)) {
+ StringRef Optionality = Parser.getTok().getIdentifier();
+ IsOptional = AArch64BuildAttributes::getOptionalID(Optionality);
+ if (AArch64BuildAttributes::OPTIONAL_NOT_FOUND == IsOptional) {
+ Error(Parser.getTok().getLoc(),
+ AArch64BuildAttributes::getSubsectionOptionalUnknownError() + ": " +
+ Optionality);
+ return true;
+ }
+ if (HasActiveSubsection &&
----------------
sivan-shani wrote:
fixed + test added
https://github.com/llvm/llvm-project/pull/118771
More information about the llvm-commits
mailing list