summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-01-26 07:08:18 +0000
committerbors <bors@rust-lang.org>2019-01-26 07:08:18 +0000
commit42eb5ff4042236ec3635035332e059afa7d63f9d (patch)
tree2add28d90e48f64c036bf3dd0b37f454979e44e2 /src/rustllvm/RustWrapper.cpp
parent9df043b543bb9bc3e50bc243811c58d52a3aefea (diff)
parentce289c6c9911c7ea55b7f30b125d3c38ed359da4 (diff)
downloadrust-42eb5ff4042236ec3635035332e059afa7d63f9d.tar.gz
rust-42eb5ff4042236ec3635035332e059afa7d63f9d.zip
Auto merge of #55641 - nagisa:optimize-attr, r=pnkfelix
Implement optimize(size) and optimize(speed) attributes

This PR implements both `optimize(size)` and `optimize(speed)` attributes.

While the functionality itself works fine now, this PR is not yet complete: the code might be messy in places and, most importantly, the compiletest must be improved with functionality to run tests with custom optimization levels. Otherwise the new attribute cannot be tested properly. Oh, and not all of the RFC is implemented – attribute propagation is not implemented for example.

# TODO

* [x] Improve compiletest so that tests can be written;
* [x] Assign a proper error number (E9999 currently, no idea how to allocate a number properly);
* [ ] Perhaps reduce the duplication in LLVM attribute assignment code…
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index e973318057c..b33165b8463 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -188,6 +188,8 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
     return Attribute::SanitizeMemory;
   case NonLazyBind:
     return Attribute::NonLazyBind;
+  case OptimizeNone:
+    return Attribute::OptimizeNone;
   }
   report_fatal_error("bad AttributeKind");
 }