WasmGlobal.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft Corporation and contributors. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. namespace Wasm
  7. {
  8. class WasmGlobal
  9. {
  10. public:
  11. WasmGlobal(GlobalReferenceTypes::Type refType, uint offset, WasmTypes::WasmType type, bool isMutable, WasmNode init) :
  12. m_rType(refType),
  13. m_offset(offset),
  14. m_type(type),
  15. m_isMutable(isMutable),
  16. m_init(init)
  17. {};
  18. WasmTypes::WasmType GetType() const { return m_type; }
  19. bool IsMutable() const { return m_isMutable; }
  20. uint GetOffset() const { return m_offset; }
  21. GlobalReferenceTypes::Type GetReferenceType() const { return m_rType; }
  22. WasmConstLitNode GetConstInit() const;
  23. uint32 GetGlobalIndexInit() const;
  24. private:
  25. GlobalReferenceTypes::Type m_rType;
  26. WasmTypes::WasmType m_type;
  27. bool m_isMutable;
  28. uint m_offset;
  29. WasmNode m_init;
  30. };
  31. } // namespace Wasm