Skip to content

Commit b435055

Browse files
author
Matt Godbolt
committed
Checkpoint
1 parent 51e403b commit b435055

File tree

3 files changed

+109
-3
lines changed

3 files changed

+109
-3
lines changed

abstract-etc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Matt Godbolt is a software engineer with trading firm DRW. He is passionate abou
55

66
Title
77
-----
8-
What has my compiler done for me lately?
8+
Unbolting the Lid of your Compiler
99

1010
Tags
1111
----

ce.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
watch 'g++ -O2 -S /tmp/test.cc -o - | c++filt'

index.html

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
<link rel="stylesheet" href="reveal.js/css/reveal.css">
1010
<link rel="stylesheet" href="drw.css">
1111

12+
<style>
13+
td.reg {
14+
background-color: #333;
15+
text-align: center !important
16+
}
17+
</style>
18+
1219
<!-- Theme used for syntax highlighting of code -->
1320
<link rel="stylesheet" href="reveal.js/lib/css/zenburn.css">
1421

@@ -36,8 +43,103 @@ <h1>Compiler Explorer</h1>
3643
<br>
3744
<em><a href="https://drw.com/">drw.com</a></em>
3845
</section>
39-
<section>Slide 1</section>
40-
<section>Slide 2</section>
46+
<section>
47+
<h3>Backstory</h3>
48+
<pre><code data-trim class="cpp">
49+
void foreach(const vector&lt;int> &v) {
50+
for (size_t i = 0; i < v.size(); ++i)
51+
doSomething(v[i]);
52+
}</code></pre>
53+
<pre><code data-trim class="cpp">
54+
void foreach(const vector&lt;int> &v) {
55+
for (int x : v)
56+
doSomething(x);
57+
}</code></pre>
58+
</section>
59+
<section>
60+
<h3>Compiler Explorer v1</h3>
61+
<pre><code class="bash">$ watch 'g++ -O2 -S /tmp/test.cc -o - | c++filt'</code></pre>
62+
<a href="http://localhost:10240/#z:OYLghAFBqd5TKALEBjA9gEwKYFFMCWALugE4A0BIEAZugHZ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assembly</h3>
67+
<iframe width="1000px" height="300px"
68+
src="http://localhost:10240/e#g:!((g:!((g:!((h:codeEditor,i:(fontScale:1.5479341055999998,j:1,source:'int+square(int+num)+%7B%0A++++return+num+*+num%3B%0A%7D'),l:'5',n:'0',o:'C%2B%2B+source+%231',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:/usr/bin/g%2B%2B,filters:(b:'0',commentOnly:'0',directives:'0',intel:'0'),fontScale:1.5479341055999998,options:'',source:1),l:'5',n:'0',o:'/usr/bin/g%2B%2B+(Editor+%231,+Compiler+%231)',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4"></iframe>
69+
</section>
70+
<section>
71+
<h3>Intel asm 101</h3>
72+
<pre><code data-trim class="asm">
73+
mov dest, src
74+
add dest, arg
75+
cmp reg, arg
76+
jmp dest
77+
</code></pre>
78+
</section>
79+
<section>
80+
<h3>Intel registers</h3>
81+
<ul>
82+
<li>rax</li>
83+
<li>rcx</li>
84+
<li>rdx</li>
85+
<li>rbx</li>
86+
<li>rsp</li>
87+
<li>rbp</li>
88+
<li>rsi</li>
89+
<li>rdi</li>
90+
<li>r8-r15</li>
91+
</ul>
92+
</section>
93+
<section>
94+
<h3>Intel registers</h3>
95+
<table class="reg">
96+
<tr>
97+
<td colspan="8" class="reg">rax</td>
98+
</tr>
99+
<tr>
100+
<td colspan="4"></td>
101+
<td colspan="4" class="reg">eax</td>
102+
</tr>
103+
<tr>
104+
<td colspan="6"></td>
105+
<td colspan="2" class="reg">ax</td>
106+
</tr>
107+
<tr>
108+
<td colspan="6"></td>
109+
<td colspan="1" class="reg">ah</td>
110+
<td colspan="1" class="reg">al</td>
111+
</tr>
112+
<tr>
113+
<td>...</td>
114+
<td>...</td>
115+
<td>...</td>
116+
<td>...</td>
117+
<td>...</td>
118+
<td>...</td>
119+
<td>...</td>
120+
<td>...</td>
121+
</tr>
122+
</table>
123+
</section>
124+
<section>
125+
<h3>Intel registers</h3>
126+
<pre><code data-trim class="cpp">
127+
union {
128+
struct {
129+
uint8_t al;
130+
uint8_t ah;
131+
};
132+
uint16_t ax;
133+
uint32_t eax;
134+
uint64_t rax;
135+
};
136+
</code></pre>
137+
</section>
138+
<section>
139+
<h3>Cleverness</h3>
140+
<iframe width="1000px" height="300px"
141+
src="http://localhost:10240/e#g:!((g:!((g:!((h:codeEditor,i:(fontScale:1.2899450879999999,j:1,source:'int+times9(int+num)+%7B%0A++++return+num+*+9%3B%0A%7D'),l:'5',n:'0',o:'C%2B%2B+source+%231',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:/usr/bin/g%2B%2B,filters:(b:'0',commentOnly:'0',directives:'0',intel:'0'),fontScale:1.2899450879999999,options:'-O1',source:1),l:'5',n:'0',o:'/usr/bin/g%2B%2B+(Editor+%231,+Compiler+%231)',t:'0')),k:50,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4"></iframe>
142+
</section>
41143
<div class="footer">
42144
<hr>
43145
<img src="DRWSmallLogo.png" width="50" height="16">
@@ -51,6 +153,7 @@ <h1>Compiler Explorer</h1>
51153
<script>
52154
Reveal.initialize({
53155
transition: 'none',
156+
history: true,
54157
dependencies: [
55158
{src: 'reveal.js/plugin/markdown/marked.js'},
56159
{src: 'reveal.js/plugin/markdown/markdown.js'},

0 commit comments

Comments
 (0)