| 1 | //===-- HexagonAttributeParser.cpp - Hexagon Attribute Parser -------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/Support/HexagonAttributeParser.h" |
| 10 | |
| 11 | using namespace llvm; |
| 12 | |
| 13 | const HexagonAttributeParser::DisplayHandler |
| 14 | HexagonAttributeParser::DisplayRoutines[] = { |
| 15 | { |
| 16 | .Attribute: HexagonAttrs::ARCH, |
| 17 | .Routine: &ELFCompactAttrParser::integerAttribute, |
| 18 | }, |
| 19 | { |
| 20 | .Attribute: HexagonAttrs::HVXARCH, |
| 21 | .Routine: &ELFCompactAttrParser::integerAttribute, |
| 22 | }, |
| 23 | { |
| 24 | .Attribute: HexagonAttrs::HVXIEEEFP, |
| 25 | .Routine: &ELFCompactAttrParser::integerAttribute, |
| 26 | }, |
| 27 | { |
| 28 | .Attribute: HexagonAttrs::HVXQFLOAT, |
| 29 | .Routine: &ELFCompactAttrParser::integerAttribute, |
| 30 | }, |
| 31 | { |
| 32 | .Attribute: HexagonAttrs::ZREG, |
| 33 | .Routine: &ELFCompactAttrParser::integerAttribute, |
| 34 | }, |
| 35 | { |
| 36 | .Attribute: HexagonAttrs::AUDIO, |
| 37 | .Routine: &ELFCompactAttrParser::integerAttribute, |
| 38 | }, |
| 39 | { |
| 40 | .Attribute: HexagonAttrs::CABAC, |
| 41 | .Routine: &ELFCompactAttrParser::integerAttribute, |
| 42 | }}; |
| 43 | |
| 44 | Error HexagonAttributeParser::handler(uint64_t Tag, bool &Handled) { |
| 45 | Handled = false; |
| 46 | for (const auto &R : DisplayRoutines) { |
| 47 | if (uint64_t(R.Attribute) == Tag) { |
| 48 | if (Error E = (this->*R.Routine)(Tag)) |
| 49 | return E; |
| 50 | Handled = true; |
| 51 | break; |
| 52 | } |
| 53 | } |
| 54 | return Error::success(); |
| 55 | } |
| 56 | |