T.I.M | Toolchain Documentation
|
Header file for all common code shared across the tim toolchain. More...
#include "stdio.h"
Go to the source code of this file.
#define | TIM_PRINT_PROMPT "\e[1;36mtim>\e[0m " |
The prefix for all stdout/stderr messages. More... | |
#define | TIM_PROMPT printf(TIM_PRINT_PROMPT) |
Prints the prompt to stdout. More... | |
#define | tprintf(...) {TIM_PROMPT; printf(__VA_ARGS__);} |
Masking print macro that places the prompt in front of the message. More... | |
#define | log(...) {TIM_PROMPT; printf(__VA_ARGS__);} |
Alias for the tprintf macro. More... | |
#define | debug(...) ; |
Alternative debug macro that is evaluated to NOP when we are not in a debug build. More... | |
#define | warning(...) |
Warning macro that spits out line number and function. More... | |
#define | error(...) |
Error macro that spits out the line number and function. More... | |
#define | fatal(...) |
Fatal error macro that behaves the same as error() but also exits the program. More... | |
#define | TRUE 1 |
#define | FALSE 0 |
enum | tim_register { R0 = 0, R1 = 1, R2 = 2, R3 = 3, R4 = 4, R5 = 5, R6 = 6, R7 = 7, R8 = 8, R9 = 9, R10 = 10, R11 = 11, R12 = 12, R13 = 13, R14 = 14, R15 = 15, PC = 16, SP = 17, LR = 18, TR = 19, SR = 20, IR = 21, IS = 22, REG_RESERVED_1 = 23, T0 = 24, T1 = 25, T2 = 26, T3 = 27, T4 = 28, T5 = 29, T6 = 30, T7 = 31, REG_ERROR =32, REG_NOT_USED = 33 } |
Encodes the address of the registers. More... | |
enum | tim_instruction_opcode { LOADR, LOADI, STORI, STORR, PUSH, POP, MOVR, MOVI, JUMPR, JUMPI, CALLR, CALLI, RETURN, TEST, HALT, ANDR, NANDR, ORR, NORR, XORR, LSLR, LSRR, NOTR, ANDI, NANDI, ORI, NORI, XORI, LSLI, LSRI, IADDI, ISUBI, IMULI, IDIVI, IALSI, IASRI, IADDR, ISUBR, IMULR, IDIVR, IASLR, IASRR, FADDI, FSUBI, FMULI, FDIVI, FASLI, FASRI, FADDR, FSUBR, FMULR, FDIVR, FASLR, FASRR, SLEEP, NOT_EMITTED } |
Encodes all of the valid instruction opcodes and their bit values. More... | |
enum | tim_condition { ALWAYS = 0, IFTRUE = 1, IFFALSE = 2, IFZERO = 3 } |
A condition code for conditional execution. More... | |
typedef unsigned char | BOOL |
Boolean type. More... | |
typedef int | tim_immediate |
typedef for tim immediate values as operands to instructions. More... | |
typedef unsigned char | tim_instruction_size |
Encodes the size in bytes of an instruction in memory. More... | |
tim_instruction_opcode | opcode |
The opcode of the instruction. More... | |
tim_instruction_size | size |
The number of bytes the instruction occupies in memory. More... | |
BOOL | tim_is_general_register (tim_register reg) |
Checks if the supplied register is a general purpose register or not. More... | |
BOOL | tim_is_temp_register (tim_register reg) |
Checks if the supplied register is a temporary register or not. More... | |
BOOL | tim_is_special_register (tim_register reg) |
Checks if the supplied register is a special register or not. More... | |
Header file for all common code shared across the tim toolchain.
#define debug | ( | ... | ) | ; |
Alternative debug macro that is evaluated to NOP when we are not in a debug build.
#define error | ( | ... | ) |
Error macro that spits out the line number and function.
Referenced by asm_calculate_addresses(), asm_emit_instructions(), asm_lex_immediate(), asm_lex_input_file(), asm_lex_register(), asm_parse_call_jump(), asm_parse_data(), asm_parse_opcode(), asm_parse_push_pop(), asm_parse_three_operand(), asm_parse_three_register_operands(), asm_parse_token_stream(), asm_parse_two_operand(), asm_parse_two_register_one_immediate(), and main().
#define FALSE 0 |
Referenced by asm_parse_data(), tim_is_general_register(), tim_is_special_register(), and tim_is_temp_register().
#define fatal | ( | ... | ) |
Fatal error macro that behaves the same as error() but also exits the program.
Referenced by main(), and parse_cmd_args().
#define log | ( | ... | ) | {TIM_PROMPT; printf(__VA_ARGS__);} |
Alias for the tprintf macro.
Referenced by asm_calculate_addresses(), and main().
#define TIM_PRINT_PROMPT "\e[1;36mtim>\e[0m " |
The prefix for all stdout/stderr messages.
#define TIM_PROMPT printf(TIM_PRINT_PROMPT) |
Prints the prompt to stdout.
#define tprintf | ( | ... | ) | {TIM_PROMPT; printf(__VA_ARGS__);} |
Masking print macro that places the prompt in front of the message.
Referenced by usage().
#define TRUE 1 |
#define warning | ( | ... | ) |
Warning macro that spits out line number and function.
Referenced by asm_hash_table_expand(), asm_parse_opcode(), and parse_cmd_args().
typedef unsigned char BOOL |
Boolean type.
typedef int tim_immediate |
typedef for tim immediate values as operands to instructions.
typedef unsigned char tim_instruction_size |
Encodes the size in bytes of an instruction in memory.
enum tim_condition |
Encodes all of the valid instruction opcodes and their bit values.
enum tim_register |
BOOL tim_is_general_register | ( | tim_register | reg | ) |
BOOL tim_is_special_register | ( | tim_register | reg | ) |
BOOL tim_is_temp_register | ( | tim_register | reg | ) |
tim_instruction_opcode opcode |
The opcode of the instruction.
Referenced by asm_calculate_addresses(), asm_emit_instructions(), asm_emit_opcode_ANDI(), asm_emit_opcode_ANDR(), asm_emit_opcode_CALLI(), asm_emit_opcode_CALLR(), asm_emit_opcode_FADDI(), asm_emit_opcode_FADDR(), asm_emit_opcode_FASLI(), asm_emit_opcode_FASLR(), asm_emit_opcode_FASRI(), asm_emit_opcode_FASRR(), asm_emit_opcode_FDIVI(), asm_emit_opcode_FDIVR(), asm_emit_opcode_FMULI(), asm_emit_opcode_FMULR(), asm_emit_opcode_FSUBI(), asm_emit_opcode_FSUBR(), asm_emit_opcode_HALT(), asm_emit_opcode_IADDI(), asm_emit_opcode_IADDR(), asm_emit_opcode_IALSI(), asm_emit_opcode_IASLR(), asm_emit_opcode_IASRI(), asm_emit_opcode_IASRR(), asm_emit_opcode_IDIVI(), asm_emit_opcode_IDIVR(), asm_emit_opcode_IMULI(), asm_emit_opcode_IMULR(), asm_emit_opcode_ISUBI(), asm_emit_opcode_ISUBR(), asm_emit_opcode_JUMPI(), asm_emit_opcode_JUMPR(), asm_emit_opcode_LOADI(), asm_emit_opcode_LOADR(), asm_emit_opcode_LSLI(), asm_emit_opcode_LSLR(), asm_emit_opcode_LSRI(), asm_emit_opcode_LSRR(), asm_emit_opcode_MOVI(), asm_emit_opcode_MOVR(), asm_emit_opcode_NANDI(), asm_emit_opcode_NANDR(), asm_emit_opcode_NORI(), asm_emit_opcode_NORR(), asm_emit_opcode_NOTR(), asm_emit_opcode_ORI(), asm_emit_opcode_ORR(), asm_emit_opcode_POP(), asm_emit_opcode_PUSH(), asm_emit_opcode_RETURN(), asm_emit_opcode_SLEEP(), asm_emit_opcode_STORI(), asm_emit_opcode_STORR(), asm_emit_opcode_TEST(), asm_emit_opcode_XORI(), asm_emit_opcode_XORR(), asm_parse_call_jump(), asm_parse_data(), asm_parse_nop(), asm_parse_opcode(), asm_parse_push_pop(), asm_parse_sleep(), asm_parse_three_operand(), asm_parse_three_register_operands(), asm_parse_two_operand(), and asm_parse_two_register_one_immediate().
tim_instruction_size size |
The number of bytes the instruction occupies in memory.
Referenced by asm_calculate_addresses(), asm_parse_call_jump(), asm_parse_data(), asm_parse_nop(), asm_parse_opcode(), asm_parse_push_pop(), asm_parse_sleep(), asm_parse_three_register_operands(), asm_parse_two_operand(), and asm_parse_two_register_one_immediate().