Skip to content

Commit 2a03133

Browse files
authored
Add LLVM::CodeModel::Tiny (#15608)
This member has been present since LLVM 8 for AArch64, which means every non-default setting was previously off by one in Crystal.
1 parent 24f5c02 commit 2a03133

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

doc/man/crystal-build.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ whether SIMD operations are enabled or not. The default set of
6161
attributes is set by the current CPU. This will pass a -mattr
6262
flag to LLVM, and is only intended to be used for cross-compilation. For a list of available attributes, invoke "llvm-as <
6363
/dev/null | llc -march=xyz -mattr=help".
64-
*--mcmodel* default|kernel|small|medium|large::
64+
*--mcmodel* default|kernel|tiny|small|medium|large::
6565
Specifies a specific code model to generate code for. This will
6666
pass a --code-model flag to LLVM.
6767
*--no-color*::

man/crystal.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ flag to LLVM, and is only intended to be used for cross\-compilation. For a list
212212
/dev/null | llc \-march=xyz \-mattr=help".
213213
.RE
214214
.sp
215-
\fB\-\-mcmodel\fP default|kernel|small|medium|large
215+
\fB\-\-mcmodel\fP default|kernel|tiny|small|medium|large
216216
.RS 4
217217
Specifies a specific code model to generate code for. This will
218218
pass a \-\-code\-model flag to LLVM.

src/compiler/crystal/command.cr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,13 @@ class Crystal::Command
707707
opts.on("--mcmodel MODEL", "Target specific code model") do |mcmodel|
708708
compiler.mcmodel = case mcmodel
709709
when "default" then LLVM::CodeModel::Default
710+
when "tiny" then LLVM::CodeModel::Tiny
710711
when "small" then LLVM::CodeModel::Small
711712
when "kernel" then LLVM::CodeModel::Kernel
712713
when "medium" then LLVM::CodeModel::Medium
713714
when "large" then LLVM::CodeModel::Large
714715
else
715-
error "--mcmodel should be one of: default, kernel, small, medium, large"
716+
error "--mcmodel should be one of: default, kernel, tiny, small, medium, large"
716717
raise "unreachable"
717718
end
718719
end

src/llvm/enums.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ module LLVM
292292
enum CodeModel
293293
Default
294294
JITDefault
295+
Tiny
295296
Small
296297
Kernel
297298
Medium

0 commit comments

Comments
 (0)