[llvm-commits] [llvm-gcc-4.2] r55718 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Devang Patel
dpatel at apple.com
Wed Sep 3 13:01:27 PDT 2008
Author: dpatel
Date: Wed Sep 3 15:01:27 2008
New Revision: 55718
URL: http://llvm.org/viewvc/llvm-project?rev=55718&view=rev
Log:
Use AlwaysInliner to handle always_inline functions, if regular inliner is not used.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=55718&r1=55717&r2=55718&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Sep 3 15:01:27 2008
@@ -388,6 +388,19 @@
PM->add(createPruneEHPass()); // Remove dead EH info
if (flag_inline_trees > 1) // respect -fno-inline-functions
PM->add(createFunctionInliningPass()); // Inline small functions
+ else {
+ // The inliner pass won't be inserted based on command line options.
+ // Use AlwaysInliner to handle functions that are marked as always_inline.
+ bool NeedAlwaysInliner = false;
+ for (Module::iterator I = TheModule->begin(), E = TheModule->end();
+ I != E; ++I)
+ if (!I->isDeclaration() && I->getNotes() == FN_NOTE_AlwaysInline) {
+ NeedAlwaysInliner = true;
+ break;
+ }
+ if (NeedAlwaysInliner)
+ PM->add(createAlwaysInlinerPass());
+ }
if (optimize > 2)
PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args
if (!flag_no_simplify_libcalls)
@@ -431,7 +444,7 @@
if (optimize > 1 && flag_unit_at_a_time)
PM->add(createConstantMergePass()); // Merge dup global constants
}
-
+
if (emit_llvm_bc) {
// Emit an LLVM .bc file to the output. This is used when passed
// -emit-llvm -c to the GCC driver.
More information about the llvm-commits
mailing list