[cfe-commits] r39671 - in /cfe/cfe/trunk: Basic/TargetInfo.cpp CodeGen/CGDecl.cpp CodeGen/CGExpr.cpp CodeGen/CGStmt.cpp CodeGen/CodeGenFunction.cpp CodeGen/CodeGenFunction.h CodeGen/CodeGenModule.cpp CodeGen/CodeGenTypes.cpp CodeGen/CodeGenTypes.h

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:46:58 PDT 2007


Author: clattner
Date: Wed Jul 11 11:46:58 2007
New Revision: 39671

URL: http://llvm.org/viewvc/llvm-project?rev=39671&view=rev
Log:
remove location tracking for target info

Modified:
    cfe/cfe/trunk/Basic/TargetInfo.cpp
    cfe/cfe/trunk/CodeGen/CGDecl.cpp
    cfe/cfe/trunk/CodeGen/CGExpr.cpp
    cfe/cfe/trunk/CodeGen/CGStmt.cpp
    cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp
    cfe/cfe/trunk/CodeGen/CodeGenFunction.h
    cfe/cfe/trunk/CodeGen/CodeGenModule.cpp
    cfe/cfe/trunk/CodeGen/CodeGenTypes.cpp
    cfe/cfe/trunk/CodeGen/CodeGenTypes.h

Modified: cfe/cfe/trunk/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Basic/TargetInfo.cpp?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/Basic/TargetInfo.cpp (original)
+++ cfe/cfe/trunk/Basic/TargetInfo.cpp Wed Jul 11 11:46:58 2007
@@ -26,7 +26,7 @@
 /// non-portable.
 void TargetInfo::DiagnoseNonPortability(SourceLocation Loc, unsigned DiagKind) {
   NonPortable = true;
-  if (Diag) Diag->Report(Loc, DiagKind);
+  if (Diag && Loc.isValid()) Diag->Report(Loc, DiagKind);
 }
 
 /// GetTargetDefineMap - Get the set of target #defines in an associative

Modified: cfe/cfe/trunk/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CGDecl.cpp?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CGDecl.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CGDecl.cpp Wed Jul 11 11:46:58 2007
@@ -72,7 +72,7 @@
   llvm::Value *DeclPtr;
   if (Ty->isConstantSizeType()) {
     // A normal fixed sized variable becomes an alloca in the entry block.
-    const llvm::Type *LTy = ConvertType(Ty, D.getLocation());
+    const llvm::Type *LTy = ConvertType(Ty);
     // TODO: Alignment
     DeclPtr = new llvm::AllocaInst(LTy, 0, D.getName(), AllocaInsertPt);
   } else {
@@ -97,7 +97,7 @@
     DeclPtr = Arg;
   } else {
     // A fixed sized first class variable becomes an alloca in the entry block.
-    const llvm::Type *LTy = ConvertType(Ty, D.getLocation());
+    const llvm::Type *LTy = ConvertType(Ty);
     if (LTy->isFirstClassType()) {
       // TODO: Alignment
       DeclPtr = new llvm::AllocaInst(LTy, 0, std::string(D.getName())+".addr",

Modified: cfe/cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CGExpr.cpp?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CGExpr.cpp Wed Jul 11 11:46:58 2007
@@ -41,7 +41,7 @@
 /// EmitConversion - Convert the value specied by Val, whose type is ValTy, to
 /// the type specified by DstTy, following the rules of C99 6.3.
 RValue CodeGenFunction::EmitConversion(RValue Val, QualType ValTy,
-                                       QualType DstTy, SourceLocation Loc) {
+                                       QualType DstTy) {
   ValTy = ValTy.getCanonicalType();
   DstTy = DstTy.getCanonicalType();
   if (ValTy == DstTy) return Val;
@@ -54,7 +54,7 @@
   // Handle pointer conversions next: pointers can only be converted to/from
   // other pointers and integers.
   if (isa<PointerType>(DstTy)) {
-    const llvm::Type *DestTy = ConvertType(DstTy, Loc);
+    const llvm::Type *DestTy = ConvertType(DstTy);
     
     // The source value may be an integer, or a pointer.
     assert(Val.isScalar() && "Can only convert from integer or pointer");
@@ -66,7 +66,7 @@
   
   if (isa<PointerType>(ValTy)) {
     // Must be an ptr to int cast.
-    const llvm::Type *DestTy = ConvertType(DstTy, Loc);
+    const llvm::Type *DestTy = ConvertType(DstTy);
     assert(isa<llvm::IntegerType>(DestTy) && "not ptr->int?");
     return RValue::get(Builder.CreateIntToPtr(Val.getVal(), DestTy, "conv"));
   }
@@ -78,7 +78,7 @@
     // We know that these are representable as scalars in LLVM, convert to LLVM
     // types since they are easier to reason about.
     llvm::Value *SrcVal = Val.getVal();
-    const llvm::Type *DestTy = ConvertType(DstTy, Loc);
+    const llvm::Type *DestTy = ConvertType(DstTy);
     if (SrcVal->getType() == DestTy) return Val;
     
     llvm::Value *Result;
@@ -417,7 +417,7 @@
   if (E->getType()->isVoidType())
     return RValue::getAggregate(0);
   
-  return EmitConversion(Src, SrcTy, E->getType(), E->getLParenLoc());
+  return EmitConversion(Src, SrcTy, E->getType());
 }
 
 RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
@@ -941,8 +941,7 @@
   RValue RHS = EmitExprWithUsualUnaryConversions(E->getRHS(), RHSTy);
   
   // Convert the RHS to the type of the LHS.
-  // FIXME: I'm not thrilled about having to call getLocStart() here... :(
-  RHS = EmitConversion(RHS, RHSTy, E->getType(), E->getLocStart());
+  RHS = EmitConversion(RHS, RHSTy, E->getType());
   
   // Store the value into the LHS.
   EmitStoreThroughLValue(RHS, LHS, E->getType());

Modified: cfe/cfe/trunk/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CGStmt.cpp?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CGStmt.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CGStmt.cpp Wed Jul 11 11:46:58 2007
@@ -263,7 +263,7 @@
       Builder.CreateRet(llvm::UndefValue::get(RetTy));
   } else {
     // Do implicit conversions to the returned type.
-    RetVal = EmitConversion(RetVal, RV->getType(), FnRetTy, SourceLocation());
+    RetVal = EmitConversion(RetVal, RV->getType(), FnRetTy);
     
     if (RetVal.isScalar()) {
       // FIXME: Pass return loc in!

Modified: cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenFunction.cpp Wed Jul 11 11:46:58 2007
@@ -39,13 +39,13 @@
 }
 
 
-const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) {
-  return CGM.getTypes().ConvertType(T, Loc);
+const llvm::Type *CodeGenFunction::ConvertType(QualType T) {
+  return CGM.getTypes().ConvertType(T);
 }
 
 void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
-  LLVMIntTy = ConvertType(getContext().IntTy, FD->getLocation());
-  LLVMPointerWidth = Target.getPointerWidth(FD->getLocation());
+  LLVMIntTy = ConvertType(getContext().IntTy);
+  LLVMPointerWidth = Target.getPointerWidth(SourceLocation());
   
   CurFn = cast<llvm::Function>(CGM.GetAddrOfGlobalDecl(FD));
   CurFuncDecl = FD;

Modified: cfe/cfe/trunk/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenFunction.h?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenFunction.h (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenFunction.h Wed Jul 11 11:46:58 2007
@@ -27,7 +27,6 @@
   class Decl;
   class FunctionDecl;
   class TargetInfo;
-  class SourceLocation;
   class QualType;
   class FunctionTypeProto;
   
@@ -152,7 +151,7 @@
 
   void GenerateCode(const FunctionDecl *FD);
   
-  const llvm::Type *ConvertType(QualType T, SourceLocation Loc);
+  const llvm::Type *ConvertType(QualType T);
   
   /// getBasicBlockForLabel - Return the LLVM basicblock that the specified
   /// label maps to.
@@ -172,8 +171,7 @@
   
   /// EmitConversion - Convert the value specied by Val, whose type is ValTy, to
   /// the type specified by DstTy, following the rules of C99 6.3.
-  RValue EmitConversion(RValue Val, QualType ValTy, QualType DstTy,
-                        SourceLocation Loc);
+  RValue EmitConversion(RValue Val, QualType ValTy, QualType DstTy);
   
   /// ConvertScalarValueToBool - Convert the specified expression value to a
   /// boolean (i1) truth value.  This is equivalent to "Val == 0".

Modified: cfe/cfe/trunk/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenModule.cpp?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenModule.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenModule.cpp Wed Jul 11 11:46:58 2007
@@ -33,7 +33,7 @@
   if (Entry) return Entry;
   
   QualType ASTTy = cast<ValueDecl>(D)->getType();
-  const llvm::Type *Ty = getTypes().ConvertType(ASTTy, D->getLocation());
+  const llvm::Type *Ty = getTypes().ConvertType(ASTTy);
   if (isa<FunctionDecl>(D)) {
     const llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty);
     // FIXME: param attributes for sext/zext etc.

Modified: cfe/cfe/trunk/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenTypes.cpp?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenTypes.cpp Wed Jul 11 11:46:58 2007
@@ -21,7 +21,7 @@
 
 
 /// ConvertType - Convert the specified type to its LLVM form.
-const llvm::Type *CodeGenTypes::ConvertType(QualType T, SourceLocation Loc) {
+const llvm::Type *CodeGenTypes::ConvertType(QualType T) {
   // FIXME: Cache these, move the CodeGenModule, expand, etc.
   const clang::Type &Ty = *T.getCanonicalType();
   
@@ -35,7 +35,7 @@
     case BuiltinType::Char_U:
     case BuiltinType::SChar:
     case BuiltinType::UChar:
-      return llvm::IntegerType::get(Target.getCharWidth(Loc));
+      return llvm::IntegerType::get(Target.getCharWidth(SourceLocation()));
 
     case BuiltinType::Bool:
       // FIXME: This is very strange.  We want scalars to be i1, but in memory
@@ -44,19 +44,19 @@
       
     case BuiltinType::Short:
     case BuiltinType::UShort:
-      return llvm::IntegerType::get(Target.getShortWidth(Loc));
+      return llvm::IntegerType::get(Target.getShortWidth(SourceLocation()));
       
     case BuiltinType::Int:
     case BuiltinType::UInt:
-      return llvm::IntegerType::get(Target.getIntWidth(Loc));
+      return llvm::IntegerType::get(Target.getIntWidth(SourceLocation()));
 
     case BuiltinType::Long:
     case BuiltinType::ULong:
-      return llvm::IntegerType::get(Target.getLongWidth(Loc));
+      return llvm::IntegerType::get(Target.getLongWidth(SourceLocation()));
 
     case BuiltinType::LongLong:
     case BuiltinType::ULongLong:
-      return llvm::IntegerType::get(Target.getLongLongWidth(Loc));
+      return llvm::IntegerType::get(Target.getLongLongWidth(SourceLocation()));
       
     case BuiltinType::Float:      return llvm::Type::FloatTy;
     case BuiltinType::Double:     return llvm::Type::DoubleTy;
@@ -83,11 +83,11 @@
   }
   case Type::Pointer: {
     const PointerType &P = cast<PointerType>(Ty);
-    return llvm::PointerType::get(ConvertType(P.getPointeeType(), Loc));
+    return llvm::PointerType::get(ConvertType(P.getPointeeType())); 
   }
   case Type::Reference: {
     const ReferenceType &R = cast<ReferenceType>(Ty);
-    return llvm::PointerType::get(ConvertType(R.getReferenceeType(), Loc));
+    return llvm::PointerType::get(ConvertType(R.getReferenceeType()));
   }
     
   case Type::Array: {
@@ -98,7 +98,7 @@
     
     llvm::APSInt Size(32);
     if (A.getSize() && A.getSize()->isIntegerConstantExpr(Size)) {
-      const llvm::Type *EltTy = ConvertType(A.getElementType(), Loc);
+      const llvm::Type *EltTy = ConvertType(A.getElementType());
       return llvm::ArrayType::get(EltTy, Size.getZExtValue());
     } else {
       assert(0 && "FIXME: VLAs not implemented yet!");
@@ -112,13 +112,13 @@
     if (FP.getResultType()->isVoidType())
       ResultType = llvm::Type::VoidTy;    // Result of function uses llvm void.
     else
-      ResultType = ConvertType(FP.getResultType(), Loc);
+      ResultType = ConvertType(FP.getResultType());
     
     // FIXME: Convert argument types.
     bool isVarArg;
     std::vector<const llvm::Type*> ArgTys;
     if (const FunctionTypeProto *FTP = dyn_cast<FunctionTypeProto>(&FP)) {
-      DecodeArgumentTypes(*FTP, ArgTys, Loc);
+      DecodeArgumentTypes(*FTP, ArgTys);
       isVarArg = FTP->isVariadic();
     } else {
       isVarArg = true;
@@ -136,10 +136,9 @@
 }
 
 void CodeGenTypes::DecodeArgumentTypes(const FunctionTypeProto &FTP, 
-                                       std::vector<const llvm::Type*> &
-                                       ArgTys, SourceLocation Loc) {
+                                       std::vector<const llvm::Type*> &ArgTys) {
   for (unsigned i = 0, e = FTP.getNumArgs(); i != e; ++i) {
-    const llvm::Type *Ty = ConvertType(FTP.getArgType(i), Loc);
+    const llvm::Type *Ty = ConvertType(FTP.getArgType(i));
     if (Ty->isFirstClassType())
       ArgTys.push_back(Ty);
     else

Modified: cfe/cfe/trunk/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/CodeGen/CodeGenTypes.h?rev=39671&r1=39670&r2=39671&view=diff

==============================================================================
--- cfe/cfe/trunk/CodeGen/CodeGenTypes.h (original)
+++ cfe/cfe/trunk/CodeGen/CodeGenTypes.h Wed Jul 11 11:46:58 2007
@@ -23,7 +23,6 @@
 namespace clang {
   class TargetInfo;
   class QualType;
-  class SourceLocation;
   class FunctionTypeProto;
   
 namespace CodeGen {
@@ -38,10 +37,9 @@
   
   TargetInfo &getTarget() const { return Target; }
   
-  const llvm::Type *ConvertType(QualType T, SourceLocation Loc);
+  const llvm::Type *ConvertType(QualType T);
   void DecodeArgumentTypes(const FunctionTypeProto &FTP, 
-                           std::vector<const llvm::Type*> &ArgTys,
-                           SourceLocation Loc);
+                           std::vector<const llvm::Type*> &ArgTys);
 };
 }  // end namespace CodeGen
 }  // end namespace clang





More information about the cfe-commits mailing list