Compare commits

..

No commits in common. "cf5f58f1bc155654aa5af725991f4318a1e5d781" and "83959b47935717133e3ef5ff54ba3705970c4e67" have entirely different histories.

2 changed files with 6 additions and 5 deletions

View File

@ -463,11 +463,13 @@ int AsStrDeref(int Register1, int Register2, int Type) {
printf("\tStoring contents of %s into %s through a dereference, type %d\n", Registers[Register1], Registers[Register2], Type); printf("\tStoring contents of %s into %s through a dereference, type %d\n", Registers[Register1], Registers[Register2], Type);
switch(Type) { switch(Type) {
case RET_CHAR: case PTR_CHAR:
fprintf(OutputFile, "\tmovb\t%s, (%s)\n", ByteRegisters[Register1], Registers[Register2]); fprintf(OutputFile, "\tmovb\t%s, (%s)\n", ByteRegisters[Register1], Registers[Register2]);
break; break;
case RET_INT: case PTR_INT:
case RET_LONG: fprintf(OutputFile, "\tmovq\t%s, (%s)\n", Registers[Register1], Registers[Register2]);
break;
case PTR_LONG:
fprintf(OutputFile, "\tmovq\t%s, (%s)\n", Registers[Register1], Registers[Register2]); fprintf(OutputFile, "\tmovq\t%s, (%s)\n", Registers[Register1], Registers[Register2]);
break; break;
default: default:

View File

@ -29,7 +29,6 @@ int ValueAt(int Type) {
printf("\t\tDereferencing a %s\n", TypeNames[Type]); printf("\t\tDereferencing a %s\n", TypeNames[Type]);
//TODO: this is still bullshittery! //TODO: this is still bullshittery!
if(Type >= PTR_CHAR && Type <= PTR_VOID) { if(Type >= PTR_CHAR && Type <= PTR_VOID) {
printf("\t\t\tDereference of %s is %s.\r\n", TypeNames[Type], TypeNames[Type - 4]);
return Type - 4; return Type - 4;
} else { } else {
DieDecimal("Unable to dereference type", Type); DieDecimal("Unable to dereference type", Type);
@ -90,7 +89,7 @@ struct ASTNode* AccessArray() {
RightNode = MutateType(RightNode, LeftNode->ExprType, OP_ADD); RightNode = MutateType(RightNode, LeftNode->ExprType, OP_ADD);
LeftNode = ConstructASTNode(OP_ADD, Symbols[ID].Type, LeftNode, NULL, RightNode, 0); LeftNode = ConstructASTNode(OP_ADD, Symbols[ID].Type, LeftNode, NULL, RightNode, 0);
printf("\tAccessArray: Preparing LeftNode for dereference.\r\n"); printf("\t\t\tAccessArray: Preparing LeftNode for dereference.\r\n");
LeftNode = ConstructASTBranch(OP_DEREF, ValueAt(LeftNode->ExprType), LeftNode, 0); LeftNode = ConstructASTBranch(OP_DEREF, ValueAt(LeftNode->ExprType), LeftNode, 0);
printf("\tArray Access constructed\r\n"); printf("\tArray Access constructed\r\n");
return LeftNode; return LeftNode;