Skip to content

Commit

Permalink
Revert "C backend: Support struct bitcasts."
Browse files Browse the repository at this point in the history
This reverts commit d7782f5.
Not needed after all; also, I forgot I didn't want to support this.
  • Loading branch information
FeepingCreature committed Jul 24, 2023
1 parent 53d1326 commit a656dfa
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/backend/c.nt
Original file line number Diff line number Diff line change
Expand Up @@ -656,19 +656,12 @@ class CBackendFunction : BackendFunction {
}
}
(:bitCast, int from, BackendType to): {
auto ssaInstr = this.instrs[from];
bool fake = ssaInstr.mode == SSAMode.held && ssaInstr.heldValue.fake;
if (fake) ret = Value.none;
else if (to.instanceOf(BackendStructType)) {
flushRegs; // put 'from' into a variable
string toFmt = typeFmt(mod, to);
string newVal = "*($toFmt*) &reg$from";
ret = Value(toFmt, newVal, exactType=true);
} else {
auto fromExt = regExt(from);
auto from = regExt(from);
if (from.fake) ret = Value.none;
else {
string typestr = typeFmt(mod, to);

ret = Value(typestr, fromExt.value, exactType=false);
ret = Value(typestr, from.value, exactType=false);
}
}
(:zeroExtend, int value, BackendType to): {
Expand Down

0 comments on commit a656dfa

Please sign in to comment.