Skip to content

Commit

Permalink
cg: Remove obsolete type conversions from the driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Nov 16, 2023
1 parent a25e0b6 commit a4c689a
Show file tree
Hide file tree
Showing 25 changed files with 37 additions and 1,678 deletions.
87 changes: 0 additions & 87 deletions include/vast/CodeGen/ABIInfo.hpp

This file was deleted.

81 changes: 0 additions & 81 deletions include/vast/CodeGen/ArgInfo.hpp

This file was deleted.

79 changes: 0 additions & 79 deletions include/vast/CodeGen/CXXABI.hpp

This file was deleted.

29 changes: 0 additions & 29 deletions include/vast/CodeGen/CallingConv.hpp

This file was deleted.

58 changes: 26 additions & 32 deletions include/vast/CodeGen/CodeGen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace vast::cg

// FIXME: Remove from driver whan we obliterate function type convertion
// from driver
mlir_type convert(qual_type type) {
mlir_type convert(clang::QualType type) {
return this->Visit(type);
}
mlir_type make_lvalue(mlir_type type) {
Expand All @@ -105,10 +105,6 @@ namespace vast::cg
return hl::LValueType::get(&mcontext(), type);
}

void update_completed_type(clang::TagDecl *decl) {
VAST_UNIMPLEMENTED;
}

auto insert_at_end(hl::FuncOp fn) {
auto guard = this->insertion_guard();
this->set_insertion_point_to_end(&fn.getBody());
Expand All @@ -123,8 +119,6 @@ namespace vast::cg
void start_function(
clang::GlobalDecl glob,
hl::FuncOp fn,
const function_info_t &fty_info,
const function_arg_list &args,
loc_t loc,
const cc::action_options &opts
) {
Expand Down Expand Up @@ -269,40 +263,41 @@ namespace vast::cg

// TODO: this should live in `build_function_prolog`
// Declare all the function arguments in the symbol table.
for (const auto [ast_param, mlir_param] : llvm::zip(args, entry_block.getArguments())) {
auto params = llvm::zip(function_decl->parameters(), entry_block.getArguments());
for (const auto &[arg, earg] : params) {
// TODO set alignment
// TODO set name
mlir_param.setLoc(meta_location(ast_param));
this->ctx.declare(ast_param, mlir_value(mlir_param));
earg.setLoc(meta_location(arg));
this->ctx.declare(arg, mlir_value(earg));
}

}

if (decl && clang::isa< clang::CXXMethodDecl>(decl) &&
clang::cast< clang::CXXMethodDecl>(decl)->isInstance()
if (decl && clang::isa< clang::CXXMethodDecl >(decl) &&
clang::cast< clang::CXXMethodDecl >(decl)->isInstance()
) {
VAST_UNIMPLEMENTED_MSG( "emit prologue of cxx methods" );
}

// If any of the arguments have a variably modified type, make sure to emit
// the type size.
for (auto arg : args) {
const clang::VarDecl *var_decl = arg;

// Dig out the type as written from ParmVarDecls; it's unclear whether the
// standard (C99 6.9.1p10) requires this, but we're following the
// precedent set by gcc.
auto type = [&] {
if (const auto *parm_var_decl = dyn_cast< clang::ParmVarDecl >(var_decl)) {
return parm_var_decl->getOriginalType();
}
return var_decl->getType();
} ();

if (type->isVariablyModifiedType()) {
VAST_UNIMPLEMENTED;
}
}
// for (auto arg : args) {
// const clang::VarDecl *var_decl = arg;

// // Dig out the type as written from ParmVarDecls; it's unclear whether the
// // standard (C99 6.9.1p10) requires this, but we're following the
// // precedent set by gcc.
// auto type = [&] {
// if (const auto *parm_var_decl = dyn_cast< clang::ParmVarDecl >(var_decl)) {
// return parm_var_decl->getOriginalType();
// }
// return var_decl->getType();
// } ();

// if (type->isVariablyModifiedType()) {
// VAST_UNIMPLEMENTED;
// }
// }

// Emit a location at the end of the prologue.
if (get_debug_info()) {
Expand Down Expand Up @@ -353,8 +348,7 @@ namespace vast::cg
}

hl::FuncOp emit_function_prologue(
hl::FuncOp fn, clang::GlobalDecl decl, const function_info_t &fty_info,
function_arg_list args, const cc::action_options &options
hl::FuncOp fn, clang::GlobalDecl decl, const cc::action_options &options
) {
VAST_CHECK(fn, "generating code for a null function");
const auto function_decl = clang::cast< clang::FunctionDecl >(decl.getDecl());
Expand Down Expand Up @@ -434,7 +428,7 @@ namespace vast::cg
lexical_scope_guard scope_guard{*this, &lex_ccope};

// Emit the standard function prologue.
start_function(decl, fn, fty_info, args, loc, options);
start_function(decl, fn, loc, options);

for (const auto lab : filter< clang::LabelDecl >(function_decl->decls())) {
this->Visit(lab);
Expand Down
1 change: 0 additions & 1 deletion include/vast/CodeGen/CodeGenAttrVisitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ VAST_RELAX_WARNINGS
VAST_UNRELAX_WARNINGS

#include <mlir/IR/Attributes.h>
#include <vast/CodeGen/Types.hpp>
#include <vast/CodeGen/CodeGenVisitorLens.hpp>
#include <vast/CodeGen/CodeGenBuilder.hpp>

Expand Down
Loading

0 comments on commit a4c689a

Please sign in to comment.