Skip to content

Commit

Permalink
Typed binary operators (#23)
Browse files Browse the repository at this point in the history
* Implement typed expression stack

* Typed negate

* Start work on FileCheck based code generation tests
  • Loading branch information
wpmed92 authored Aug 22, 2024
1 parent 5a0cb1b commit 9f7e3cf
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 113 deletions.
7 changes: 4 additions & 3 deletions include/CodeGen/MLIRCodeGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "llvm/ADT/ScopedHashTable.h"
#include <vector>
#include <map>
#include <utility>

using namespace mlir;

Expand All @@ -35,7 +36,7 @@ class MLIRCodeGen : public ASTVisitor {
public:
MLIRCodeGen();
void initModuleOp();
void dump();
void print();
bool verify();
void visit(TranslationUnit *) override;
void visit(BinaryExpression *) override;
Expand Down Expand Up @@ -80,7 +81,7 @@ class MLIRCodeGen : public ASTVisitor {
bool inGlobalScope = true;
llvm::StringMap<spirv::FuncOp> functionMap;
llvm::StringMap<StructDeclaration*> structDeclarations;
std::vector<Value> expressionStack;
std::vector<std::pair<Type*, Value>> expressionStack;
StructDeclaration* currentBaseComposite = nullptr;

llvm::ScopedHashTable<llvm::StringRef, SymbolTableEntry>
Expand All @@ -95,7 +96,7 @@ class MLIRCodeGen : public ASTVisitor {
void createVariable(shaderpulse::Type *, VariableDeclaration *);
void insertEntryPoint();

mlir::Value popExpressionStack();
std::pair<Type*, Value> popExpressionStack();
mlir::Value currentBasePointer;
Type* typeContext;
};
Expand Down
Loading

0 comments on commit 9f7e3cf

Please sign in to comment.