Skip to content

Commit 3c79b79

Browse files
committed
Lower zext instructions.
1 parent 0c1f0d1 commit 3c79b79

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

llvm/lib/YkIR/YkIRWriter.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ enum TypeKind {
7777

7878
enum CastKind {
7979
CastKindSignExt = 0,
80+
CastKindZeroExt = 1,
8081
};
8182

8283
// A predicate used in a numeric comparison.
@@ -828,7 +829,7 @@ class YkIRWriter {
828829

829830
void serialiseCastKind(enum CastKind Cast) { OutStreamer.emitInt8(Cast); }
830831

831-
/// Serialise a cast-like insruction.
832+
/// Serialise a cast-like instruction.
832833
void serialiseSExtInst(SExtInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
833834
unsigned &InstIdx) {
834835
// opcode:
@@ -844,6 +845,22 @@ class YkIRWriter {
844845
InstIdx++;
845846
}
846847

848+
/// Serialise a cast-like instruction.
849+
void serialiseZExtInst(ZExtInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
850+
unsigned &InstIdx) {
851+
// opcode:
852+
serialiseOpcode(OpCodeCast);
853+
// cast_kind:
854+
serialiseCastKind(CastKindZeroExt);
855+
// val:
856+
serialiseOperand(I, FLCtxt, I->getOperand(0));
857+
// dest_type_idx:
858+
OutStreamer.emitSizeT(typeIndex(I->getDestTy()));
859+
860+
FLCtxt.updateVLMap(I, InstIdx);
861+
InstIdx++;
862+
}
863+
847864
void serialiseSwitchInst(SwitchInst *I, FuncLowerCtxt &FLCtxt, unsigned BBIdx,
848865
unsigned &InstIdx) {
849866
// opcode:
@@ -910,6 +927,7 @@ class YkIRWriter {
910927
INST_SERIALISE(I, LoadInst, serialiseLoadInst);
911928
INST_SERIALISE(I, PHINode, serialisePhiInst);
912929
INST_SERIALISE(I, ReturnInst, serialiseReturnInst);
930+
INST_SERIALISE(I, ZExtInst, serialiseZExtInst);
913931
INST_SERIALISE(I, SExtInst, serialiseSExtInst);
914932
INST_SERIALISE(I, StoreInst, serialiseStoreInst);
915933
INST_SERIALISE(I, SwitchInst, serialiseSwitchInst);

0 commit comments

Comments
 (0)