[PATCH] Mangling for intrinsic names w/function type parameters

Juergen Ributzka juergen at apple.com
Thu Oct 9 14:52:08 PDT 2014


Just a few coding style nitpicks. Otherwise LGTM.

================
Comment at: lib/IR/Function.cpp:427-433
@@ +426,9 @@
+  std::string Result;
+  if (PointerType* PTyp = dyn_cast<PointerType>(Ty) ) {
+    Result += "p" + llvm::utostr(PTyp->getAddressSpace()) +
+      getTypeMunge(PTyp->getElementType());
+  } else if( ArrayType* ATyp = dyn_cast<ArrayType>(Ty) ) {
+    Result += "a" + llvm::utostr(ATyp->getNumElements()) +
+      getTypeMunge(ATyp->getElementType());
+  } else if( StructType* ST = dyn_cast<StructType>(Ty) ) {
+    if( !ST->isLiteral() ) {
----------------
No {} needed

================
Comment at: lib/IR/Function.cpp:451-453
@@ +450,5 @@
+    }
+    if( FT->isVarArg() ) {
+      Result += "vararg";
+    }
+    Result += "f"; //ensure distinguishable
----------------
No {} needed

================
Comment at: lib/IR/Function.cpp:460
@@ +459,3 @@
+  } else {
+    // ??? Is this possible?
+  }
----------------
assert or llvm_unreachable?

================
Comment at: lib/IR/Function.cpp:683
@@ -644,1 +682,3 @@
+                             ArrayRef<Type*> Tys, LLVMContext &Context,
+                             bool& isVarArg) {
   using namespace Intrinsic;
----------------
isVarArg -> IsVarArg

================
Comment at: lib/IR/Function.cpp:694
@@ -651,1 +693,3 @@
+    isVarArg = true;
+    return NULL;
   case IITDescriptor::MMX: return Type::getX86_MMXTy(Context);
----------------
nullptr ;-)

================
Comment at: lib/IR/Function.cpp:744
@@ +743,3 @@
+                             ArrayRef<Type*> Tys, LLVMContext &Context) {
+  bool isVarArg = false;
+  Type* Ty = DecodeFixedType(Infos, Tys, Context, isVarArg);
----------------
ditto

================
Comment at: lib/IR/Function.cpp:764-766
@@ +763,5 @@
+    Type* Ty = DecodeFixedType(TableRef, Tys, Context, isVarArg);
+    if( Ty ) {
+      ArgTys.push_back(Ty);
+    } else if( isVarArg ) {
+      assert( TableRef.empty() && "var arg must be last" );
----------------
No {} needed

================
Comment at: lib/IR/Function.cpp:769-771
@@ +768,5 @@
+      break;
+    } else {
+      llvm_unreachable("Type must be non-null unless isVarArg");
+    }
+  }
----------------
ditto

http://reviews.llvm.org/D4608






More information about the llvm-commits mailing list