1 //===- MCAsmMacro.h - Assembly Macros ---------------------------*- C++ -*-===// 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/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; 27 OS << T.getString(); 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 } 42