@@ -52,11 +52,11 @@ enum OpCode {
5252};
5353
5454enum OperandKind {
55- Constant = 0 ,
56- LocalVariable ,
57- Global ,
58- Function ,
59- Arg ,
55+ OperandKindConstant = 0 ,
56+ OperandKindLocal ,
57+ OperandKindGlobal ,
58+ OperandKindFunction ,
59+ OperandKindArg ,
6060};
6161
6262enum TypeKind {
@@ -190,8 +190,8 @@ class YkIRWriter {
190190
191191 // Return the index of the LLVM constant `C`, inserting a new entry if
192192 // necessary.
193- size_t constantIndex (class Constant *C) {
194- vector<class Constant *>::iterator Found =
193+ size_t constantIndex (Constant *C) {
194+ vector<Constant *>::iterator Found =
195195 std::find (Constants.begin (), Constants.end (), C);
196196 if (Found != Constants.end ()) {
197197 return std::distance (Constants.begin (), Found);
@@ -228,20 +228,22 @@ class YkIRWriter {
228228
229229 void serialiseOpcode (OpCode Code) { OutStreamer.emitInt8 (Code); }
230230
231+ void serialiseOperandKind (OperandKind Kind) { OutStreamer.emitInt8 (Kind); }
232+
231233 void serialiseConstantOperand (Instruction *Parent, llvm::Constant *C) {
232- OutStreamer. emitInt8 (OperandKind::Constant );
234+ serialiseOperandKind (OperandKindConstant );
233235 OutStreamer.emitSizeT (constantIndex (C));
234236 }
235237
236238 void serialiseLocalVariableOperand (Instruction *I, ValueLoweringMap &VLMap) {
237239 auto [BBIdx, InstIdx] = VLMap.at (I);
238- OutStreamer. emitInt8 (OperandKind::LocalVariable );
240+ serialiseOperandKind (OperandKindLocal );
239241 OutStreamer.emitSizeT (BBIdx);
240242 OutStreamer.emitSizeT (InstIdx);
241243 }
242244
243245 void serialiseFunctionOperand (llvm::Function *F) {
244- OutStreamer. emitInt8 (OperandKind::Function );
246+ serialiseOperandKind (OperandKindFunction );
245247 OutStreamer.emitSizeT (functionIndex (F));
246248 }
247249
@@ -254,15 +256,15 @@ class YkIRWriter {
254256 // This assumes that the argument indices match in both IRs.
255257
256258 // opcode:
257- OutStreamer. emitInt8 (OperandKind::Arg );
259+ serialiseOperandKind (OperandKindArg );
258260 // parent function index:
259261 OutStreamer.emitSizeT (getIndex (&M, A->getParent ()));
260262 // arg index
261263 OutStreamer.emitSizeT (A->getArgNo ());
262264 }
263265
264266 void serialiseGlobalOperand (GlobalVariable *G) {
265- OutStreamer. emitInt8 (OperandKind::Global );
267+ serialiseOperandKind (OperandKindGlobal );
266268 OutStreamer.emitSizeT (globalIndex (G));
267269 }
268270
@@ -772,15 +774,15 @@ class YkIRWriter {
772774 }
773775 }
774776
775- void serialiseUnimplementedConstant (class Constant *C) {
777+ void serialiseUnimplementedConstant (Constant *C) {
776778 // type_index:
777779 OutStreamer.emitSizeT (typeIndex (C->getType ()));
778780 // num_bytes:
779781 // Just report zero for now.
780782 OutStreamer.emitSizeT (0 );
781783 }
782784
783- void serialiseConstant (class Constant *C) {
785+ void serialiseConstant (Constant *C) {
784786 if (ConstantInt *CI = dyn_cast<ConstantInt>(C)) {
785787 serialiseConstantInt (CI);
786788 } else {
@@ -820,7 +822,7 @@ class YkIRWriter {
820822 // num_constants:
821823 OutStreamer.emitSizeT (Constants.size ());
822824 // constants:
823- for (class Constant *&C : Constants) {
825+ for (Constant *&C : Constants) {
824826 serialiseConstant (C);
825827 }
826828
0 commit comments