IFSHandler.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- IFSHandler.h ---------------------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===-----------------------------------------------------------------------===/
  13. ///
  14. /// \file
  15. /// This file declares an interface for reading and writing .ifs (text-based
  16. /// InterFace Stub) files.
  17. ///
  18. //===-----------------------------------------------------------------------===/
  19. #ifndef LLVM_INTERFACESTUB_IFSHANDLER_H
  20. #define LLVM_INTERFACESTUB_IFSHANDLER_H
  21. #include "IFSStub.h"
  22. #include "llvm/Support/Error.h"
  23. #include "llvm/Support/VersionTuple.h"
  24. #include <memory>
  25. #include <optional>
  26. #include <string>
  27. #include <vector>
  28. namespace llvm {
  29. class raw_ostream;
  30. class Error;
  31. class StringRef;
  32. namespace ifs {
  33. struct IFSStub;
  34. const VersionTuple IFSVersionCurrent(3, 0);
  35. /// Attempts to read an IFS interface file from a StringRef buffer.
  36. Expected<std::unique_ptr<IFSStub>> readIFSFromBuffer(StringRef Buf);
  37. /// Attempts to write an IFS interface file to a raw_ostream.
  38. Error writeIFSToOutputStream(raw_ostream &OS, const IFSStub &Stub);
  39. /// Override the target platform inforation in the text stub.
  40. Error overrideIFSTarget(IFSStub &Stub, std::optional<IFSArch> OverrideArch,
  41. std::optional<IFSEndiannessType> OverrideEndianness,
  42. std::optional<IFSBitWidthType> OverrideBitWidth,
  43. std::optional<std::string> OverrideTriple);
  44. /// Validate the target platform inforation in the text stub.
  45. Error validateIFSTarget(IFSStub &Stub, bool ParseTriple);
  46. /// Strips target platform information from the text stub.
  47. void stripIFSTarget(IFSStub &Stub, bool StripTriple, bool StripArch,
  48. bool StripEndianness, bool StripBitWidth);
  49. Error filterIFSSyms(IFSStub &Stub, bool StripUndefined,
  50. const std::vector<std::string> &Exclude = {});
  51. /// Parse llvm triple string into a IFSTarget struct.
  52. IFSTarget parseTriple(StringRef TripleStr);
  53. } // end namespace ifs
  54. } // end namespace llvm
  55. #endif // LLVM_INTERFACESTUB_IFSHANDLER_H
  56. #ifdef __GNUC__
  57. #pragma GCC diagnostic pop
  58. #endif