[libc][automemcpy] fix build after change in Arg enum
authorGuillaume Chatelet <gchatelet@google.com>
Thu, 20 Oct 2022 11:58:54 +0000 (11:58 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Thu, 20 Oct 2022 11:59:19 +0000 (11:59 +0000)
libc/benchmarks/automemcpy/lib/CodeGen.cpp

index 2ada57a..cf196b1 100644 (file)
@@ -117,8 +117,6 @@ struct Context {
   StringRef ElementOp; // copy, three_way_compare, splat_set, ...
   StringRef FixedSizeArgs;
   StringRef RuntimeSizeArgs;
-  StringRef AlignArg1;
-  StringRef AlignArg2;
   StringRef DefaultReturnValue;
 };
 // A detailed representation of the function implementation mapped from the
@@ -143,8 +141,6 @@ static Context getCtx(FunctionType FT) {
             "copy",
             "(dst, src)",
             "(dst, src, size)",
-            "Arg::Dst",
-            "Arg::Src",
             ""};
   case FunctionType::MEMCMP:
     return {"int",
@@ -152,8 +148,6 @@ static Context getCtx(FunctionType FT) {
             "three_way_compare",
             "(lhs, rhs)",
             "(lhs, rhs, size)",
-            "Arg::Lhs",
-            "Arg::Rhs",
             "0"};
   case FunctionType::MEMSET:
     return {"void",
@@ -161,25 +155,22 @@ static Context getCtx(FunctionType FT) {
             "splat_set",
             "(dst, value)",
             "(dst, value, size)",
-            "Arg::Dst",
-            "Arg::Src",
             ""};
   case FunctionType::BZERO:
     return {"void",           "(char * dst, size_t size)",
             "splat_set",      "(dst, 0)",
-            "(dst, 0, size)", "Arg::Dst",
-            "Arg::Src",       ""};
+            "(dst, 0, size)", ""};
   default:
     report_fatal_error("Not yet implemented");
   }
 }
 
-static StringRef getAligntoString(const Context &Ctx, const AlignArg &AlignTo) {
+static StringRef getAligntoString(const AlignArg &AlignTo) {
   switch (AlignTo) {
   case AlignArg::_1:
-    return Ctx.AlignArg1;
+    return "Arg::P1";
   case AlignArg::_2:
-    return Ctx.AlignArg2;
+    return "Arg::P2";
   case AlignArg::ARRAY_SIZE:
     report_fatal_error("logic error");
   }
@@ -295,9 +286,9 @@ getImplementation(const NamedFunctionDescriptor &NamedFD) {
   if (const auto &L = FD.Loop)
     Impl.Loop = Loop{L->Span.End, ElementType{L->BlockSize}};
   if (const auto &AL = FD.AlignedLoop)
-    Impl.AlignedLoop = AlignedLoop{
-        AL->Loop.Span.End, ElementType{AL->Loop.BlockSize},
-        ElementType{AL->Alignment}, getAligntoString(Impl.Ctx, AL->AlignTo)};
+    Impl.AlignedLoop =
+        AlignedLoop{AL->Loop.Span.End, ElementType{AL->Loop.BlockSize},
+                    ElementType{AL->Alignment}, getAligntoString(AL->AlignTo)};
   if (const auto &A = FD.Accelerator)
     Impl.Accelerator = Accelerator{A->Span.End};
   return Impl;