2018-07-01 15:52:15 +00:00
|
|
|
/*
|
2020-01-12 16:50:37 +00:00
|
|
|
* Copyright (c) 2020 Calvin Rose
|
2018-07-01 15:52:15 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to
|
|
|
|
* deal in the Software without restriction, including without limitation the
|
|
|
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2018-09-06 02:18:42 +00:00
|
|
|
#ifndef JANET_EMIT_H
|
|
|
|
#define JANET_EMIT_H
|
2018-07-01 15:52:15 +00:00
|
|
|
|
2019-01-24 05:15:58 +00:00
|
|
|
#ifndef JANET_AMALG
|
2018-07-01 15:52:15 +00:00
|
|
|
#include "compile.h"
|
2019-01-24 05:15:58 +00:00
|
|
|
#endif
|
2018-07-01 15:52:15 +00:00
|
|
|
|
2018-09-06 02:18:42 +00:00
|
|
|
void janetc_emit(JanetCompiler *c, uint32_t instr);
|
2018-07-01 15:52:15 +00:00
|
|
|
|
2018-09-06 02:18:42 +00:00
|
|
|
int32_t janetc_allocfar(JanetCompiler *c);
|
|
|
|
int32_t janetc_allocnear(JanetCompiler *c, JanetcRegisterTemp);
|
2018-07-01 15:52:15 +00:00
|
|
|
|
2018-09-06 02:18:42 +00:00
|
|
|
int32_t janetc_emit_s(JanetCompiler *c, uint8_t op, JanetSlot s, int wr);
|
|
|
|
int32_t janetc_emit_sl(JanetCompiler *c, uint8_t op, JanetSlot s, int32_t label);
|
|
|
|
int32_t janetc_emit_st(JanetCompiler *c, uint8_t op, JanetSlot s, int32_t tflags);
|
|
|
|
int32_t janetc_emit_si(JanetCompiler *c, uint8_t op, JanetSlot s, int16_t immediate, int wr);
|
|
|
|
int32_t janetc_emit_su(JanetCompiler *c, uint8_t op, JanetSlot s, uint16_t immediate, int wr);
|
|
|
|
int32_t janetc_emit_ss(JanetCompiler *c, uint8_t op, JanetSlot s1, JanetSlot s2, int wr);
|
|
|
|
int32_t janetc_emit_ssi(JanetCompiler *c, uint8_t op, JanetSlot s1, JanetSlot s2, int8_t immediate, int wr);
|
|
|
|
int32_t janetc_emit_ssu(JanetCompiler *c, uint8_t op, JanetSlot s1, JanetSlot s2, uint8_t immediate, int wr);
|
|
|
|
int32_t janetc_emit_sss(JanetCompiler *c, uint8_t op, JanetSlot s1, JanetSlot s2, JanetSlot s3, int wr);
|
2018-07-01 15:52:15 +00:00
|
|
|
|
2020-06-28 20:52:59 +00:00
|
|
|
/* Check if two slots are equivalent */
|
|
|
|
int janetc_sequal(JanetSlot x, JanetSlot y);
|
|
|
|
|
2018-07-01 15:52:15 +00:00
|
|
|
/* Move value from one slot to another. Cannot copy to constant slots. */
|
2018-09-06 02:18:42 +00:00
|
|
|
void janetc_copy(JanetCompiler *c, JanetSlot dest, JanetSlot src);
|
2018-07-01 15:52:15 +00:00
|
|
|
|
|
|
|
#endif
|