Skip to content

Commit

Permalink
Merge pull request #214 from vext01/fneg
Browse files Browse the repository at this point in the history
Serialise `fneg` instructions.
  • Loading branch information
ltratt authored Nov 11, 2024
2 parents 84b7e91 + cf38d97 commit ce98289
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions llvm/lib/YkIR/YkIRWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ enum OpCode {
OpCodeLoadArg,
OpCodeFCmp,
OpCodePromote,
OpCodeFNeg,
OpCodeUnimplemented = 255, // YKFIXME: Will eventually be deleted.
};

Expand Down Expand Up @@ -1382,6 +1383,21 @@ class YkIRWriter {
InstIdx++;
}

void serialiseUnaryOperatorInst(UnaryOperator *I, FuncLowerCtxt &FLCtxt,
unsigned BBIdx, unsigned &InstIdx) {
if (I->getOpcode() == UnaryOperator::UnaryOps::FNeg) {
// opcode:
serialiseOpcode(OpCodeFNeg);
// value:
serialiseOperand(I, FLCtxt, I->getOperand(0));

FLCtxt.updateVLMap(I, InstIdx);
InstIdx++;
} else {
serialiseUnimplementedInstruction(I, FLCtxt, BBIdx, InstIdx);
}
}

size_t getPathIndex(string Path) {
vector<string>::iterator It = std::find(Paths.begin(), Paths.end(), Path);
if (It != Paths.end()) {
Expand Down Expand Up @@ -1463,6 +1479,7 @@ class YkIRWriter {
INST_SERIALISE(I, StoreInst, serialiseStoreInst);
INST_SERIALISE(I, SwitchInst, serialiseSwitchInst);
INST_SERIALISE(I, SelectInst, serialiseSelectInst);
INST_SERIALISE(I, UnaryOperator, serialiseUnaryOperatorInst);

// INST_SERIALISE does an early return upon a match, so if we get here then
// the instruction wasn't handled.
Expand Down

0 comments on commit ce98289

Please sign in to comment.