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