[PATCH] D37262: The issues with X86 prefixes: step 2

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 4 10:19:57 PDT 2017


RKSimon added inline comments.


================
Comment at: lib/Target/X86/Disassembler/X86Disassembler.cpp:242
+        if (InternalInstr.hasOpSize)
+          Flags = 1;
+        if (InternalInstr.repeatPrefix == 0xf2)
----------------
Flags |= 1 ?


================
Comment at: lib/Target/X86/Disassembler/X86Disassembler.cpp:250
+      }
+      Instr.setFlags(Flags);
+    }
----------------
These hard coded values for the flag bits are going to be tricky to maintain. Perhaps an enum ?
```
enum OpPrefixFlag {
  OPF_OpSize = 1,
  OPF_AdSize = 2,
  OPF_REP = 4,
  OPF_REP = 8,
};

void clearFlags() { Flags = 0; }
void setFlag(OpPrefixFlag F) { Flags |= (unsigned)F; }
bool isFlagSet(OpPrefixFlag F) const { return !!(Flags & (unsigned)F); }
```


https://reviews.llvm.org/D37262





More information about the llvm-commits mailing list