Move FunctionArgument out of iOther.h into Argument.h and rename class to
authorChris Lattner <sabre@nondot.org>
Tue, 9 Apr 2002 19:48:49 +0000 (19:48 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 9 Apr 2002 19:48:49 +0000 (19:48 +0000)
be 'Argument' instead of FunctionArgument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2216 91177308-0d34-0410-b5e6-96231b3b80d8

20 files changed:
lib/Analysis/DataStructure/FunctionRepBuilder.cpp
lib/Analysis/DataStructure/NodeImpl.cpp
lib/Analysis/Expressions.cpp
lib/Analysis/InductionVariable.cpp
lib/Bytecode/Reader/Reader.cpp
lib/Bytecode/Writer/SlotCalculator.cpp
lib/Bytecode/Writer/Writer.cpp
lib/CodeGen/InstrSelection/InstrForest.cpp
lib/Linker/LinkModules.cpp
lib/Target/SparcV9/InstrSelection/InstrForest.cpp
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/IPO/MutateStructTypes.cpp
lib/Transforms/IPO/OldPoolAllocate.cpp
lib/Transforms/Instrumentation/TraceValues.cpp
lib/Transforms/Scalar/InductionVars.cpp
lib/Transforms/Scalar/SCCP.cpp
lib/Transforms/Utils/Linker.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/Linker.cpp
lib/VMCore/SlotCalculator.cpp

index 965185a3447fc073cbd451261011ce6d7a116597..eda16bc6949928f8b177335aa489e1a7c9f70ed5 100644 (file)
@@ -143,26 +143,28 @@ void FunctionRepBuilder::initializeWorkList(Function *Func) {
   // 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.
index 05ed8844ac6d8c90e3bc7b40227499c6de85ef94..6c986fe1db7c83b8d70001d47d7715d0a79f4ffa 100644 (file)
@@ -11,6 +11,7 @@
 #include "llvm/BasicBlock.h"
 #include "llvm/iMemory.h"
 #include "llvm/iOther.h"
+#include "llvm/Argument.h"
 #include "Support/STLExtras.h"
 #include <algorithm>
 #include <sstream>
@@ -288,7 +289,7 @@ void CallDSNode::mapNode(map<const DSNode*, DSNode*> &NodeMap,
     MapPVS(ArgLinks[i], Old->ArgLinks[i], NodeMap);
 }
 
-ArgDSNode::ArgDSNode(FunctionArgument *FA)
+ArgDSNode::ArgDSNode(Argument *FA)
   : DSNode(ArgNode, FA->getType()), FuncArg(FA) {
 }
 
index 0f37c5fb7e64728c4e463e5728bd89d39760991b..e78fb1e690ab6cb4b21485f602544453712ffaf9 100644 (file)
@@ -245,7 +245,7 @@ ExprType analysis::ClassifyExpression(Value *Expr) {
     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);
index 11d1a2c860eb665d7ab0049a372429a168e89614..155017480bed293ab65417f1665f48a2ea25fc31 100644 (file)
@@ -28,7 +28,7 @@ using analysis::ExprType;
 
 
 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);
index d7c8af3de7d50e4e5e854b73bf31e98887acd04d..fff2d02898c45002b4d98e6eebadf9d33e753437 100644 (file)
@@ -19,6 +19,7 @@
 #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>
@@ -280,7 +281,7 @@ bool BytecodeParser::ParseMethod(const uchar *&Buf, const uchar *EndBuf,
   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); 
index 4a8312e6133a5f34252e337c4ca1b00e60315dda..8bd0b494f47f004c769421bef37588fbc30ff37f 100644 (file)
@@ -19,6 +19,7 @@
 #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>
index 0b883acd58a143714fd9359a03841afd90d940a7..ab22db3c7fbb811fc10884dac0a7587d3efd065e 100644 (file)
@@ -73,7 +73,7 @@ void BytecodeWriter::outputConstants(bool isFunction) {
       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
index 95803cd1a409de94b071510fc1aa3967fb8e99bd..e2f45a0285be7254e1b147cab294bfd280511e37 100644 (file)
@@ -298,7 +298,7 @@ InstrForest::buildTreeForInstruction(Instruction *instr)
        && !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
index 9637f747e28cbc2b1f56809eefb16c928623405b..086c6c6b28f062fc4b897297a6f37989ac20cbfb 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/iOther.h"
 #include "llvm/ConstantVals.h"
+#include "llvm/Argument.h"
 #include <iostream>
 using std::cerr;
 using std::string;
@@ -301,10 +302,10 @@ static bool LinkFunctionBody(Function *Dest, const Function *Src,
   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
index 95803cd1a409de94b071510fc1aa3967fb8e99bd..e2f45a0285be7254e1b147cab294bfd280511e37 100644 (file)
@@ -298,7 +298,7 @@ InstrForest::buildTreeForInstruction(Instruction *instr)
        && !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
index 461f5974f4cce505605bb589f15a1e5aa965c394..0a58eab83c7451cdb4178f3ebad2654fae406865 100644 (file)
@@ -23,6 +23,7 @@
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
 #include "llvm/Type.h"
+#include "llvm/Argument.h"
 #include <algorithm>
 #include <map>
 #include <iostream>
index e06ee61412802d86799ba3907292ac3685da692d..fcad5fa050bfed7d85eae298d0d3f78083a39c25 100644 (file)
@@ -22,6 +22,7 @@
 #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;
@@ -337,9 +338,8 @@ void MutateStructTypes::transformMethod(Function *m) {
 
   // 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
   }
index 731e9e973f2fb59120ee690cca01ccb15b16c95d..4b5c8308704a8603d29bb36f25d212df93e69c5c 100644 (file)
@@ -20,6 +20,7 @@
 #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>
@@ -677,8 +678,8 @@ void PoolAllocate::transformFunction(TransformFunctionInfo &TFI,
   // 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 
   }
@@ -690,7 +691,7 @@ void PoolAllocate::transformFunction(TransformFunctionInfo &TFI,
       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);
   }
 
index 7f7321dbf06dfa74b37b06f58dd2650f2618eb9b..20ad1d8cc90726b3f6662f317effccde860d9828 100644 (file)
@@ -257,7 +257,7 @@ static inline void InsertCodeToShowFunctionEntry(Function *M, Function *Printf){
   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);
   }
 }
index 55b227585be628407bb36cd060e97aaa4bb79062..9931a6b5d7a6f079a4c941e1ee5f77e2bfa7d791 100644 (file)
@@ -37,7 +37,7 @@ using std::cerr;
 // 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
index b569a5366e1bee3b5dd907962a62ae706a439476..e6cf765e55557cce47b8f507387b6ac516544cf4 100644 (file)
@@ -140,7 +140,7 @@ private:
 
   // 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.
   //
@@ -150,7 +150,7 @@ private:
       
     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...
index 9637f747e28cbc2b1f56809eefb16c928623405b..086c6c6b28f062fc4b897297a6f37989ac20cbfb 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/iOther.h"
 #include "llvm/ConstantVals.h"
+#include "llvm/Argument.h"
 #include <iostream>
 using std::cerr;
 using std::string;
@@ -301,10 +302,10 @@ static bool LinkFunctionBody(Function *Dest, const Function *Src,
   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
index e5f9114c8e1f7ece9b26ecf80cafb8393635ff0c..6cdbf9def32314f12f09d21c8ce00d2695e357ff 100644 (file)
@@ -20,6 +20,7 @@
 #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>
@@ -30,7 +31,7 @@ using std::vector;
 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;
@@ -46,7 +47,7 @@ static const Module *getModuleFromVal(const Value *V) {
 
 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);
@@ -286,7 +287,7 @@ private :
   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);
@@ -397,7 +398,7 @@ void AssemblyWriter::printFunction(const Function *M) {
 
   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();
@@ -432,10 +433,10 @@ void AssemblyWriter::printFunction(const Function *M) {
   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 << ", ";
 
@@ -679,7 +680,7 @@ void Type::print(std::ostream &o) const {
     o << getDescription();
 }
 
-void FunctionArgument::print(std::ostream &o) const {
+void Argument::print(std::ostream &o) const {
   o << getType() << " " << getName();
 }
 
@@ -710,7 +711,7 @@ CachedWriter &CachedWriter::operator<<(const Value *V) {
   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;
index 9637f747e28cbc2b1f56809eefb16c928623405b..086c6c6b28f062fc4b897297a6f37989ac20cbfb 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/iOther.h"
 #include "llvm/ConstantVals.h"
+#include "llvm/Argument.h"
 #include <iostream>
 using std::cerr;
 using std::string;
@@ -301,10 +302,10 @@ static bool LinkFunctionBody(Function *Dest, const Function *Src,
   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
index 4a8312e6133a5f34252e337c4ca1b00e60315dda..8bd0b494f47f004c769421bef37588fbc30ff37f 100644 (file)
@@ -19,6 +19,7 @@
 #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>