Skip to content

Commit

Permalink
[AArch64] Add Tiny Code Model for AArch64
Browse files Browse the repository at this point in the history
Adds a tiny code model to Clang along side rL340397.

Differential Revision: https://reviews.llvm.org/D49674


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340398 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
davemgreen committed Aug 22, 2018
1 parent ff09bf0 commit 58b109b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/clang/Driver/CC1Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def new_struct_path_tbaa : Flag<["-"], "new-struct-path-tbaa">,
def masm_verbose : Flag<["-"], "masm-verbose">,
HelpText<"Generate verbose assembly output">;
def mcode_model : Separate<["-"], "mcode-model">,
HelpText<"The code model to use">, Values<"small,kernel,medium,large">;
HelpText<"The code model to use">, Values<"tiny,small,kernel,medium,large">;
def mdebug_pass : Separate<["-"], "mdebug-pass">,
HelpText<"Enable additional debug output">;
def mdisable_fp_elim : Flag<["-"], "mdisable-fp-elim">,
Expand Down
1 change: 1 addition & 0 deletions lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ static CodeGenOpt::Level getCGOptLevel(const CodeGenOptions &CodeGenOpts) {
static Optional<llvm::CodeModel::Model>
getCodeModel(const CodeGenOptions &CodeGenOpts) {
unsigned CodeModel = llvm::StringSwitch<unsigned>(CodeGenOpts.CodeModel)
.Case("tiny", llvm::CodeModel::Tiny)
.Case("small", llvm::CodeModel::Small)
.Case("kernel", llvm::CodeModel::Kernel)
.Case("medium", llvm::CodeModel::Medium)
Expand Down
2 changes: 1 addition & 1 deletion lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static StringRef getCodeModel(ArgList &Args, DiagnosticsEngine &Diags) {
if (Arg *A = Args.getLastArg(OPT_mcode_model)) {
StringRef Value = A->getValue();
if (Value == "small" || Value == "kernel" || Value == "medium" ||
Value == "large")
Value == "large" || Value == "tiny")
return Value;
Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << Value;
}
Expand Down
2 changes: 2 additions & 0 deletions test/Driver/code-model.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// RUN: %clang -### -c -mcmodel=tiny %s 2>&1 | FileCheck -check-prefix CHECK-TINY %s
// RUN: %clang -### -c -mcmodel=small %s 2>&1 | FileCheck -check-prefix CHECK-SMALL %s
// RUN: %clang -### -S -mcmodel=kernel %s 2>&1 | FileCheck -check-prefix CHECK-KERNEL %s
// RUN: %clang -### -c -mcmodel=medium %s 2>&1 | FileCheck -check-prefix CHECK-MEDIUM %s
// RUN: %clang -### -S -mcmodel=large %s 2>&1 | FileCheck -check-prefix CHECK-LARGE %s
// RUN: not %clang -c -mcmodel=lager %s 2>&1 | FileCheck -check-prefix CHECK-INVALID %s

// CHECK-TINY: "-mcode-model" "tiny"
// CHECK-SMALL: "-mcode-model" "small"
// CHECK-KERNEL: "-mcode-model" "kernel"
// CHECK-MEDIUM: "-mcode-model" "medium"
Expand Down

0 comments on commit 58b109b

Please sign in to comment.