aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AsmParser/llvmAsmParser.y162
-rw-r--r--lib/Bytecode/Reader/Reader.cpp8
-rw-r--r--lib/Bytecode/Writer/Writer.cpp16
-rw-r--r--lib/CodeGen/InstrSelection/InstrForest.cpp12
-rw-r--r--lib/Linker/LinkModules.cpp84
-rw-r--r--lib/Target/SparcV9/InstrSelection/InstrForest.cpp12
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp2
-rw-r--r--lib/Transforms/IPO/MutateStructTypes.cpp10
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp77
-rw-r--r--lib/Transforms/Scalar/DCE.cpp28
-rw-r--r--lib/Transforms/Scalar/InductionVars.cpp12
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp26
-rw-r--r--lib/Transforms/Utils/Linker.cpp84
-rw-r--r--lib/Transforms/Utils/LowerAllocations.cpp45
-rw-r--r--lib/VMCore/AsmWriter.cpp56
-rw-r--r--lib/VMCore/Function.cpp16
-rw-r--r--lib/VMCore/InstrTypes.cpp8
-rw-r--r--lib/VMCore/Linker.cpp84
-rw-r--r--lib/VMCore/Module.cpp18
-rw-r--r--lib/VMCore/Pass.cpp22
-rw-r--r--lib/VMCore/SymbolTable.cpp8
21 files changed, 397 insertions, 393 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index c317ff3220..5692bf48e2 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -10,7 +10,7 @@
#include "llvm/SymbolTable.h"
#include "llvm/Module.h"
#include "llvm/GlobalVariable.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include "llvm/DerivedTypes.h"
#include "llvm/iTerminators.h"
@@ -135,8 +135,8 @@ static struct PerModuleInfo {
} CurModule;
-static struct PerMethodInfo {
- Method *CurrentMethod; // Pointer to current method being created
+static struct PerFunctionInfo {
+ Function *CurrentFunction; // Pointer to current method being created
vector<ValueList> Values; // Keep track of numbered definitions
vector<ValueList> LateResolveValues;
@@ -144,30 +144,30 @@ static struct PerMethodInfo {
map<ValID, PATypeHolder<Type> > LateResolveTypes;
bool isDeclare; // Is this method a forward declararation?
- inline PerMethodInfo() {
- CurrentMethod = 0;
+ inline PerFunctionInfo() {
+ CurrentFunction = 0;
isDeclare = false;
}
- inline ~PerMethodInfo() {}
+ inline ~PerFunctionInfo() {}
- inline void MethodStart(Method *M) {
- CurrentMethod = M;
+ inline void FunctionStart(Function *M) {
+ CurrentFunction = M;
}
- void MethodDone() {
+ void FunctionDone() {
// If we could not resolve some blocks at parsing time (forward branches)
// resolve the branches now...
ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues);
Values.clear(); // Clear out method local definitions
Types.clear();
- CurrentMethod = 0;
+ CurrentFunction = 0;
isDeclare = false;
}
} CurMeth; // Info for the current method...
-static bool inMethodScope() { return CurMeth.CurrentMethod != 0; }
+static bool inFunctionScope() { return CurMeth.CurrentFunction != 0; }
//===----------------------------------------------------------------------===//
@@ -210,7 +210,7 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
case 1: { // Is it a named definition?
string Name(D.Name);
SymbolTable *SymTab = 0;
- if (inMethodScope()) SymTab = CurMeth.CurrentMethod->getSymbolTable();
+ if (inFunctionScope()) SymTab = CurMeth.CurrentFunction->getSymbolTable();
Value *N = SymTab ? SymTab->lookup(Type::TypeTy, Name) : 0;
if (N == 0) {
@@ -236,7 +236,7 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
//
if (DoNotImprovise) return 0; // Do we just want a null to be returned?
- map<ValID, PATypeHolder<Type> > &LateResolver = inMethodScope() ?
+ map<ValID, PATypeHolder<Type> > &LateResolver = inFunctionScope() ?
CurMeth.LateResolveTypes : CurModule.LateResolveTypes;
map<ValID, PATypeHolder<Type> >::iterator I = LateResolver.find(D);
@@ -251,7 +251,7 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) {
static Value *lookupInSymbolTable(const Type *Ty, const string &Name) {
SymbolTable *SymTab =
- inMethodScope() ? CurMeth.CurrentMethod->getSymbolTable() : 0;
+ inFunctionScope() ? CurMeth.CurrentFunction->getSymbolTable() : 0;
Value *N = SymTab ? SymTab->lookup(Ty, Name) : 0;
if (N == 0) {
@@ -271,8 +271,9 @@ static Value *lookupInSymbolTable(const Type *Ty, const string &Name) {
// it. Otherwise return null.
//
static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
- if (isa<MethodType>(Ty))
- ThrowException("Methods are not values and must be referenced as pointers");
+ if (isa<FunctionType>(Ty))
+ ThrowException("Functions are not values and "
+ "must be referenced as pointers");
switch (D.Type) {
case ValID::NumberVal: { // Is it a numbered definition?
@@ -377,7 +378,7 @@ static Value *getVal(const Type *Ty, const ValID &D) {
}
assert(d != 0 && "How did we not make something?");
- if (inMethodScope())
+ if (inFunctionScope())
InsertValue(d, CurMeth.LateResolveValues);
else
InsertValue(d, CurModule.LateResolveValues);
@@ -417,7 +418,7 @@ static void ResolveDefinitions(vector<ValueList> &LateResolvers,
V->replaceAllUsesWith(TheRealValue);
delete V;
} else if (FutureLateResolvers) {
- // Methods have their unresolved items forwarded to the module late
+ // Functions have their unresolved items forwarded to the module late
// resolver table
InsertValue(V, *FutureLateResolvers);
} else {
@@ -442,14 +443,14 @@ static void ResolveDefinitions(vector<ValueList> &LateResolvers,
// refering to the number can be resolved. Do this now.
//
static void ResolveTypeTo(char *Name, const Type *ToTy) {
- vector<PATypeHolder<Type> > &Types = inMethodScope() ?
+ vector<PATypeHolder<Type> > &Types = inFunctionScope() ?
CurMeth.Types : CurModule.Types;
ValID D;
if (Name) D = ValID::create(Name);
else D = ValID::create((int)Types.size());
- map<ValID, PATypeHolder<Type> > &LateResolver = inMethodScope() ?
+ map<ValID, PATypeHolder<Type> > &LateResolver = inFunctionScope() ?
CurMeth.LateResolveTypes : CurModule.LateResolveTypes;
map<ValID, PATypeHolder<Type> >::iterator I = LateResolver.find(D);
@@ -492,8 +493,8 @@ static bool setValueName(Value *V, char *NameStr) {
ThrowException("Can't assign name '" + Name +
"' to a null valued instruction!");
- SymbolTable *ST = inMethodScope() ?
- CurMeth.CurrentMethod->getSymbolTableSure() :
+ SymbolTable *ST = inFunctionScope() ?
+ CurMeth.CurrentFunction->getSymbolTableSure() :
CurModule.CurrentModule->getSymbolTableSure();
Value *Existing = ST->lookup(V->getType(), Name);
@@ -626,8 +627,8 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) {
%union {
Module *ModuleVal;
- Method *MethodVal;
- std::pair<MethodArgument*,char*> *MethArgVal;
+ Function *FunctionVal;
+ std::pair<FunctionArgument*,char*> *MethArgVal;
BasicBlock *BasicBlockVal;
TerminatorInst *TermInstVal;
Instruction *InstVal;
@@ -637,7 +638,7 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) {
PATypeHolder<Type> *TypeVal;
Value *ValueVal;
- std::list<std::pair<MethodArgument*,char*> > *MethodArgList;
+ std::list<std::pair<FunctionArgument*,char*> > *FunctionArgList;
std::vector<Value*> *ValueList;
std::list<PATypeHolder<Type> > *TypeList;
std::list<std::pair<Value*,
@@ -662,14 +663,14 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) {
Instruction::OtherOps OtherOpVal;
}
-%type <ModuleVal> Module MethodList
-%type <MethodVal> Method MethodProto MethodHeader BasicBlockList
+%type <ModuleVal> Module FunctionList
+%type <FunctionVal> Function FunctionProto FunctionHeader BasicBlockList
%type <BasicBlockVal> BasicBlock InstructionList
%type <TermInstVal> BBTerminatorInst
%type <InstVal> Inst InstVal MemoryInst
%type <ConstVal> ConstVal
%type <ConstVector> ConstVector
-%type <MethodArgList> ArgList ArgListH
+%type <FunctionArgList> ArgList ArgListH
%type <MethArgVal> ArgVal
%type <PHIList> PHIList
%type <ValueList> ValueRefList ValueRefListE // For call param lists
@@ -807,14 +808,14 @@ UpRTypes : '\\' EUINT64VAL { // Type UpReference
$$ = newTH<Type>(OT);
UR_OUT("New Upreference!\n");
}
- | UpRTypesV '(' ArgTypeListI ')' { // Method derived type?
+ | UpRTypesV '(' ArgTypeListI ')' { // Function derived type?
vector<const Type*> Params;
mapto($3->begin(), $3->end(), std::back_inserter(Params),
std::mem_fun_ref(&PATypeHandle<Type>::get));
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
if (isVarArg) Params.pop_back();
- $$ = newTH(HandleUpRefs(MethodType::get(*$1, Params, isVarArg)));
+ $$ = newTH(HandleUpRefs(FunctionType::get(*$1, Params, isVarArg)));
delete $3; // Delete the argument list
delete $1; // Delete the old type handle
}
@@ -1049,13 +1050,13 @@ ConstPool : ConstPool OptAssign CONST ConstVal {
// If this is not a redefinition of a type...
if (!$2) {
InsertType($4->get(),
- inMethodScope() ? CurMeth.Types : CurModule.Types);
+ inFunctionScope() ? CurMeth.Types : CurModule.Types);
}
}
delete $4;
}
- | ConstPool MethodProto { // Method prototypes can be in const pool
+ | ConstPool FunctionProto { // Function prototypes can be in const pool
}
| ConstPool OptAssign OptInternal GlobalType ConstVal {
const Type *Ty = $5->getType();
@@ -1105,20 +1106,20 @@ ConstPool : ConstPool OptAssign CONST ConstVal {
// Module rule: Capture the result of parsing the whole file into a result
// variable...
//
-Module : MethodList {
+Module : FunctionList {
$$ = ParserResult = $1;
CurModule.ModuleDone();
}
-// MethodList - A list of methods, preceeded by a constant pool.
+// FunctionList - A list of methods, preceeded by a constant pool.
//
-MethodList : MethodList Method {
+FunctionList : FunctionList Function {
$$ = $1;
- assert($2->getParent() == 0 && "Method already in module!");
- $1->getMethodList().push_back($2);
- CurMeth.MethodDone();
+ assert($2->getParent() == 0 && "Function already in module!");
+ $1->getFunctionList().push_back($2);
+ CurMeth.FunctionDone();
}
- | MethodList MethodProto {
+ | FunctionList FunctionProto {
$$ = $1;
}
| ConstPool IMPLEMENTATION {
@@ -1129,13 +1130,13 @@ MethodList : MethodList Method {
//===----------------------------------------------------------------------===//
-// Rules to match Method Headers
+// Rules to match Function Headers
//===----------------------------------------------------------------------===//
OptVAR_ID : VAR_ID | /*empty*/ { $$ = 0; }
ArgVal : Types OptVAR_ID {
- $$ = new pair<MethodArgument*,char*>(new MethodArgument(*$1), $2);
+ $$ = new pair<FunctionArgument*,char*>(new FunctionArgument(*$1), $2);
delete $1; // Delete the type handle..
}
@@ -1145,14 +1146,14 @@ ArgListH : ArgVal ',' ArgListH {
delete $1;
}
| ArgVal {
- $$ = new list<pair<MethodArgument*,char*> >();
+ $$ = new list<pair<FunctionArgument*,char*> >();
$$->push_front(*$1);
delete $1;
}
| DOTDOTDOT {
- $$ = new list<pair<MethodArgument*, char*> >();
- $$->push_front(pair<MethodArgument*,char*>(
- new MethodArgument(Type::VoidTy), 0));
+ $$ = new list<pair<FunctionArgument*, char*> >();
+ $$->push_front(pair<FunctionArgument*,char*>(
+ new FunctionArgument(Type::VoidTy), 0));
}
ArgList : ArgListH {
@@ -1162,54 +1163,55 @@ ArgList : ArgListH {
$$ = 0;
}
-MethodHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' {
+FunctionHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' {
UnEscapeLexed($3);
- string MethodName($3);
+ string FunctionName($3);
vector<const Type*> ParamTypeList;
if ($5)
- for (list<pair<MethodArgument*,char*> >::iterator I = $5->begin();
+ for (list<pair<FunctionArgument*,char*> >::iterator I = $5->begin();
I != $5->end(); ++I)
ParamTypeList.push_back(I->first->getType());
bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy;
if (isVarArg) ParamTypeList.pop_back();
- const MethodType *MT = MethodType::get(*$2, ParamTypeList, isVarArg);
+ const FunctionType *MT = FunctionType::get(*$2, ParamTypeList, isVarArg);
const PointerType *PMT = PointerType::get(MT);
delete $2;
- Method *M = 0;
+ Function *M = 0;
if (SymbolTable *ST = CurModule.CurrentModule->getSymbolTable()) {
- if (Value *V = ST->lookup(PMT, MethodName)) { // Method already in symtab?
- M = cast<Method>(V);
+ // Is the function already in symtab?
+ if (Value *V = ST->lookup(PMT, FunctionName)) {
+ M = cast<Function>(V);
// Yes it is. If this is the case, either we need to be a forward decl,
// or it needs to be.
if (!CurMeth.isDeclare && !M->isExternal())
- ThrowException("Redefinition of method '" + MethodName + "'!");
+ ThrowException("Redefinition of method '" + FunctionName + "'!");
// If we found a preexisting method prototype, remove it from the module,
// so that we don't get spurious conflicts with global & local variables.
//
- CurModule.CurrentModule->getMethodList().remove(M);
+ CurModule.CurrentModule->getFunctionList().remove(M);
}
}
if (M == 0) { // Not already defined?
- M = new Method(MT, $1, MethodName);
+ M = new Function(MT, $1, FunctionName);
InsertValue(M, CurModule.Values);
CurModule.DeclareNewGlobalValue(M, ValID::create($3));
}
free($3); // Free strdup'd memory!
- CurMeth.MethodStart(M);
+ CurMeth.FunctionStart(M);
// Add all of the arguments we parsed to the method...
if ($5 && !CurMeth.isDeclare) { // Is null if empty...
- Method::ArgumentListType &ArgList = M->getArgumentList();
+ Function::ArgumentListType &ArgList = M->getArgumentList();
- for (list<pair<MethodArgument*, char*> >::iterator I = $5->begin();
+ for (list<pair<FunctionArgument*, char*> >::iterator I = $5->begin();
I != $5->end(); ++I) {
if (setValueName(I->first, I->second)) { // Insert into symtab...
assert(0 && "No arg redef allowed!");
@@ -1221,29 +1223,29 @@ MethodHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' {
delete $5; // We're now done with the argument list
} else if ($5) {
// If we are a declaration, we should free the memory for the argument list!
- for (list<pair<MethodArgument*, char*> >::iterator I = $5->begin();
+ for (list<pair<FunctionArgument*, char*> >::iterator I = $5->begin();
I != $5->end(); ++I)
if (I->second) free(I->second); // Free the memory for the name...
delete $5; // Free the memory for the list itself
}
}
-MethodHeader : MethodHeaderH ConstPool BEGINTOK {
- $$ = CurMeth.CurrentMethod;
+FunctionHeader : FunctionHeaderH ConstPool BEGINTOK {
+ $$ = CurMeth.CurrentFunction;
// Resolve circular types before we parse the body of the method.
ResolveTypes(CurMeth.LateResolveTypes);
}
-Method : BasicBlockList END {
+Function : BasicBlockList END {
$$ = $1;
}
-MethodProto : DECLARE { CurMeth.isDeclare = true; } MethodHeaderH {
- $$ = CurMeth.CurrentMethod;
- assert($$->getParent() == 0 && "Method already in module!");
- CurModule.CurrentModule->getMethodList().push_back($$);
- CurMeth.MethodDone();
+FunctionProto : DECLARE { CurMeth.isDeclare = true; } FunctionHeaderH {
+ $$ = CurMeth.CurrentFunction;
+ assert($$->getParent() == 0 && "Function already in module!");
+ CurModule.CurrentModule->getFunctionList().push_back($$);
+ CurMeth.FunctionDone();
}
//===----------------------------------------------------------------------===//
@@ -1300,7 +1302,7 @@ ResolvedVal : Types ValueRef {
BasicBlockList : BasicBlockList BasicBlock {
($$ = $1)->getBasicBlocks().push_back($2);
}
- | MethodHeader BasicBlock { // Do not allow methods with 0 basic blocks
+ | FunctionHeader BasicBlock { // Do not allow methods with 0 basic blocks
($$ = $1)->getBasicBlocks().push_back($2);
}
@@ -1362,10 +1364,10 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
| INVOKE TypesV ValueRef '(' ValueRefListE ')' TO ResolvedVal
EXCEPT ResolvedVal {
const PointerType *PMTy;
- const MethodType *Ty;
+ const FunctionType *Ty;
if (!(PMTy = dyn_cast<PointerType>($2->get())) ||
- !(Ty = dyn_cast<MethodType>(PMTy->getElementType()))) {
+ !(Ty = dyn_cast<FunctionType>(PMTy->getElementType()))) {
// Pull out the types of all of the arguments...
vector<const Type*> ParamTypes;
if ($5) {
@@ -1376,7 +1378,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
if (isVarArg) ParamTypes.pop_back();
- Ty = MethodType::get($2->get(), ParamTypes, isVarArg);
+ Ty = FunctionType::get($2->get(), ParamTypes, isVarArg);
PMTy = PointerType::get(Ty);
}
delete $2;
@@ -1393,11 +1395,11 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
if (!$5) { // Has no arguments?
$$ = new InvokeInst(V, Normal, Except, vector<Value*>());
} else { // Has arguments?
- // Loop through MethodType's arguments and ensure they are specified
+ // Loop through FunctionType's arguments and ensure they are specified
// correctly!
//
- MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
- MethodType::ParamTypes::const_iterator E = Ty->getParamTypes().end();
+ FunctionType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
+ FunctionType::ParamTypes::const_iterator E = Ty->getParamTypes().end();
vector<Value*>::iterator ArgI = $5->begin(), ArgE = $5->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)
@@ -1498,10 +1500,10 @@ InstVal : BinaryOps Types ValueRef ',' ValueRef {
}
| CALL TypesV ValueRef '(' ValueRefListE ')' {
const PointerType *PMTy;
- const MethodType *Ty;
+ const FunctionType *Ty;
if (!(PMTy = dyn_cast<PointerType>($2->get())) ||
- !(Ty = dyn_cast<MethodType>(PMTy->getElementType()))) {
+ !(Ty = dyn_cast<FunctionType>(PMTy->getElementType()))) {
// Pull out the types of all of the arguments...
vector<const Type*> ParamTypes;
if ($5) {
@@ -1512,7 +1514,7 @@ InstVal : BinaryOps Types ValueRef ',' ValueRef {
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
if (isVarArg) ParamTypes.pop_back();
- Ty = MethodType::get($2->get(), ParamTypes, isVarArg);
+ Ty = FunctionType::get($2->get(), ParamTypes, isVarArg);
PMTy = PointerType::get(Ty);
}
delete $2;
@@ -1523,11 +1525,11 @@ InstVal : BinaryOps Types ValueRef ',' ValueRef {
if (!$5) { // Has no arguments?
$$ = new CallInst(V, vector<Value*>());
} else { // Has arguments?
- // Loop through MethodType's arguments and ensure they are specified
+ // Loop through FunctionType's arguments and ensure they are specified
// correctly!
//
- MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
- MethodType::ParamTypes::const_iterator E = Ty->getParamTypes().end();
+ FunctionType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
+ FunctionType::ParamTypes::const_iterator E = Ty->getParamTypes().end();
vector<Value*>::iterator ArgI = $5->begin(), ArgE = $5->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index cab257f6ec..0b2e935ed4 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -280,12 +280,12 @@ bool BytecodeParser::ParseMethod(const uchar *&Buf, const uchar *EndBuf,
const MethodType::ParamTypes &Params = MTy->getParamTypes();
for (MethodType::ParamTypes::const_iterator It = Params.begin();
It != Params.end(); ++It) {
- MethodArgument *MA = new MethodArgument(*It);
- if (insertValue(MA, Values) == -1) {
+ FunctionArgument *FA = new FunctionArgument(*It);
+ if (insertValue(FA, Values) == -1) {
Error = "Error reading method arguments!\n";
delete M; return failure(true);
}
- M->getArgumentList().push_back(MA);
+ M->getArgumentList().push_back(FA);
}
while (Buf < EndBuf) {
@@ -352,7 +352,7 @@ bool BytecodeParser::ParseMethod(const uchar *&Buf, const uchar *EndBuf,
assert(!getTypeSlot(MTy, type) && "How can meth type not exist?");
getTypeSlot(PMTy, type);
- C->getMethodList().push_back(M);
+ C->getFunctionList().push_back(M);
// Replace placeholder with the real method pointer...
ModuleValues[type][MethSlot] = M;
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index 9ea5d37451..a83bd1642c 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -25,7 +25,7 @@
#include "WriterInternals.h"
#include "llvm/Module.h"
#include "llvm/GlobalVariable.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include "llvm/ConstantVals.h"
#include "llvm/SymbolTable.h"
@@ -61,7 +61,7 @@ BytecodeWriter::BytecodeWriter(std::deque<unsigned char> &o, const Module *M)
outputSymbolTable(*M->getSymbolTable());
}
-void BytecodeWriter::outputConstants(bool isMethod) {
+void BytecodeWriter::outputConstants(bool isFunction) {
BytecodeBlock CPool(BytecodeFormat::ConstantPool, Out);
unsigned NumPlanes = Table.getNumPlanes();
@@ -70,13 +70,13 @@ void BytecodeWriter::outputConstants(bool isMethod) {
if (Plane.empty()) continue; // Skip empty type planes...
unsigned ValNo = 0;
- if (isMethod) // Don't reemit module constants
+ if (isFunction) // Don't reemit module constants
ValNo = Table.getModuleLevel(pno);
else if (pno == Type::TypeTyID)
ValNo = Type::FirstDerivedTyID; // Start emitting at the derived types...
// Scan through and ignore method arguments...
- for (; ValNo < Plane.size() && isa<MethodArgument>(Plane[ValNo]); ValNo++)
+ for (; ValNo < Plane.size() && isa<FunctionArgument>(Plane[ValNo]); ValNo++)
/*empty*/;
unsigned NC = ValNo; // Number of constants
@@ -149,8 +149,8 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
align32(Out);
}
-void BytecodeWriter::processMethod(const Method *M) {
- BytecodeBlock MethodBlock(BytecodeFormat::Method, Out);
+void BytecodeWriter::processMethod(const Function *M) {
+ BytecodeBlock FunctionBlock(BytecodeFormat::Method, Out);
output_vbr((unsigned)M->hasInternalLinkage(), Out);
// Only output the constant pool and other goodies if needed...
if (!M->isExternal()) {
@@ -175,14 +175,14 @@ void BytecodeWriter::processMethod(const Method *M) {
void BytecodeWriter::processBasicBlock(const BasicBlock *BB) {
- BytecodeBlock MethodBlock(BytecodeFormat::BasicBlock, Out);
+ BytecodeBlock FunctionBlock(BytecodeFormat::BasicBlock, Out);
// Process all the instructions in the bb...
for_each(BB->begin(), BB->end(),
bind_obj(this, &BytecodeWriter::processInstruction));
}
void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
- BytecodeBlock MethodBlock(BytecodeFormat::SymbolTable, Out);
+ BytecodeBlock FunctionBlock(BytecodeFormat::SymbolTable, Out);
for (SymbolTable::const_iterator TI = MST.begin(); TI != MST.end(); ++TI) {
SymbolTable::type_const_iterator I = MST.type_begin(TI->first);
diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp
index 660f3112d7..8fa8638a02 100644
--- a/lib/CodeGen/InstrSelection/InstrForest.cpp
+++ b/lib/CodeGen/InstrSelection/InstrForest.cpp
@@ -24,7 +24,7 @@
#include "llvm/CodeGen/InstrForest.h"
#include "llvm/CodeGen/MachineCodeForInstruction.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/iTerminators.h"
#include "llvm/iMemory.h"
#include "llvm/iPHINode.h"
@@ -188,10 +188,10 @@ LabelNode::dumpNode(int indent) const
// A forest of instruction trees, usually for a single method.
//------------------------------------------------------------------------
-InstrForest::InstrForest(Method *M)
+InstrForest::InstrForest(Function *F)
{
- for (Method::iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI) {
- BasicBlock *BB = *MI;
+ for (Function::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI) {
+ BasicBlock *BB = *FI;
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
buildTreeForInstruction(*I);
}
@@ -302,11 +302,11 @@ InstrForest::buildTreeForInstruction(Instruction *instr)
// Check latter condition here just to simplify the next IF.
bool includeAddressOperand =
- (isa<BasicBlock>(operand) || isa<Method>(operand))
+ (isa<BasicBlock>(operand) || isa<Function>(operand))
&& !instr->isTerminator();
if (includeAddressOperand || isa<Instruction>(operand) ||
- isa<Constant>(operand) || isa<MethodArgument>(operand) ||
+ isa<Constant>(operand) || isa<FunctionArgument>(operand) ||
isa<GlobalVariable>(operand))
{
// This operand is a data value
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index c98295cc66..f3b0084dfc 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -11,7 +11,7 @@
#include "llvm/Transforms/Linker.h"
#include "llvm/Module.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include "llvm/GlobalVariable.h"
#include "llvm/SymbolTable.h"
@@ -165,8 +165,8 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
(V = ST->lookup(SGV->getType(), SGV->getName())) &&
cast<GlobalVariable>(V)->hasExternalLinkage()) {
// The same named thing is a global variable, because the only two things
- // that may be in a module level symbol table are Global Vars and Methods,
- // and they both have distinct, nonoverlapping, possible types.
+ // that may be in a module level symbol table are Global Vars and
+ // Functions, and they both have distinct, nonoverlapping, possible types.
//
GlobalVariable *DGV = cast<GlobalVariable>(V);
@@ -231,13 +231,13 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src,
return false;
}
-// LinkMethodProtos - Link the methods together between the two modules, without
-// doing method bodies... this just adds external method prototypes to the Dest
-// method...
+// LinkFunctionProtos - Link the functions together between the two modules,
+// without doing method bodies... this just adds external method prototypes to
+// the Dest function...
//
-static bool LinkMethodProtos(Module *Dest, const Module *Src,
- map<const Value*, Value*> &ValueMap,
- string *Err = 0) {
+static bool LinkFunctionProtos(Module *Dest, const Module *Src,
+ map<const Value*, Value*> &ValueMap,
+ string *Err = 0) {
// We will need a module level symbol table if the src module has a module
// level symbol table...
SymbolTable *ST = Src->getSymbolTable() ? Dest->getSymbolTableSure() : 0;
@@ -245,7 +245,7 @@ static bool LinkMethodProtos(Module *Dest, const Module *Src,
// Loop over all of the methods in the src module, mapping them over as we go
//
for (Module::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) {
- const Method *SM = *I; // SrcMethod
+ const Function *SM = *I; // SrcFunction
Value *V;
// If the method has a name, and that name is already in use in the
@@ -253,29 +253,29 @@ static bool LinkMethodProtos(Module *Dest, const Module *Src,
//
if (SM->hasExternalLinkage() && SM->hasName() &&
(V = ST->lookup(SM->getType(), SM->getName())) &&
- cast<Method>(V)->hasExternalLinkage()) {
- // The same named thing is a Method, because the only two things
- // that may be in a module level symbol table are Global Vars and Methods,
- // and they both have distinct, nonoverlapping, possible types.
+ cast<Function>(V)->hasExternalLinkage()) {
+ // The same named thing is a Function, because the only two things
+ // that may be in a module level symbol table are Global Vars and
+ // Functions, and they both have distinct, nonoverlapping, possible types.
//
- Method *DM = cast<Method>(V); // DestMethod
+ Function *DM = cast<Function>(V); // DestFunction
// Check to make sure the method is not defined in both modules...
if (!SM->isExternal() && !DM->isExternal())
- return Error(Err, "Method '" +
+ return Error(Err, "Function '" +
SM->getMethodType()->getDescription() + "':\"" +
- SM->getName() + "\" - Method is already defined!");
+ SM->getName() + "\" - Function is already defined!");
// Otherwise, just remember this mapping...
ValueMap.insert(std::make_pair(SM, DM));
} else {
- // Method does not already exist, simply insert an external method
+ // Function does not already exist, simply insert an external method
// signature identical to SM into the dest module...
- Method *DM = new Method(SM->getMethodType(), SM->hasInternalLinkage(),
- SM->getName());
+ Function *DM = new Function(SM->getMethodType(), SM->hasInternalLinkage(),
+ SM->getName());
// Add the method signature to the dest module...
- Dest->getMethodList().push_back(DM);
+ Dest->getFunctionList().push_back(DM);
// ... and remember this mapping...
ValueMap.insert(std::make_pair(SM, DM));
@@ -284,24 +284,24 @@ static bool LinkMethodProtos(Module *Dest, const Module *Src,
return false;
}
-// LinkMethodBody - Copy the source method over into the dest method and fix up
-// references to values. At this point we know that Dest is an external method,
-// and that Src is not.
+// LinkFunctionBody - Copy the source method over into the dest method
+// and fix up references to values. At this point we know that Dest
+// is an external method, and that Src is not.
//
-static bool LinkMethodBody(Method *Dest, const Method *Src,
- const map<const Value*, Value*> &GlobalMap,
- string *Err = 0) {
+static bool LinkFunctionBody(Function *Dest, const Function *Src,
+ const map<const Value*, Value*> &GlobalMap,
+ string *Err = 0) {
assert(Src && Dest && Dest->isExternal() && !Src->isExternal());
map<const Value*, Value*> LocalMap; // Map for method local values
// Go through and convert method arguments over...
- for (Method::ArgumentListType::const_iterator
+ for (Function::ArgumentListType::const_iterator
I = Src->getArgumentList().begin(),
E = Src->getArgumentList().end(); I != E; ++I) {
- const MethodArgument *SMA = *I;
+ const FunctionArgument *SMA = *I;
// Create the new method argument and add to the dest method...
- MethodArgument *DMA = new MethodArgument(SMA->getType(), SMA->getName());
+ FunctionArgument *DMA = new FunctionArgument(SMA->getType(),SMA->getName());
Dest->getArgumentList().push_back(DMA);
// Add a mapping to our local map
@@ -310,7 +310,7 @@ static bool LinkMethodBody(Method *Dest, const Method *Src,
// Loop over all of the basic blocks, copying the instructions over...
//
- for (Method::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) {
+ for (Function::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) {