-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathifunlexi.ppcs
75 lines (67 loc) · 2.65 KB
/
ifunlexi.ppcs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: ALPHA-AXP-INTERNALS; Base: 10; Lowercase: T -*-
;(include-header "aihead.s")
;(include-header "aistat.s")
;(include-header "ifunhead.s")
(comment "Lexical variable accessors.")
;(align16k)
(define-instruction |DoPushLexicalVarN| :operand-from-stack ()
(srdi t4 arg3 10 "Position the opcode")
;; in-line (stack-read2 arg1 t2 t1)
(LWA t1 4 (arg1))
(LWA t2 0 (arg1))
(ANDI-DOT t4 t4 7 "Get the lexical var number")
(clrldi t1 t1 32)
(TagType t2 t3)
(ADDI t3 t3 #.(- |type$K-list|))
(rotrdi t3 t3 2) ;(BIC t3 4 t3)
(clrrdi t3 t3 1)
(ADD t1 t1 t4 "Compute the address of the lexical variable.")
(branch-if-nonzero t3 pushlexvariop)
(with-multiple-memory-reads (arg3 arg4 arg5 arg6)
(memory-read t1 t2 t3 PROCESSORSTATE_DATAREAD t4 t5 t6 t7 nil t))
(GetNextPCandCP)
(stack-push2 t2 t3 t4)
(ContinueToNextInstruction-NoStall)
(label pushlexvariop)
(illegal-operand unary-lexical-environment-type-error nil "Not a list or locative"))
(define-instruction |DoPopLexicalVarN| :operand-from-stack ()
(srdi t4 arg3 10 "Position the opcode")
;; in-line (stack-read2 arg1 t2 t1)
(LWA t1 4 (arg1))
(LWA t2 0 (arg1))
(ANDI-DOT t4 t4 7 "Get the lexical var number")
(clrldi t1 t1 32)
(TagType t2 t3)
(ADDI t3 t3 #.(- |type$K-list|))
(rotrdi t3 t3 2) ;(BIC t3 4 t3)
(clrrdi t3 t3 1)
(ADD t1 t1 t4 "Compute the address of the lexical variable.")
(branch-if-nonzero t3 poplexvariop)
(stack-pop2 t2 t3)
(with-multiple-memory-reads (arg3 arg4 arg5 arg6)
(store-contents t1 t2 t3 PROCESSORSTATE_DATAWRITE t4 t5 t6 t7 t8 t9
NextInstruction))
(ContinueToNextInstruction)
(label poplexvariop)
(illegal-operand binary-lexical-environment-type-error nil "Not a list or locative"))
(define-instruction |DoMovemLexicalVarN| :operand-from-stack ()
(srdi t4 arg3 10 "Position the opcode")
;; in-line (stack-read2 arg1 t2 t1)
(LWA t1 4 (arg1))
(LWA t2 0 (arg1))
(ANDI-DOT t4 t4 7 "Get the lexical var number")
(clrldi t1 t1 32)
(TagType t2 t3)
(ADDI t3 t3 #.(- |type$K-list|))
(rotrdi t3 t3 2) ;(BIC t3 4 t3)
(clrrdi t3 t3 1)
(ADD t1 t1 t4 "Compute the address of the lexical variable.")
(branch-if-nonzero t3 movemlexvariop)
(stack-read2 iSP t2 t3)
(with-multiple-memory-reads (arg3 arg4 arg5 arg6)
(store-contents t1 t2 t3 PROCESSORSTATE_DATAWRITE t4 t5 t6 t7 t8 t9
NextInstruction))
(ContinueToNextInstruction)
(label movemlexvariop)
(illegal-operand binary-lexical-environment-type-error nil "Not a list or locative"))
(comment "Fin.")