move to llvm 9

- comp_ctx: add VariableMetadata.llvm_alloca
 - comp_ctx: make VariableMetadataMap use ptrs to VariableMetadata
This commit is contained in:
Luna 2019-09-28 20:40:07 -03:00
parent 9869cca2ae
commit ea4dd5fde4
2 changed files with 7 additions and 3 deletions

View file

@ -7,7 +7,7 @@ pub fn build(b: *Builder) void {
exe.install();
exe.linkSystemLibrary("c");
exe.linkSystemLibrary("LLVM-8");
exe.linkSystemLibrary("LLVM-9");
exe.linkSystemLibrary("stdc++");
const run_cmd = exe.run();

View file

@ -139,6 +139,7 @@ const Using = enum {
pub const VariableMetadata = struct {
typ: SymbolUnderlyingType,
llvm_alloca: llvm.LLVMValueRef = null,
using: Using,
@ -155,7 +156,7 @@ pub const VariableMetadata = struct {
};
// TODO rm const?
pub const VariableMetadataMap = std.AutoHashMap(*const ast.Expr, VariableMetadata);
pub const VariableMetadataMap = std.AutoHashMap(*const ast.Expr, *VariableMetadata);
/// Represents the context for a full compiler run.
/// This is used to manage the symbol table for the compilation unit, etc.
@ -380,7 +381,10 @@ pub const CompilationContext = struct {
}
pub fn insertMetadata(self: *@This(), ptr: *const ast.Expr, metadata: VariableMetadata) !void {
var meta = try self.allocator.create(VariableMetadata);
meta.* = metadata;
std.debug.assert(ast.ExprType(ptr.*) == .Variable);
_ = try self.metadata_map.put(ptr, metadata);
_ = try self.metadata_map.put(ptr, meta);
}
};