teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

6

情報が足りなかった

2021/06/06 06:02

投稿

grape_ll
grape_ll

スコア83

title CHANGED
File without changes
body CHANGED
@@ -32,8 +32,28 @@
32
32
 
33
33
  ###追記
34
34
  tlcの実行結果
35
- ![イメージ説明](8eec0f5de13caceb0e406c81b30a1c18.png)
35
+ ```ここに言語を入力
36
+ FuncTab
37
+ sum #1
38
+ main #2
36
39
 
40
+ SymTab
41
+ id(1)
42
+ a #1, offset(-4)
43
+ b #2, offset(-8)
44
+ id(2)
45
+ a #1, offset(-4)
46
+ root
47
+ func[ identifier(r0)(sum)] ( param(r0)( identifier(r0)(a)) param(r0)( identifier(r0)(b)))
48
+ l(3): return( add(r0)( identifier(r0)(a) identifier(r1)(b)))
49
+
50
+ func[ identifier(r0)(main)] ()
51
+ l(8): declaration( identifier(r0)(a))
52
+ l(9): stm_asign( exp_asign(r0)( identifier(r0)(a) call(r1)( identifier(r0)(sum) ( const_int(r0)(1) const_int(r0)(2)))))
53
+ l(10): stm_asign( call(r0)( identifier(r0)(put_int) ( identifier(r0)(a))))
54
+
55
+ ```
56
+
37
57
  引数が9個のプログラム
38
58
  ```C
39
59
  sum(int a, int b, int c, int d, int e, int f,int g,int h,int i)

5

内容の充実化

2021/06/06 06:02

投稿

grape_ll
grape_ll

スコア83

title CHANGED
File without changes
body CHANGED
@@ -109,4 +109,34 @@
109
109
  56 .size main, .-main
110
110
  57 .ident "GCC: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0"
111
111
  58 .section .note.GNU-stack,"",@progbits
112
+ ```
113
+
114
+ これのtlcによる実行
115
+ ```ここに言語を入力
116
+ FuncTab
117
+ sum #1
118
+ main #2
119
+
120
+ SymTab
121
+ id(1)
122
+ a #1, offset(-12)
123
+ b #2, offset(-16)
124
+ c #3, offset(-20)
125
+ d #4, offset(-24)
126
+ e #5, offset(-28)
127
+ f #6, offset(-32)
128
+ g #7, offset(-36)
129
+ h #8, offset(-40)
130
+ i #9, offset(-8)
131
+ id(2)
132
+ a #1, offset(-4)
133
+ root
134
+ 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)))
135
+ 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)))
136
+
137
+ func[ identifier(r0)(main)] ()
138
+ l(8): declaration( identifier(r0)(a))
139
+ 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)))))
140
+ l(10): stm_asign( call(r0)( identifier(r0)(put_int) ( identifier(r0)(a))))
141
+
112
142
  ```

4

内容の充実化

2021/06/06 05:59

投稿

grape_ll
grape_ll

スコア83

title CHANGED
File without changes
body CHANGED
@@ -28,4 +28,85 @@
28
28
  ```
29
29
 
30
30
  ###アセンブリ
31
- ![イメージ説明](d6f9cb93cf4f9751c1e023232ad8dbe9.png)
31
+ ![イメージ説明](d6f9cb93cf4f9751c1e023232ad8dbe9.png)
32
+
33
+ ###追記
34
+ tlcの実行結果
35
+ ![イメージ説明](8eec0f5de13caceb0e406c81b30a1c18.png)
36
+
37
+ 引数が9個のプログラム
38
+ ```C
39
+ sum(int a, int b, int c, int d, int e, int f,int g,int h,int i)
40
+ {
41
+ return a+b+c+d+e+f+g+h+i;
42
+ }
43
+
44
+ main()
45
+ {
46
+ int a;
47
+ a= sum(1, 2,3,4,5,6,7,8,9);
48
+ put_int(a);
49
+ }
50
+
51
+ ```
52
+
53
+ ```ここに言語を入力
54
+ 1 .arch armv8-a
55
+ 2 .file "nine_var.c"
56
+ 3 .text
57
+ 4 .align 2
58
+ 5 .global sum
59
+ 6 .type sum, %function
60
+ 7 sum:
61
+ 8 .LFB0:
62
+ 9 .cfi_startproc
63
+ 10 add w0, w0, w1
64
+ 11 add w0, w0, w2
65
+ 12 add w0, w0, w3
66
+ 13 add w0, w0, w4
67
+ 14 add w0, w0, w5
68
+ 15 add w0, w0, w6
69
+ 16 add w0, w0, w7
70
+ 17 ldr w1, [sp]
71
+ 18 add w0, w0, w1
72
+ 19 ret
73
+ 20 .cfi_endproc
74
+ 21 .LFE0:
75
+ 22 .size sum, .-sum
76
+ 23 .align 2
77
+ 24 .global main
78
+ 25 .type main, %function
79
+ 26 main:
80
+ 27 .LFB1:
81
+ 28 .cfi_startproc
82
+ 29 sub sp, sp, #32
83
+ 30 .cfi_def_cfa_offset 32
84
+ 31 stp x29, x30, [sp, 16]
85
+ 32 .cfi_offset 29, -16
86
+ 33 .cfi_offset 30, -8
87
+ 34 add x29, sp, 16
88
+ 35 mov w0, 9
89
+ 36 str w0, [sp]
90
+ 37 mov w7, 8
91
+ 38 mov w6, 7
92
+ 39 mov w5, 6
93
+ 40 mov w4, 5
94
+ 41 mov w3, 4
95
+ 42 mov w2, 3
96
+ 43 mov w1, 2
97
+ 44 mov w0, 1
98
+ 45 bl sum
99
+ 46 bl put_int
100
+ 47 mov w0, 0
101
+ 48 ldp x29, x30, [sp, 16]
102
+ 49 add sp, sp, 32
103
+ 50 .cfi_restore 29
104
+ 51 .cfi_restore 30
105
+ 52 .cfi_def_cfa_offset 0
106
+ 53 ret
107
+ 54 .cfi_endproc
108
+ 55 .LFE1:
109
+ 56 .size main, .-main
110
+ 57 .ident "GCC: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0"
111
+ 58 .section .note.GNU-stack,"",@progbits
112
+ ```

3

情報が足りなかった

2021/06/06 05:57

投稿

grape_ll
grape_ll

スコア83

title CHANGED
File without changes
body CHANGED
@@ -28,49 +28,4 @@
28
28
  ```
29
29
 
30
30
  ###アセンブリ
31
- ```アセンブリ
32
- .file "test22.c"
33
- .text
34
- .globl _sum
35
- .def _sum; .scl 2; .type 32; .endef
36
- _sum:
37
- LFB0:
38
- .cfi_startproc
39
- movl 8(%esp), %eax
40
- addl 4(%esp), %eax
41
- ret
42
- .cfi_endproc
43
- LFE0:
44
- .def ___main; .scl 2; .type 32; .endef
45
- .globl _main
46
- .def _main; .scl 2; .type 32; .endef
47
- _main:
48
- LFB1:
49
- .cfi_startproc
50
- pushl %ebp
51
- .cfi_def_cfa_offset 8
52
- .cfi_offset 5, -8
53
- movl %esp, %ebp
54
- .cfi_def_cfa_register 5
55
- andl $-16, %esp
56
- subl $16, %esp
57
- call ___main
58
- movl $2, 4(%esp)
59
- movl $1, (%esp)
60
- call _sum
61
- movl %eax, (%esp)
62
- call _put_int
63
- movl $0, %eax
64
- leave
65
- .cfi_restore 5
66
- .cfi_def_cfa 4, 4
67
- ret
68
- .cfi_endproc
69
- LFE1:
70
- .ident "GCC: (MinGW.org GCC-6.3.0-1) 6.3.0"
71
- .def _put_int; .scl 2; .type 32; .endef
31
+ ![イメージ説明](d6f9cb93cf4f9751c1e023232ad8dbe9.png)
72
-
73
- ```
74
-
75
-
76
- ```

2

情報が足りなかった

2021/06/05 13:00

投稿

grape_ll
grape_ll

スコア83

title CHANGED
File without changes
body CHANGED
@@ -73,47 +73,4 @@
73
73
  ```
74
74
 
75
75
 
76
- ###アセンブリ
77
- ```
78
- .file "test22.c"
79
- .text
80
- .globl _sum
81
- .def _sum; .scl 2; .type 32; .endef
82
- _sum:
83
- LFB0:
84
- .cfi_startproc
85
- movl 8(%esp), %eax
86
- addl 4(%esp), %eax
87
- ret
88
- .cfi_endproc
89
- LFE0:
90
- .def ___main; .scl 2; .type 32; .endef
91
- .globl _main
92
- .def _main; .scl 2; .type 32; .endef
93
- _main:
94
- LFB1:
95
- .cfi_startprコードoc
96
- pushl %ebp
97
- .cfi_def_cfa_offset 8
98
- .cfi_offset 5, -8
99
- movl %esp, %ebp
100
- .cfi_def_cfa_register 5
101
- andl $-16, %esp
102
- subl $16, %esp
103
- call ___main
104
- movl $2, 4(%esp)
105
- movl $1, (%esp)
106
- call _sum
107
- movl %eax, (%esp)
108
- call _put_int
109
- movl $0, %eax
110
- leave
111
- .cfi_restore 5
112
- .cfi_def_cfa 4, 4
113
- ret
114
- .cfi_endproc
115
- LFE1:
116
- .ident "GCC: (MinGW.org GCC-6.3.0-1) 6.3.0"
117
- .def _put_int; .scl 2; .type 32; .endef
118
-
119
76
  ```

1

内容の充実化

2021/06/05 12:26

投稿

grape_ll
grape_ll

スコア83

title CHANGED
File without changes
body CHANGED
@@ -71,10 +71,10 @@
71
71
  .def _put_int; .scl 2; .type 32; .endef
72
72
 
73
73
  ```
74
- ```
75
74
 
75
+
76
76
  ###アセンブリ
77
- ```アセンブリ
77
+ ```
78
78
  .file "test22.c"
79
79
  .text
80
80
  .globl _sum