[llvm-commits] [127995] Handle noinline attribute in the frontend.
lattner at apple.com
lattner at apple.com
Mon Jun 4 16:22:06 PDT 2007
Revision: 127995
Author: lattner
Date: 2007-06-04 16:22:06 -0700 (Mon, 04 Jun 2007)
Log Message:
-----------
Handle noinline attribute in the frontend.
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-backend.cpp
apple-local/branches/llvm/gcc/llvm-convert.cpp
apple-local/branches/llvm/gcc/llvm-internal.h
Modified: apple-local/branches/llvm/gcc/llvm-backend.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-06-04 23:17:19 UTC (rev 127994)
+++ apple-local/branches/llvm/gcc/llvm-backend.cpp 2007-06-04 23:22:06 UTC (rev 127995)
@@ -80,6 +80,7 @@
std::vector<std::pair<Function*, int> > StaticCtors, StaticDtors;
std::vector<GlobalValue*> AttributeUsedGlobals;
+std::vector<Function*> AttributeNoinlineFunctions;
/// PerFunctionPasses - This is the list of cleanup passes run per-function
/// as each is compiled. In cases where we are not doing IPO, it includes the
@@ -477,6 +478,20 @@
"llvm.used", TheModule);
}
+ // Add llvm.noinline
+ if (!AttributeNoinlineFunctions.empty()) {
+ std::vector<Constant*> GlobalInit;
+ const Type *SBP= PointerType::get(Type::Int8Ty);
+ for (unsigned i = 0, e = AttributeNoinlineFunctions.size(); i != e; ++i)
+ GlobalInit.push_back(ConstantExpr::getBitCast(AttributeNoinlineFunctions[i],
+ SBP));
+ ArrayType *AT = ArrayType::get(SBP, AttributeNoinlineFunctions.size());
+ Constant *Init = ConstantArray::get(AT, GlobalInit);
+ GlobalValue *gv = new GlobalVariable(AT, false, GlobalValue::AppendingLinkage, Init,
+ "llvm.noinline", TheModule);
+ gv->setSection("llvm.metadata");
+ }
+
// Finish off the per-function pass.
if (PerFunctionPasses)
PerFunctionPasses->doFinalization();
Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-06-04 23:17:19 UTC (rev 127994)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-06-04 23:22:06 UTC (rev 127995)
@@ -592,6 +592,10 @@
if (DECL_PRESERVE_P (FnDecl))
AttributeUsedGlobals.push_back(Fn);
+ // Handle noinline Functions
+ if (DECL_UNINLINABLE (FnDecl))
+ AttributeNoinlineFunctions.push_back(Fn);
+
// Create a new basic block for the function.
Builder.SetInsertPoint(new BasicBlock("entry", Fn));
Modified: apple-local/branches/llvm/gcc/llvm-internal.h
===================================================================
--- apple-local/branches/llvm/gcc/llvm-internal.h 2007-06-04 23:17:19 UTC (rev 127994)
+++ apple-local/branches/llvm/gcc/llvm-internal.h 2007-06-04 23:22:06 UTC (rev 127995)
@@ -88,6 +88,9 @@
/// AttributeUsedGlobals - The list of globals that are marked attribute(used).
extern std::vector<GlobalValue*> AttributeUsedGlobals;
+/// AttributeNoinlineFunctions - The list of functions that are marked attribute(noinline)
+extern std::vector<Function*> AttributeNoinlineFunctions;
+
void changeLLVMValue(Value *Old, Value *New);
void readLLVMTypesStringTable();
void writeLLVMTypesStringTable();
More information about the llvm-commits
mailing list