PIPS
terasm.c File Reference

Go to the source code of this file.

Macros

#define _OP(a, b)   a##b
 
#define OP(a, b)   _OP(a,b)
 
#define TYPE   int
 
#define SUFF   i
 

Functions

TYPE OP (ref, SUFF)
 
TYPE OP (add, SUFF)
 
TYPE OP (addr, SUFF)
 
TYPE OP (sub, SUFF)
 
TYPE OP (subr, SUFF)
 
TYPE OP (lshift, SUFF)
 
TYPE OP (rshift, SUFF)
 
TYPE OP (prshift, SUFF)
 
TYPE OP (mul, SUFF)
 
TYPE OP (div, SUFF)
 
TYPE OP (mulr, SUFF)
 
TYPE OP (set, SUFF)
 
TYPE OP (pset, SUFF)
 
TYPE OP (setp, SUFF)
 
TYPE OP (psetp, SUFF)
 
TYPEOP (ppsetpp, SUFF)
 
TYPEOP (padd, SUFF)
 
TYPEOP (psub, SUFF)
 

Macro Definition Documentation

◆ _OP

#define _OP (   a,
 
)    a##b

Definition at line 1 of file terasm.c.

◆ OP

#define OP (   a,
 
)    _OP(a,b)

Definition at line 2 of file terasm.c.

◆ SUFF

#define SUFF   i

Definition at line 4 of file terasm.c.

◆ TYPE

#define TYPE   int

Definition at line 3 of file terasm.c.

Function Documentation

◆ OP() [1/18]

TYPE OP ( add  ,
SUFF   
)

Definition at line 11 of file terasm.c.

12 {
13  return lhs=rhs0+rhs1;
14 }

◆ OP() [2/18]

TYPE OP ( addr  ,
SUFF   
)

Definition at line 15 of file terasm.c.

16 {
17  return lhs=lhs+*rhs;
18 }

◆ OP() [3/18]

TYPE OP ( div  ,
SUFF   
)

Definition at line 43 of file terasm.c.

44 {
45  return lhs=lhs/rhs;
46 }

◆ OP() [4/18]

TYPE OP ( lshift  ,
SUFF   
)

Definition at line 27 of file terasm.c.

28 {
29  return lhs=lhs<<rhs;
30 }

◆ OP() [5/18]

TYPE OP ( mul  ,
SUFF   
)

Definition at line 39 of file terasm.c.

40 {
41  return lhs=lhs*rhs;
42 }

◆ OP() [6/18]

TYPE OP ( mulr  ,
SUFF   
)

Definition at line 47 of file terasm.c.

48 {
49  return lhs=lhs**rhs;
50 }

◆ OP() [7/18]

TYPE* OP ( padd  ,
SUFF   
)

Definition at line 71 of file terasm.c.

72 {
73  return lhs=rhs+val;
74 }

◆ OP() [8/18]

TYPE* OP ( ppsetpp  ,
SUFF   
)

Definition at line 67 of file terasm.c.

68 {
69  return lhs=rhs;
70 }

◆ OP() [9/18]

TYPE OP ( prshift  ,
SUFF   
)

Definition at line 35 of file terasm.c.

36 {
37  return *lhs=*lhs>>rhs;
38 }

◆ OP() [10/18]

TYPE OP ( pset  ,
SUFF   
)

Definition at line 55 of file terasm.c.

56 {
57  return *lhs=rhs;
58 }

◆ OP() [11/18]

TYPE OP ( psetp  ,
SUFF   
)

Definition at line 63 of file terasm.c.

64 {
65  return *lhs=*rhs;
66 }

◆ OP() [12/18]

TYPE* OP ( psub  ,
SUFF   
)

Definition at line 75 of file terasm.c.

76 {
77  return lhs=lhs-rhs;
78 }

◆ OP() [13/18]

TYPE OP ( ref  ,
SUFF   
)

Definition at line 6 of file terasm.c.

7 {
8  return *(ptr+index);
9 }

◆ OP() [14/18]

TYPE OP ( rshift  ,
SUFF   
)

Definition at line 31 of file terasm.c.

32 {
33  return lhs=lhs>>rhs;
34 }

◆ OP() [15/18]

TYPE OP ( set  ,
SUFF   
)

Definition at line 51 of file terasm.c.

52 {
53  return lhs=rhs;
54 }

◆ OP() [16/18]

TYPE OP ( setp  ,
SUFF   
)

Definition at line 59 of file terasm.c.

60 {
61  return lhs=*rhs;
62 }

◆ OP() [17/18]

TYPE OP ( sub  ,
SUFF   
)

Definition at line 19 of file terasm.c.

20 {
21  return lhs=rhs0-rhs1;
22 }

◆ OP() [18/18]

TYPE OP ( subr  ,
SUFF   
)

Definition at line 23 of file terasm.c.

24 {
25  return lhs=lhs-*rhs;
26 }