質問編集履歴

6

情報が足りなかった

2021/06/06 06:02

投稿

grape_ll
grape_ll

スコア83

test CHANGED
File without changes
test CHANGED
@@ -66,7 +66,47 @@
66
66
 
67
67
  tlcの実行結果
68
68
 
69
+ ```ここに言語を入力
70
+
71
+ FuncTab
72
+
73
+ sum #1
74
+
75
+ main #2
76
+
77
+
78
+
79
+ SymTab
80
+
81
+ id(1)
82
+
83
+ a #1, offset(-4)
84
+
85
+ b #2, offset(-8)
86
+
87
+ id(2)
88
+
89
+ a #1, offset(-4)
90
+
91
+ root
92
+
93
+ func[ identifier(r0)(sum)] ( param(r0)( identifier(r0)(a)) param(r0)( identifier(r0)(b)))
94
+
69
- ![イメージ説明](8eec0f5de13caceb0e406c81b30a1c18.png)
95
+ l(3): return( add(r0)( identifier(r0)(a) identifier(r1)(b)))
96
+
97
+
98
+
99
+ func[ identifier(r0)(main)] ()
100
+
101
+ l(8): declaration( identifier(r0)(a))
102
+
103
+ l(9): stm_asign( exp_asign(r0)( identifier(r0)(a) call(r1)( identifier(r0)(sum) ( const_int(r0)(1) const_int(r0)(2)))))
104
+
105
+ l(10): stm_asign( call(r0)( identifier(r0)(put_int) ( identifier(r0)(a))))
106
+
107
+
108
+
109
+ ```
70
110
 
71
111
 
72
112
 

5

内容の充実化

2021/06/06 06:02

投稿

grape_ll
grape_ll

スコア83

test CHANGED
File without changes
test CHANGED
@@ -221,3 +221,63 @@
221
221
  58 .section .note.GNU-stack,"",@progbits
222
222
 
223
223
  ```
224
+
225
+
226
+
227
+ これのtlcによる実行
228
+
229
+ ```ここに言語を入力
230
+
231
+ FuncTab
232
+
233
+ sum #1
234
+
235
+ main #2
236
+
237
+
238
+
239
+ SymTab
240
+
241
+ id(1)
242
+
243
+ a #1, offset(-12)
244
+
245
+ b #2, offset(-16)
246
+
247
+ c #3, offset(-20)
248
+
249
+ d #4, offset(-24)
250
+
251
+ e #5, offset(-28)
252
+
253
+ f #6, offset(-32)
254
+
255
+ g #7, offset(-36)
256
+
257
+ h #8, offset(-40)
258
+
259
+ i #9, offset(-8)
260
+
261
+ id(2)
262
+
263
+ a #1, offset(-4)
264
+
265
+ root
266
+
267
+ func[ identifier(r0)(sum)] ( param(r0)( identifier(r0)(a)) param(r0)( identifier(r0)(b)) param(r0)( identifier(r0)(c)) param(r0)( identifier(r0)(d)) param(r0)( identifier(r0)(e)) param(r0)( identifier(r0)(f)) param(r0)( identifier(r0)(g)) param(r0)( identifier(r0)(h)) param(r0)( identifier(r0)(i)))
268
+
269
+ l(3): return( add(r0)( add(r0)( add(r0)( add(r0)( add(r0)( add(r0)( add(r0)( add(r0)( identifier(r0)(a) identifier(r1)(b)) identifier(r1)(c)) identifier(r1)(d)) identifier(r1)(e)) identifier(r1)(f)) identifier(r1)(g)) identifier(r1)(h)) identifier(r1)(i)))
270
+
271
+
272
+
273
+ func[ identifier(r0)(main)] ()
274
+
275
+ l(8): declaration( identifier(r0)(a))
276
+
277
+ l(9): stm_asign( exp_asign(r0)( identifier(r0)(a) call(r1)( identifier(r0)(sum) ( const_int(r0)(1) const_int(r0)(2) const_int(r0)(3) const_int(r0)(4) const_int(r0)(5) const_int(r0)(6) const_int(r0)(7) const_int(r0)(8) const_int(r0)(9)))))
278
+
279
+ l(10): stm_asign( call(r0)( identifier(r0)(put_int) ( identifier(r0)(a))))
280
+
281
+
282
+
283
+ ```

4

内容の充実化

2021/06/06 05:59

投稿

grape_ll
grape_ll

スコア83

test CHANGED
File without changes
test CHANGED
@@ -59,3 +59,165 @@
59
59
  ###アセンブリ
60
60
 
61
61
  ![イメージ説明](d6f9cb93cf4f9751c1e023232ad8dbe9.png)
62
+
63
+
64
+
65
+ ###追記
66
+
67
+ tlcの実行結果
68
+
69
+ ![イメージ説明](8eec0f5de13caceb0e406c81b30a1c18.png)
70
+
71
+
72
+
73
+ 引数が9個のプログラム
74
+
75
+ ```C
76
+
77
+ sum(int a, int b, int c, int d, int e, int f,int g,int h,int i)
78
+
79
+ {
80
+
81
+ return a+b+c+d+e+f+g+h+i;
82
+
83
+ }
84
+
85
+
86
+
87
+ main()
88
+
89
+ {
90
+
91
+ int a;
92
+
93
+ a= sum(1, 2,3,4,5,6,7,8,9);
94
+
95
+ put_int(a);
96
+
97
+ }
98
+
99
+
100
+
101
+ ```
102
+
103
+
104
+
105
+ ```ここに言語を入力
106
+
107
+ 1 .arch armv8-a
108
+
109
+ 2 .file "nine_var.c"
110
+
111
+ 3 .text
112
+
113
+ 4 .align 2
114
+
115
+ 5 .global sum
116
+
117
+ 6 .type sum, %function
118
+
119
+ 7 sum:
120
+
121
+ 8 .LFB0:
122
+
123
+ 9 .cfi_startproc
124
+
125
+ 10 add w0, w0, w1
126
+
127
+ 11 add w0, w0, w2
128
+
129
+ 12 add w0, w0, w3
130
+
131
+ 13 add w0, w0, w4
132
+
133
+ 14 add w0, w0, w5
134
+
135
+ 15 add w0, w0, w6
136
+
137
+ 16 add w0, w0, w7
138
+
139
+ 17 ldr w1, [sp]
140
+
141
+ 18 add w0, w0, w1
142
+
143
+ 19 ret
144
+
145
+ 20 .cfi_endproc
146
+
147
+ 21 .LFE0:
148
+
149
+ 22 .size sum, .-sum
150
+
151
+ 23 .align 2
152
+
153
+ 24 .global main
154
+
155
+ 25 .type main, %function
156
+
157
+ 26 main:
158
+
159
+ 27 .LFB1:
160
+
161
+ 28 .cfi_startproc
162
+
163
+ 29 sub sp, sp, #32
164
+
165
+ 30 .cfi_def_cfa_offset 32
166
+
167
+ 31 stp x29, x30, [sp, 16]
168
+
169
+ 32 .cfi_offset 29, -16
170
+
171
+ 33 .cfi_offset 30, -8
172
+
173
+ 34 add x29, sp, 16
174
+
175
+ 35 mov w0, 9
176
+
177
+ 36 str w0, [sp]
178
+
179
+ 37 mov w7, 8
180
+
181
+ 38 mov w6, 7
182
+
183
+ 39 mov w5, 6
184
+
185
+ 40 mov w4, 5
186
+
187
+ 41 mov w3, 4
188
+
189
+ 42 mov w2, 3
190
+
191
+ 43 mov w1, 2
192
+
193
+ 44 mov w0, 1
194
+
195
+ 45 bl sum
196
+
197
+ 46 bl put_int
198
+
199
+ 47 mov w0, 0
200
+
201
+ 48 ldp x29, x30, [sp, 16]
202
+
203
+ 49 add sp, sp, 32
204
+
205
+ 50 .cfi_restore 29
206
+
207
+ 51 .cfi_restore 30
208
+
209
+ 52 .cfi_def_cfa_offset 0
210
+
211
+ 53 ret
212
+
213
+ 54 .cfi_endproc
214
+
215
+ 55 .LFE1:
216
+
217
+ 56 .size main, .-main
218
+
219
+ 57 .ident "GCC: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0"
220
+
221
+ 58 .section .note.GNU-stack,"",@progbits
222
+
223
+ ```

3

情報が足りなかった

2021/06/06 05:57

投稿

grape_ll
grape_ll

スコア83

test CHANGED
File without changes
test CHANGED
@@ -58,94 +58,4 @@
58
58
 
59
59
  ###アセンブリ
60
60
 
61
- ```アセンブリ
62
-
63
- .file "test22.c"
64
-
65
- .text
66
-
67
- .globl _sum
68
-
69
- .def _sum; .scl 2; .type 32; .endef
70
-
71
- _sum:
72
-
73
- LFB0:
74
-
75
- .cfi_startproc
76
-
77
- movl 8(%esp), %eax
78
-
79
- addl 4(%esp), %eax
80
-
81
- ret
82
-
83
- .cfi_endproc
84
-
85
- LFE0:
86
-
87
- .def ___main; .scl 2; .type 32; .endef
88
-
89
- .globl _main
90
-
91
- .def _main; .scl 2; .type 32; .endef
92
-
93
- _main:
94
-
95
- LFB1:
96
-
97
- .cfi_startproc
98
-
99
- pushl %ebp
100
-
101
- .cfi_def_cfa_offset 8
102
-
103
- .cfi_offset 5, -8
104
-
105
- movl %esp, %ebp
106
-
107
- .cfi_def_cfa_register 5
108
-
109
- andl $-16, %esp
110
-
111
- subl $16, %esp
112
-
113
- call ___main
114
-
115
- movl $2, 4(%esp)
116
-
117
- movl $1, (%esp)
118
-
119
- call _sum
120
-
121
- movl %eax, (%esp)
122
-
123
- call _put_int
124
-
125
- movl $0, %eax
126
-
127
- leave
128
-
129
- .cfi_restore 5
130
-
131
- .cfi_def_cfa 4, 4
132
-
133
- ret
134
-
135
- .cfi_endproc
136
-
137
- LFE1:
138
-
139
- .ident "GCC: (MinGW.org GCC-6.3.0-1) 6.3.0"
140
-
141
- .def _put_int; .scl 2; .type 32; .endef
61
+ ![イメージ説明](d6f9cb93cf4f9751c1e023232ad8dbe9.png)
142
-
143
-
144
-
145
- ```
146
-
147
-
148
-
149
-
150
-
151
- ```

2

情報が足りなかった

2021/06/05 13:00

投稿

grape_ll
grape_ll

スコア83

test CHANGED
File without changes
test CHANGED
@@ -148,90 +148,4 @@
148
148
 
149
149
 
150
150
 
151
- ###アセンブリ
152
-
153
151
  ```
154
-
155
- .file "test22.c"
156
-
157
- .text
158
-
159
- .globl _sum
160
-
161
- .def _sum; .scl 2; .type 32; .endef
162
-
163
- _sum:
164
-
165
- LFB0:
166
-
167
- .cfi_startproc
168
-
169
- movl 8(%esp), %eax
170
-
171
- addl 4(%esp), %eax
172
-
173
- ret
174
-
175
- .cfi_endproc
176
-
177
- LFE0:
178
-
179
- .def ___main; .scl 2; .type 32; .endef
180
-
181
- .globl _main
182
-
183
- .def _main; .scl 2; .type 32; .endef
184
-
185
- _main:
186
-
187
- LFB1:
188
-
189
- .cfi_startprコードoc
190
-
191
- pushl %ebp
192
-
193
- .cfi_def_cfa_offset 8
194
-
195
- .cfi_offset 5, -8
196
-
197
- movl %esp, %ebp
198
-
199
- .cfi_def_cfa_register 5
200
-
201
- andl $-16, %esp
202
-
203
- subl $16, %esp
204
-
205
- call ___main
206
-
207
- movl $2, 4(%esp)
208
-
209
- movl $1, (%esp)
210
-
211
- call _sum
212
-
213
- movl %eax, (%esp)
214
-
215
- call _put_int
216
-
217
- movl $0, %eax
218
-
219
- leave
220
-
221
- .cfi_restore 5
222
-
223
- .cfi_def_cfa 4, 4
224
-
225
- ret
226
-
227
- .cfi_endproc
228
-
229
- LFE1:
230
-
231
- .ident "GCC: (MinGW.org GCC-6.3.0-1) 6.3.0"
232
-
233
- .def _put_int; .scl 2; .type 32; .endef
234
-
235
-
236
-
237
- ```

1

内容の充実化

2021/06/05 12:26

投稿

grape_ll
grape_ll

スコア83

test CHANGED
File without changes
test CHANGED
@@ -144,13 +144,13 @@
144
144
 
145
145
  ```
146
146
 
147
- ```
147
+
148
148
 
149
149
 
150
150
 
151
151
  ###アセンブリ
152
152
 
153
- ```アセンブリ
153
+ ```
154
154
 
155
155
  .file "test22.c"
156
156