| Oliver Stannard | a930111 | 2018-03-06 14:07:01 +0000 | [diff] [blame] | 1 | //===- MCAsmMacro.h - Assembly Macros ---------------------------*- C++ -*-===// |
| 2 | // |
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
| Oliver Stannard | a930111 | 2018-03-06 14:07:01 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/MC/MCAsmMacro.h" |
| 10 | #include "llvm/Support/raw_ostream.h" |
| 11 | |
| 12 | using namespace llvm; |
| 13 | |
| 14 | void MCAsmMacroParameter::dump(raw_ostream &OS) const { |
| 15 | OS << "\"" << Name << "\""; |
| 16 | if (Required) |
| 17 | OS << ":req"; |
| 18 | if (Vararg) |
| 19 | OS << ":vararg"; |
| 20 | if (!Value.empty()) { |
| 21 | OS << " = "; |
| 22 | bool first = true; |
| 23 | for (const AsmToken &T : Value) { |
| 24 | if (!first) |
| 25 | OS << ", "; |
| 26 | first = false; |
| Oliver Stannard | 4468107 | 2018-03-06 16:51:17 +0000 | [diff] [blame] | 27 | OS << T.getString(); |
| Oliver Stannard | a930111 | 2018-03-06 14:07:01 +0000 | [diff] [blame] | 28 | } |
| 29 | } |
| 30 | OS << "\n"; |
| 31 | } |
| 32 | |
| 33 | void MCAsmMacro::dump(raw_ostream &OS) const { |
| 34 | OS << "Macro " << Name << ":\n"; |
| 35 | OS << " Parameters:\n"; |
| 36 | for (const MCAsmMacroParameter &P : Parameters) { |
| 37 | OS << " "; |
| 38 | P.dump(); |
| 39 | } |
| 40 | OS << " (BEGIN BODY)" << Body << "(END BODY)\n"; |
| 41 | } |