summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-01 04:13:31 +0000
committerChris Lattner <sabre@nondot.org>2009-07-01 04:13:31 +0000
commit96122debc194ee6a368512e1f8ca4e5c79628976 (patch)
tree084bfbf3573e973d6b7837a0b22203099a5cbe3e /llvm/lib
parent2857ccbaa7b1c755af1b392b13f0636fb0326a24 (diff)
downloadbcm5719-llvm-96122debc194ee6a368512e1f8ca4e5c79628976.tar.gz
bcm5719-llvm-96122debc194ee6a368512e1f8ca4e5c79628976.zip
improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least). Patch by Jay Foad! llvm-svn: 74584
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/DebugInfo.cpp2
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp2
-rw-r--r--llvm/lib/Debugger/ProgramInfo.cpp6
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp2
-rw-r--r--llvm/lib/Transforms/IPO/GlobalOpt.cpp3
-rw-r--r--llvm/lib/Transforms/IPO/RaiseAllocations.cpp9
-rw-r--r--llvm/lib/Transforms/Utils/LowerAllocations.cpp2
7 files changed, 10 insertions, 16 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp
index 6b27cf41624..dbc3ae8a978 100644
--- a/llvm/lib/Analysis/DebugInfo.cpp
+++ b/llvm/lib/Analysis/DebugInfo.cpp
@@ -327,7 +327,7 @@ bool DISubprogram::describes(const Function *F) {
DIFactory::DIFactory(Module &m)
: M(m), StopPointFn(0), FuncStartFn(0), RegionStartFn(0), RegionEndFn(0),
DeclareFn(0) {
- EmptyStructPtr = PointerType::getUnqual(StructType::get(NULL, NULL));
+ EmptyStructPtr = PointerType::getUnqual(StructType::get());
}
/// getCastToEmpty - Return this descriptor as a Constant* with type '{}*'.
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 909370cb669..83ed401ef4b 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -1244,7 +1244,7 @@ bool LLParser::ParseStructType(PATypeHolder &Result, bool Packed) {
Lex.Lex(); // Consume the '{'
if (EatIfPresent(lltok::rbrace)) {
- Result = StructType::get(std::vector<const Type*>(), Packed);
+ Result = StructType::get(Packed);
return false;
}
diff --git a/llvm/lib/Debugger/ProgramInfo.cpp b/llvm/lib/Debugger/ProgramInfo.cpp
index 125ff556dd5..e58b3d58e6d 100644
--- a/llvm/lib/Debugger/ProgramInfo.cpp
+++ b/llvm/lib/Debugger/ProgramInfo.cpp
@@ -271,8 +271,7 @@ ProgramInfo::getSourceFiles(bool RequiresCompleteMap) {
// should be on the use list of the llvm.dbg.translation_units global.
//
GlobalVariable *Units =
- M->getGlobalVariable("llvm.dbg.translation_units",
- StructType::get(std::vector<const Type*>()));
+ M->getGlobalVariable("llvm.dbg.translation_units", StructType::get());
if (Units == 0)
throw "Program contains no debugging information!";
@@ -354,8 +353,7 @@ ProgramInfo::getSourceFunctions(bool RequiresCompleteMap) {
// should be on the use list of the llvm.dbg.translation_units global.
//
GlobalVariable *Units =
- M->getGlobalVariable("llvm.dbg.globals",
- StructType::get(std::vector<const Type*>()));
+ M->getGlobalVariable("llvm.dbg.globals", StructType::get());
if (Units == 0)
throw "Program contains no debugging information!";
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index db5a306badc..1d8312f7629 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -453,7 +453,7 @@ GenericValue JIT::runFunction(Function *F,
// arguments. Make this function and return.
// First, create the function.
- FunctionType *STy=FunctionType::get(RetTy, std::vector<const Type*>(), false);
+ FunctionType *STy=FunctionType::get(RetTy, false);
Function *Stub = Function::Create(STy, Function::InternalLinkage, "",
F->getParent());
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index cbf3a1d827a..7fe097c7c57 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -1928,8 +1928,7 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL,
if (Ctors[i]) {
CSVals[1] = Ctors[i];
} else {
- const Type *FTy = FunctionType::get(Type::VoidTy,
- std::vector<const Type*>(), false);
+ const Type *FTy = FunctionType::get(Type::VoidTy, false);
const PointerType *PFTy = PointerType::getUnqual(FTy);
CSVals[1] = Constant::getNullValue(PFTy);
CSVals[0] = ConstantInt::get(Type::Int32Ty, 2147483647);
diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
index 8c97b5d17c0..99003689fb1 100644
--- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -92,8 +92,7 @@ void RaiseAllocations::doInitialization(Module &M) {
// i8*(...) * malloc
// This handles the common declaration of: 'void *malloc();'
const FunctionType *Malloc3Type =
- FunctionType::get(PointerType::getUnqual(Type::Int8Ty),
- std::vector<const Type*>(), true);
+ FunctionType::get(PointerType::getUnqual(Type::Int8Ty), true);
if (TyWeHave != Malloc3Type)
// Give up
MallocFunc = 0;
@@ -113,14 +112,12 @@ void RaiseAllocations::doInitialization(Module &M) {
// Check to see if the prototype was forgotten, giving us
// void (...) * free
// This handles the common forward declaration of: 'void free();'
- const FunctionType* Free2Type = FunctionType::get(Type::VoidTy,
- std::vector<const Type*>(),true);
+ const FunctionType* Free2Type = FunctionType::get(Type::VoidTy, true);
if (TyWeHave != Free2Type) {
// One last try, check to see if we can find free as
// int (...)* free. This handles the case where NOTHING was declared.
- const FunctionType* Free3Type = FunctionType::get(Type::Int32Ty,
- std::vector<const Type*>(),true);
+ const FunctionType* Free3Type = FunctionType::get(Type::Int32Ty, true);
if (TyWeHave != Free3Type) {
// Give up.
diff --git a/llvm/lib/Transforms/Utils/LowerAllocations.cpp b/llvm/lib/Transforms/Utils/LowerAllocations.cpp
index 9af47f56ef3..74e7028d127 100644
--- a/llvm/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/llvm/lib/Transforms/Utils/LowerAllocations.cpp
@@ -89,7 +89,7 @@ bool LowerAllocations::doInitialization(Module &M) {
const Type *BPTy = PointerType::getUnqual(Type::Int8Ty);
// Prototype malloc as "char* malloc(...)", because we don't know in
// doInitialization whether size_t is int or long.
- FunctionType *FT = FunctionType::get(BPTy, std::vector<const Type*>(), true);
+ FunctionType *FT = FunctionType::get(BPTy, true);
MallocFunc = M.getOrInsertFunction("malloc", FT);
FreeFunc = M.getOrInsertFunction("free" , Type::VoidTy, BPTy, (Type *)0);
return true;
OpenPOWER on IntegriCloud