[PATCH] Implement intrinsics memset, memcopy and memmove in Mips fast-isel

Daniel Sanders daniel.sanders at imgtec.com
Tue May 12 09:31:10 PDT 2015


================
Comment at: lib/Target/Mips/MipsFastISel.cpp:505-506
@@ +504,4 @@
+    // Look past bitcasts if its operand is in the same BB.
+    if (InMBB)
+      return computeCallAddress(U->getOperand(0), Addr);
+    break;
----------------
Given that InMBB only makes sense when V is an Instruction, why don't we test it on line 494?

================
Comment at: lib/Target/Mips/MipsFastISel.cpp:1312-1320
@@ -1261,7 +1311,11 @@
   // Issue the call.
-  unsigned DestAddress = materializeGV(Addr.getGlobalValue(), MVT::i32);
+  unsigned DestAddress;
+  if (SymName)
+    DestAddress = materializeExternalCallSym(SymName);
+  else
+    DestAddress = materializeGV(Addr.getGlobalValue(), MVT::i32);
   emitInst(TargetOpcode::COPY, Mips::T9).addReg(DestAddress);
   MachineInstrBuilder MIB =
       BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(Mips::JALR),
               Mips::RA).addReg(Mips::T9);
 
----------------
Not required for this patch but we shouldn't be using JALR for the majority of calls

================
Comment at: test/CodeGen/Mips/Fast-ISel/memtest1.ll:17
@@ +16,3 @@
+  call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([50 x i8]* @dest, i32 0, i32 0), i8* %0, i32 %1, i32 1, i1 false)
+; CHECK: 	lw	${{[0-9]+}}, %got(memcpy)(${{[0-9]+}})
+  ret void
----------------
Should also check the jalr, the arguments and the return.

Likewise for mov(), and clear() below

================
Comment at: test/CodeGen/Mips/Fast-ISel/memtest1.ll:52-60
@@ +51,10 @@
+declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #1
+
+attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind }
+
+!llvm.module.flags = !{!0}
+!llvm.ident = !{!1}
+
+!0 = !{i32 1, !"PIC Level", i32 2}
+!1 = !{!"clang version 3.7.0 (gitosis at dmz-portal.mips.com:clang.git 7646e9bd27a2569f650fb7f9ff81e03e5d8d4112) (gitosis at dmz-portal.mips.com:llvm.git 2f0ec9b0177e6d3922bf3cf9002fc92a09ef613f)"}
----------------
Nit: Unnecessary.

http://reviews.llvm.org/D7158

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list