aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-09 04:14:01 +0000
committerChris Lattner <sabre@nondot.org>2004-02-09 04:14:01 +0000
commitd5d89967206e1153d24abdb7b22002f7533f55c7 (patch)
treedd63c2f411779dd7b2087561d14d924440362ba8 /lib/Bytecode
parent36cb08ae5bc991bb91f1ab566100c2cdd25c344c (diff)
Start using the new and improve interface to FunctionType arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11224 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Reader/InstructionReader.cpp20
-rw-r--r--lib/Bytecode/Reader/Reader.cpp21
-rw-r--r--lib/Bytecode/Writer/ConstantWriter.cpp8
3 files changed, 23 insertions, 26 deletions
diff --git a/lib/Bytecode/Reader/InstructionReader.cpp b/lib/Bytecode/Reader/InstructionReader.cpp
index 21a1490397..8912704c6f 100644
--- a/lib/Bytecode/Reader/InstructionReader.cpp
+++ b/lib/Bytecode/Reader/InstructionReader.cpp
@@ -218,16 +218,16 @@ void BytecodeParser::ParseInstruction(const unsigned char *&Buf,
if (FTy == 0) throw std::string("Call to non function pointer value!");
std::vector<Value *> Params;
- const FunctionType::ParamTypes &PL = FTy->getParamTypes();
-
if (!FTy->isVarArg()) {
- FunctionType::ParamTypes::const_iterator It = PL.begin();
+ FunctionType::param_iterator It = FTy->param_begin();
for (unsigned i = 1, e = Args.size(); i != e; ++i) {
- if (It == PL.end()) throw std::string("Invalid call instruction!");
+ if (It == FTy->param_end())
+ throw std::string("Invalid call instruction!");
Params.push_back(getValue(getTypeSlot(*It++), Args[i]));
}
- if (It != PL.end()) throw std::string("Invalid call instruction!");
+ if (It != FTy->param_end())
+ throw std::string("Invalid call instruction!");
} else {
Args.erase(Args.begin(), Args.begin()+1+hasVarArgCallPadding);
@@ -268,18 +268,18 @@ void BytecodeParser::ParseInstruction(const unsigned char *&Buf,
std::vector<Value *> Params;
BasicBlock *Normal, *Except;
- const FunctionType::ParamTypes &PL = FTy->getParamTypes();
-
if (!FTy->isVarArg()) {
Normal = getBasicBlock(Args[1]);
Except = getBasicBlock(Args[2]);
- FunctionType::ParamTypes::const_iterator It = PL.begin();
+ FunctionType::param_iterator It = FTy->param_begin();
for (unsigned i = 3, e = Args.size(); i != e; ++i) {
- if (It == PL.end()) throw std::string("Invalid invoke instruction!");
+ if (It == FTy->param_end())
+ throw std::string("Invalid invoke instruction!");
Params.push_back(getValue(getTypeSlot(*It++), Args[i]));
}
- if (It != PL.end()) throw std::string("Invalid invoke instruction!");
+ if (It != FTy->param_end())
+ throw std::string("Invalid invoke instruction!");
} else {
Args.erase(Args.begin(), Args.begin()+1+hasVarArgCallPadding);
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index 977acbc861..4a3a5c66d7 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -381,11 +381,10 @@ void BytecodeParser::materializeFunction(Function* F) {
// Insert arguments into the value table before we parse the first basic
// block in the function, but after we potentially read in the
// compaction table.
- const FunctionType::ParamTypes &Params =
- F->getFunctionType()->getParamTypes();
+ const FunctionType *FT = F->getFunctionType();
Function::aiterator AI = F->abegin();
- for (FunctionType::ParamTypes::const_iterator It = Params.begin();
- It != Params.end(); ++It, ++AI)
+ for (FunctionType::param_iterator It = FT->param_begin();
+ It != FT->param_end(); ++It, ++AI)
insertValue(AI, getTypeSlot(AI->getType()), Values);
InsertedArguments = true;
}
@@ -404,11 +403,10 @@ void BytecodeParser::materializeFunction(Function* F) {
// Insert arguments into the value table before we parse the first basic
// block in the function, but after we potentially read in the
// compaction table.
- const FunctionType::ParamTypes &Params =
- F->getFunctionType()->getParamTypes();
+ const FunctionType *FT = F->getFunctionType();
Function::aiterator AI = F->abegin();
- for (FunctionType::ParamTypes::const_iterator It = Params.begin();
- It != Params.end(); ++It, ++AI)
+ for (FunctionType::param_iterator It = FT->param_begin();
+ It != FT->param_end(); ++It, ++AI)
insertValue(AI, getTypeSlot(AI->getType()), Values);
InsertedArguments = true;
}
@@ -424,11 +422,10 @@ void BytecodeParser::materializeFunction(Function* F) {
// list for the function, but after we potentially read in the compaction
// table.
if (!InsertedArguments) {
- const FunctionType::ParamTypes &Params =
- F->getFunctionType()->getParamTypes();
+ const FunctionType *FT = F->getFunctionType();
Function::aiterator AI = F->abegin();
- for (FunctionType::ParamTypes::const_iterator It = Params.begin();
- It != Params.end(); ++It, ++AI)
+ for (FunctionType::param_iterator It = FT->param_begin();
+ It != FT->param_end(); ++It, ++AI)
insertValue(AI, getTypeSlot(AI->getType()), Values);
InsertedArguments = true;
}
diff --git a/lib/Bytecode/Writer/ConstantWriter.cpp b/lib/Bytecode/Writer/ConstantWriter.cpp
index 6fe596872e..6d49165b02 100644
--- a/lib/Bytecode/Writer/ConstantWriter.cpp
+++ b/lib/Bytecode/Writer/ConstantWriter.cpp
@@ -34,12 +34,12 @@ void BytecodeWriter::outputType(const Type *T) {
assert(Slot != -1 && "Type used but not available!!");
output_vbr((unsigned)Slot, Out);
- // Output the number of arguments to method (+1 if varargs):
- output_vbr((unsigned)MT->getParamTypes().size()+MT->isVarArg(), Out);
+ // Output the number of arguments to function (+1 if varargs):
+ output_vbr((unsigned)MT->getNumParams()+MT->isVarArg(), Out);
// Output all of the arguments...
- FunctionType::ParamTypes::const_iterator I = MT->getParamTypes().begin();
- for (; I != MT->getParamTypes().end(); ++I) {
+ FunctionType::param_iterator I = MT->param_begin();
+ for (; I != MT->param_end(); ++I) {
Slot = Table.getSlot(*I);
assert(Slot != -1 && "Type used but not available!!");
output_vbr((unsigned)Slot, Out);