// the worklists...
//
for (Function::ArgumentListType::iterator I = Func->getArgumentList().begin(),
- E = Func->getArgumentList().end(); I != E; ++I)
+ E = Func->getArgumentList().end(); I != E; ++I) {
+ Value *Arg = (Value*)(*I);
// Only process arguments that are of pointer type...
- if (PointerType *PT = dyn_cast<PointerType>((*I)->getType())) {
- ArgDSNode *Arg = new ArgDSNode(*I);
- ArgNodes.push_back(Arg);
+ if (PointerType *PT = dyn_cast<PointerType>(Arg->getType())) {
+ ArgDSNode *ArgNode = new ArgDSNode(*I);
+ ArgNodes.push_back(ArgNode);
// Add a critical shadow value for it to represent what it is pointing
// to and add this to the value map...
ShadowDSNode *Shad = new ShadowDSNode(PT->getElementType(),
Func->getParent(), true);
ShadowNodes.push_back(Shad);
- ValueMap[*I].add(PointerVal(Shad), *I);
+ ValueMap[Arg].add(PointerVal(Shad), Arg);
// The value of the argument is the shadow value...
- Arg->getLink(0).add(Shad);
+ ArgNode->getLink(0).add(Shad);
// Make sure that all users of the argument are processed...
- addAllUsesToWorkList(*I);
+ addAllUsesToWorkList(Arg);
}
-
+ }
+
// Iterate over the instructions in the method. Create nodes for malloc and
// call instructions. Add all uses of these to the worklist of instructions
// to process.
#include "llvm/BasicBlock.h"
#include "llvm/iMemory.h"
#include "llvm/iOther.h"
+#include "llvm/Argument.h"
#include "Support/STLExtras.h"
#include <algorithm>
#include <sstream>
MapPVS(ArgLinks[i], Old->ArgLinks[i], NodeMap);
}
-ArgDSNode::ArgDSNode(FunctionArgument *FA)
+ArgDSNode::ArgDSNode(Argument *FA)
: DSNode(ArgNode, FA->getType()), FuncArg(FA) {
}
std::cerr << "Bizarre thing to expr classify: " << Expr << "\n";
return Expr;
case Value::GlobalVariableVal: // Global Variable & Function argument:
- case Value::FunctionArgumentVal: // nothing known, return variable itself
+ case Value::ArgumentVal: // nothing known, return variable itself
return Expr;
case Value::ConstantVal: // Constant value, just return constant
Constant *CPV = cast<Constant>(Expr);
static bool isLoopInvariant(const Value *V, const cfg::Loop *L) {
- if (isa<Constant>(V) || isa<FunctionArgument>(V) || isa<GlobalValue>(V))
+ if (isa<Constant>(V) || isa<Argument>(V) || isa<GlobalValue>(V))
return true;
const Instruction *I = cast<Instruction>(V);
#include "llvm/ConstantVals.h"
#include "llvm/iPHINode.h"
#include "llvm/iOther.h"
+#include "llvm/Argument.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
const FunctionType::ParamTypes &Params = MTy->getParamTypes();
for (FunctionType::ParamTypes::const_iterator It = Params.begin();
It != Params.end(); ++It) {
- FunctionArgument *FA = new FunctionArgument(*It);
+ Argument *FA = new Argument(*It);
if (insertValue(FA, Values) == -1) {
Error = "Error reading method arguments!\n";
delete M; return failure(true);
#include "llvm/iOther.h"
#include "llvm/DerivedTypes.h"
#include "llvm/SymbolTable.h"
+#include "llvm/Argument.h"
#include "Support/DepthFirstIterator.h"
#include "Support/STLExtras.h"
#include <algorithm>
ValNo = Type::FirstDerivedTyID; // Start emitting at the derived types...
// Scan through and ignore function arguments...
- for (; ValNo < Plane.size() && isa<FunctionArgument>(Plane[ValNo]); ValNo++)
+ for (; ValNo < Plane.size() && isa<Argument>(Plane[ValNo]); ValNo++)
/*empty*/;
unsigned NC = ValNo; // Number of constants
&& !instr->isTerminator();
if (includeAddressOperand || isa<Instruction>(operand) ||
- isa<Constant>(operand) || isa<FunctionArgument>(operand) ||
+ isa<Constant>(operand) || isa<Argument>(operand) ||
isa<GlobalVariable>(operand))
{
// This operand is a data value
#include "llvm/DerivedTypes.h"
#include "llvm/iOther.h"
#include "llvm/ConstantVals.h"
+#include "llvm/Argument.h"
#include <iostream>
using std::cerr;
using std::string;
for (Function::ArgumentListType::const_iterator
I = Src->getArgumentList().begin(),
E = Src->getArgumentList().end(); I != E; ++I) {
- const FunctionArgument *SMA = *I;
+ const Argument *SMA = *I;
// Create the new method argument and add to the dest method...
- FunctionArgument *DMA = new FunctionArgument(SMA->getType(),SMA->getName());
+ Argument *DMA = new Argument(SMA->getType(), SMA->getName());
Dest->getArgumentList().push_back(DMA);
// Add a mapping to our local map
&& !instr->isTerminator();
if (includeAddressOperand || isa<Instruction>(operand) ||
- isa<Constant>(operand) || isa<FunctionArgument>(operand) ||
+ isa<Constant>(operand) || isa<Argument>(operand) ||
isa<GlobalVariable>(operand))
{
// This operand is a data value
#include "llvm/iPHINode.h"
#include "llvm/iOther.h"
#include "llvm/Type.h"
+#include "llvm/Argument.h"
#include <algorithm>
#include <map>
#include <iostream>
#include "llvm/iMemory.h"
#include "llvm/iTerminators.h"
#include "llvm/iOther.h"
+#include "llvm/Argument.h"
#include "Support/STLExtras.h"
#include <algorithm>
using std::map;
// Okay, first order of business, create the arguments...
for (unsigned i = 0, e = M->getArgumentList().size(); i != e; ++i) {
- const FunctionArgument *OFA = M->getArgumentList()[i];
- FunctionArgument *NFA = new FunctionArgument(ConvertType(OFA->getType()),
- OFA->getName());
+ const Argument *OFA = M->getArgumentList()[i];
+ Argument *NFA = new Argument(ConvertType(OFA->getType()), OFA->getName());
NewMeth->getArgumentList().push_back(NFA);
LocalValueMap[OFA] = NFA; // Keep track of value mapping
}
#include "llvm/ConstantVals.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/InstVisitor.h"
+#include "llvm/Argument.h"
#include "Support/DepthFirstIterator.h"
#include "Support/STLExtras.h"
#include <algorithm>
// Add arguments to the function... starting with all of the old arguments
vector<Value*> ArgMap;
for (unsigned i = 0, e = TFI.Func->getArgumentList().size(); i != e; ++i) {
- const FunctionArgument *OFA = TFI.Func->getArgumentList()[i];
- FunctionArgument *NFA = new FunctionArgument(OFA->getType(),OFA->getName());
+ const Argument *OFA = TFI.Func->getArgumentList()[i];
+ Argument *NFA = new Argument(OFA->getType(), OFA->getName());
NewFunc->getArgumentList().push_back(NFA);
ArgMap.push_back(NFA); // Keep track of the arguments
}
Name = "retpool";
else
Name = ArgMap[TFI.ArgInfo[i].ArgNo]->getName(); // Get the arg name
- FunctionArgument *NFA = new FunctionArgument(PoolTy, Name+".pool");
+ Argument *NFA = new Argument(PoolTy, Name+".pool");
NewFunc->getArgumentList().push_back(NFA);
}
unsigned ArgNo = 0;
for (Function::ArgumentListType::const_iterator
I = argList.begin(), E = argList.end(); I != E; ++I, ++ArgNo) {
- InsertVerbosePrintInst(*I, BB, BBI,
+ InsertVerbosePrintInst((Value*)*I, BB, BBI,
" Arg #" + utostr(ArgNo), Printf);
}
}
// an interval invariant computation.
//
static bool isLoopInvariant(cfg::Interval *Int, Value *V) {
- assert(isa<Constant>(V) || isa<Instruction>(V) || isa<FunctionArgument>(V));
+ assert(isa<Constant>(V) || isa<Instruction>(V) || isa<Argument>(V));
if (!isa<Instruction>(V))
return true; // Constants and arguments are always loop invariant
// getValueState - Return the InstVal object that corresponds to the value.
// This function is neccesary because not all values should start out in the
- // underdefined state... FunctionArgument's should be overdefined, and
+ // underdefined state... Argument's should be overdefined, and
// constants should be marked as constants. If a value is not known to be an
// Instruction object, then use this accessor to get its value from the map.
//
if (Constant *CPV = dyn_cast<Constant>(V)) { // Constants are constant
ValueState[CPV].markConstant(CPV);
- } else if (isa<FunctionArgument>(V)) { // FuncArgs are overdefined
+ } else if (isa<Argument>(V)) { // Arguments are overdefined
ValueState[V].markOverdefined();
}
// All others are underdefined by default...
#include "llvm/DerivedTypes.h"
#include "llvm/iOther.h"
#include "llvm/ConstantVals.h"
+#include "llvm/Argument.h"
#include <iostream>
using std::cerr;
using std::string;
for (Function::ArgumentListType::const_iterator
I = Src->getArgumentList().begin(),
E = Src->getArgumentList().end(); I != E; ++I) {
- const FunctionArgument *SMA = *I;
+ const Argument *SMA = *I;
// Create the new method argument and add to the dest method...
- FunctionArgument *DMA = new FunctionArgument(SMA->getType(),SMA->getName());
+ Argument *DMA = new Argument(SMA->getType(), SMA->getName());
Dest->getArgumentList().push_back(DMA);
// Add a mapping to our local map
#include "llvm/iPHINode.h"
#include "llvm/iOther.h"
#include "llvm/SymbolTable.h"
+#include "llvm/Argument.h"
#include "Support/StringExtras.h"
#include "Support/STLExtras.h"
#include <algorithm>
using std::ostream;
static const Module *getModuleFromVal(const Value *V) {
- if (const FunctionArgument *MA = dyn_cast<const FunctionArgument>(V))
+ if (const Argument *MA = dyn_cast<const Argument>(V))
return MA->getParent() ? MA->getParent()->getParent() : 0;
else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(V))
return BB->getParent() ? BB->getParent()->getParent() : 0;
static SlotCalculator *createSlotCalculator(const Value *V) {
assert(!isa<Type>(V) && "Can't create an SC for a type!");
- if (const FunctionArgument *FA = dyn_cast<const FunctionArgument>(V)) {
+ if (const Argument *FA = dyn_cast<const Argument>(V)) {
return new SlotCalculator(FA->getParent(), true);
} else if (const Instruction *I = dyn_cast<const Instruction>(V)) {
return new SlotCalculator(I->getParent()->getParent(), true);
void printConstant(const Constant *CPV);
void printGlobal(const GlobalVariable *GV);
void printFunction(const Function *F);
- void printFunctionArgument(const FunctionArgument *FA);
+ void printArgument(const Argument *FA);
void printBasicBlock(const BasicBlock *BB);
void printInstruction(const Instruction *I);
ostream &printType(const Type *Ty);
if (!M->isExternal()) {
for_each(M->getArgumentList().begin(), M->getArgumentList().end(),
- bind_obj(this, &AssemblyWriter::printFunctionArgument));
+ bind_obj(this, &AssemblyWriter::printArgument));
} else {
// Loop over the arguments, printing them...
const FunctionType *MT = M->getFunctionType();
Table.purgeFunction();
}
-// printFunctionArgument - This member is called for every argument that
+// printArgument - This member is called for every argument that
// is passed into the function. Simply print it out
//
-void AssemblyWriter::printFunctionArgument(const FunctionArgument *Arg) {
+void AssemblyWriter::printArgument(const Argument *Arg) {
// Insert commas as we go... the first arg doesn't get a comma
if (Arg != Arg->getParent()->getArgumentList().front()) Out << ", ";
o << getDescription();
}
-void FunctionArgument::print(std::ostream &o) const {
+void Argument::print(std::ostream &o) const {
o << getType() << " " << getName();
}
case Value::ConstantVal:
Out << " "; AW->write(V->getType());
Out << " " << cast<Constant>(V)->getStrValue(); break;
- case Value::FunctionArgumentVal:
+ case Value::ArgumentVal:
AW->write(V->getType()); Out << " " << V->getName(); break;
case Value::TypeVal: AW->write(cast<const Type>(V)); break;
case Value::InstructionVal: AW->write(cast<Instruction>(V)); break;
#include "llvm/DerivedTypes.h"
#include "llvm/iOther.h"
#include "llvm/ConstantVals.h"
+#include "llvm/Argument.h"
#include <iostream>
using std::cerr;
using std::string;
for (Function::ArgumentListType::const_iterator
I = Src->getArgumentList().begin(),
E = Src->getArgumentList().end(); I != E; ++I) {
- const FunctionArgument *SMA = *I;
+ const Argument *SMA = *I;
// Create the new method argument and add to the dest method...
- FunctionArgument *DMA = new FunctionArgument(SMA->getType(),SMA->getName());
+ Argument *DMA = new Argument(SMA->getType(), SMA->getName());
Dest->getArgumentList().push_back(DMA);
// Add a mapping to our local map
#include "llvm/iOther.h"
#include "llvm/DerivedTypes.h"
#include "llvm/SymbolTable.h"
+#include "llvm/Argument.h"
#include "Support/DepthFirstIterator.h"
#include "Support/STLExtras.h"
#include <algorithm>