compiler.h 667 B

12345678910111213141516171819202122
  1. /* Copyright 2018 SiFive, Inc */
  2. /* SPDX-License-Identifier: Apache-2.0 */
  3. #ifndef METAL__COMPILER_H
  4. #define METAL__COMPILER_H
  5. #define __METAL_DECLARE_VTABLE(type) \
  6. extern const struct type type;
  7. #define __METAL_DEFINE_VTABLE(type) \
  8. const struct type type
  9. #define __METAL_GET_FIELD(reg, mask) \
  10. (((reg) & (mask)) / ((mask) & ~((mask) << 1)))
  11. /* Set field with mask for a given value */
  12. #define __METAL_SET_FIELD(reg, mask, val) \
  13. (((reg) & ~(mask)) | (((val) * ((mask) & ~((mask) << 1))) & (mask)))
  14. void _metal_trap(int ecode);
  15. #endif