[PATCH] D46746: [RISCV] Fix builtin fixup sizes

Simon Cook via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 11 04:28:12 PDT 2018


simoncook created this revision.
simoncook added reviewers: asb, apazos, edward-jones.
Herald added subscribers: llvm-commits, mgrang, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, jordy.potman.lists, johnrusso, rbar.

This adds the FK_Data_* fixup types to the size evaluation to return the correct size of each of these, rather than the default of 4. This allows applyFixup to correctly update the value of data without walking outside the bounds of the fixup (in the case of FK_Data_1 and FK_Data 2), or truncating the value being set (as in the case of FK_Data_8).


Repository:
  rL LLVM

https://reviews.llvm.org/D46746

Files:
  lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp


Index: lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
===================================================================
--- lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
+++ lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
@@ -274,6 +274,14 @@
   switch (Kind) {
   default:
     return 4;
+  case FK_Data_1:
+    return 1;
+  case FK_Data_2:
+    return 2;
+  case FK_Data_4:
+    return 4;
+  case FK_Data_8:
+    return 8;
   case RISCV::fixup_riscv_rvc_jump:
   case RISCV::fixup_riscv_rvc_branch:
     return 2;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46746.146300.patch
Type: text/x-patch
Size: 527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180511/3a558c5c/attachment.bin>


More information about the llvm-commits mailing list