MCAsmMacro.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. #include "llvm/MC/MCAsmMacro.h"
  9. #include "llvm/Support/raw_ostream.h"
  10. using namespace llvm;
  11. #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
  12. void MCAsmMacroParameter::dump(raw_ostream &OS) const {
  13. OS << "\"" << Name << "\"";
  14. if (Required)
  15. OS << ":req";
  16. if (Vararg)
  17. OS << ":vararg";
  18. if (!Value.empty()) {
  19. OS << " = ";
  20. bool first = true;
  21. for (const AsmToken &T : Value) {
  22. if (!first)
  23. OS << ", ";
  24. first = false;
  25. OS << T.getString();
  26. }
  27. }
  28. OS << "\n";
  29. }
  30. void MCAsmMacro::dump(raw_ostream &OS) const {
  31. OS << "Macro " << Name << ":\n";
  32. OS << " Parameters:\n";
  33. for (const MCAsmMacroParameter &P : Parameters) {
  34. OS << " ";
  35. P.dump();
  36. }
  37. if (!Locals.empty()) {
  38. OS << " Locals:\n";
  39. for (StringRef L : Locals)
  40. OS << " " << L << '\n';
  41. }
  42. OS << " (BEGIN BODY)" << Body << "(END BODY)\n";
  43. }
  44. #endif