1 /* 2 * Copyright (c) 2020 Travis Geiselbrecht 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8 #pragma once 9 10 // based on 32 or 64bit register widths, select the 32 or 64 bit 11 // wide load/stores 12 #if __riscv_xlen == 32 13 #define REGOFF(x) ((x) * 4) 14 #define STR sw 15 #define LDR lw 16 #else 17 #define REGOFF(x) ((x) * 8) 18 #define STR sd 19 #define LDR ld 20 #endif 21 22 #define RISCV_XLEN_BYTES (__riscv_xlen / 8) 23 24