Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and improvements for emit/__emit #211

Merged
merged 43 commits into from
Dec 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4fc7ef8
emit/__emit: Use 'tFIRST' instead of hardcoded '256'
Daniel-Cortez Oct 25, 2017
2492d47
emit/__emit: Set the sign bit properly on non-32-bit cells
Daniel-Cortez Oct 25, 2017
06feab9
emit/__emit: Code cleanup
Daniel-Cortez Oct 26, 2017
d15c11f
Fix OPHANDLER_CALL-related warnings issued by clang on non-x86 targets
Daniel-Cortez Oct 29, 2017
af31143
emit/__emit: Avoid excess instruction name copying in emit_findopcode()
Daniel-Cortez Oct 30, 2017
eb5ee44
emit/__emit: Use case-sensitive search in emit_findopcode()
Daniel-Cortez Oct 30, 2017
7440670
fix params for data seg.
VVWVV Oct 27, 2017
28c69cd
#emit: Set the sign bit properly on non-32-bit cells
Daniel-Cortez Nov 12, 2017
f921451
emit/__emit: Fix multiple occurences of NULL pointer dereference
Daniel-Cortez Nov 12, 2017
d4af23b
emit/__emit: Allow local constants to be used as data addresses in em…
Daniel-Cortez Nov 12, 2017
35fb9e8
emit/__emit: Remove excess instruction name passing to emit_param_num…
Daniel-Cortez Nov 12, 2017
69b552c
emit/__emit: Simplify the code in emit_parm2_gvar_num()
Daniel-Cortez Nov 12, 2017
f5cbeb0
emit/__emit: Remove excess sc_tokens declarations, fix cell*/ucell* a…
Daniel-Cortez Nov 12, 2017
b726f44
emit/__emit: Simplify the code in emit_parm1_lbl() and emit_do_case()
Daniel-Cortez Nov 12, 2017
d788eea
emit/__emit: Make 'switch', 'casetbl' and 'case' generate valid code
Daniel-Cortez Nov 13, 2017
cccf0f1
emit/__emit: Remove check_empty() from sc1.c
Daniel-Cortez Nov 13, 2017
c14186a
emit/__emit: Fix 'need_token' argument being unused in emit_invalid_t…
Daniel-Cortez Nov 13, 2017
e55f6a2
emit/__emit: Minor adjustments
Daniel-Cortez Nov 13, 2017
c58fce3
emit/__emit: New argument type: local variable (name or offset)
Daniel-Cortez Nov 14, 2017
abe9c96
emit/__emit: Make type mismatch errors more informative
Daniel-Cortez Nov 17, 2017
912376b
emit/__emit: Check if the argument of instruction 'call' is a Pawn fu…
Daniel-Cortez Nov 17, 2017
5eb18c4
emit/__emit: Allow for leading '-' to negate symbol values in emit_pa…
Daniel-Cortez Nov 17, 2017
5c0d45a
emit/__emit: emit_param_data(): make sure the argument is not a function
Daniel-Cortez Nov 17, 2017
98817bf
emit/__emit: Code cleanup, minor fixes
Daniel-Cortez Nov 17, 2017
15e5327
emit/__emit: Allow named constants with 'lodb.i' and 'strb.i'
Daniel-Cortez Nov 17, 2017
60ca000
emit/__emit: Also check the arguments of 'lctrl' and 'sctrl'
Daniel-Cortez Nov 17, 2017
7f9be67
emit/__emit: Change the argument order in 'outinstr()'
Daniel-Cortez Nov 18, 2017
b52e32d
emit/__emit: Move 'fetchlab()' closer to 'dogoto()' and 'dolabel()'
Daniel-Cortez Nov 18, 2017
40bf47c
emit/__emit: Allow direct use of opcode 'casetbl'
Daniel-Cortez Nov 18, 2017
23ab402
emit/__emit: Fix argument handling in 'const.s'
Daniel-Cortez Nov 19, 2017
afc8299
emit/__emit: Add support for 'lctrl 8/9' and 'sctrl 8/9'
Daniel-Cortez Nov 23, 2017
907c4b6
emit/__emit: Syntax change
Daniel-Cortez Nov 29, 2017
873060e
emit/__emit: Do not allow to redefine the same label
Daniel-Cortez Dec 2, 2017
fab8c53
emit/__emit: Allow the use of constant expressions as opcode arguments
Daniel-Cortez Dec 3, 2017
e922e48
emit/__emit: Fix incorrect code generation
Daniel-Cortez Dec 4, 2017
5f716b7
emit/__emit: Don't allow to use labels as arguments of type 'numeric …
Daniel-Cortez Dec 4, 2017
bd01c04
emit/__emit: Fix argument type for 'addr.pri/alt'
Daniel-Cortez Dec 4, 2017
c77b0f1
emit/__emit: Verify the arguments for 'sysreq.c' and 'sysreq.n'
Daniel-Cortez Dec 5, 2017
59428b0
emit/__emit: Code cleanup, misc. adjustments
Daniel-Cortez Dec 6, 2017
d569120
emit/__emit: Move the "anti-optimisation" workaround to 'emit_parse_l…
Daniel-Cortez Dec 6, 2017
9fbe72e
emit/__emit: Implement compatibility fallbacks for 'sysreq.c' and 'sy…
Daniel-Cortez Dec 6, 2017
54fd3ae
emit/__emit: Add fallbacks for the other macro opcodes
Daniel-Cortez Dec 6, 2017
939c060
emit/__emit: Another syntax change
Daniel-Cortez Dec 9, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 28 additions & 17 deletions source/compiler/sc.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,16 @@
#include "../amx/amx.h"

#if defined _MSC_VER
#define OPHANDLER_CALL __fastcall
#elif defined __GNUC__
#if defined __clang__
#define OPHANDLER_CALL __attribute__((fastcall))
#elif (defined __i386__ || defined __x86_64__ || defined __amd64__)
#if !defined __x86_64__ && !defined __amd64__ && (__GNUC__>=4 || __GNUC__==3 && __GNUC_MINOR__>=4)
#define OPHANDLER_CALL __attribute__((fastcall))
#else
#define OPHANDLER_CALL __attribute__((regparam(3)))
#endif
#define SC_FASTCALL __fastcall
#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__ || defined __amd64__)
#if !defined __x86_64__ && !defined __amd64__ && (__GNUC__>=4 || __GNUC__==3 && __GNUC_MINOR__>=4)
#define SC_FASTCALL __attribute__((fastcall))
#else
#define OPHANDLER_CALL
#define SC_FASTCALL __attribute__((regparam(3)))
#endif
#else
#define OPHANDLER_CALL
#endif
#if !defined SC_FASTCALL
#define SC_FASTCALL
#endif

/* Note: the "cell" and "ucell" types are defined in AMX.H */
Expand Down Expand Up @@ -407,8 +402,15 @@ typedef struct s_valuepair {
#define tSYMBOL 336
#define tLABEL 337
#define tSTRING 338
#define tEXPR 339 /* for assigment to "lastst" only (see SC1.C) */
#define tENDLESS 340 /* endless loop, for assigment to "lastst" only */
/* argument types for emit/__emit */
#define teNUMERIC 339 /* integer/rational number */
#define teDATA 340 /* data (variable name or address) */
#define teLOCAL 341 /* local variable (name or offset) */
#define teFUNCTN 342 /* Pawn function */
#define teNATIVE 343 /* native function */
/* for assigment to "lastst" only (see SC1.C) */
#define tEXPR 344
#define tENDLESS 345 /* endless loop */

/* (reversed) evaluation of staging buffer */
#define sSTARTREORDER 0x01
Expand Down Expand Up @@ -699,7 +701,7 @@ SC_FUNC void dec(value *lval);
SC_FUNC void jmp_ne0(int number);
SC_FUNC void jmp_eq0(int number);
SC_FUNC void outval(cell val,int newline);
SC_FUNC void outinstr(const char *name, int nargs, ucell *args);
SC_FUNC void outinstr(const char *name,ucell args[],int numargs);

/* function prototypes in SC5.C */
SC_FUNC int error(int number,...);
Expand Down Expand Up @@ -868,7 +870,16 @@ SC_VDECL FILE *outf; /* file written to */

SC_VDECL jmp_buf errbuf; /* target of longjmp() on a fatal error */

SC_VDECL int emit_block_parsing;
/* Possible entries for "emit_flags"
* Bits: 0 (epmBLOCK) multiline ('{}' block) syntax
* 1 (epmEXPR) used within an expression
* 2 (epmGLOBAL) used outside of a function
*/
#define efBLOCK 1
#define efEXPR 2
#define efGLOBAL 4
SC_VDECL int emit_flags;
SC_VDECL int emit_stgbuf_idx;

#if !defined SC_LIGHT
SC_VDECL int sc_makereport; /* generate a cross-reference report */
Expand Down
Loading