-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gcc/rust/ChangeLog: * Make-lang.in: Scaffolding new compile-asm files * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise * hir/tree/rust-hir-expr.h: Likewise * backend/rust-compile-asm.cc: New file. Likewise * backend/rust-compile-asm.h: New file. Likewise
- Loading branch information
1 parent
3906eec
commit 2855b64
Showing
5 changed files
with
131 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#include "rust-compile-asm.h" | ||
|
||
#include "rust-tree.h" | ||
#include "rust-system.h" | ||
namespace Rust { | ||
namespace Compile { | ||
|
||
tree | ||
CompileAsm::asm_build_expr (HIR::InlineAsm &expr) | ||
{ | ||
return NULL_TREE; | ||
// return build_asm_expr (CompileAsm::asm_get_locus (expr), | ||
// CompileAsm::asm_construct_string_tree (expr), | ||
// CompileAsm::asm_construct_outputs (expr), | ||
// CompileAsm::asm_construct_inputs (expr), | ||
// CompileAsm::asm_construct_clobber_tree (expr), | ||
// CompileAsm::asm_construct_label_tree (expr), | ||
// CompileAsm::asm_is_simple (expr), | ||
// CompileAsm::asm_is_inline (expr)); | ||
} | ||
|
||
location_t | ||
CompileAsm::asm_get_locus (HIR::InlineAsm &expr) | ||
{ | ||
return expr.get_locus (); | ||
} | ||
tree | ||
CompileAsm::asm_construct_string_tree (HIR::InlineAsm &expr) | ||
{ | ||
if (expr.template_strs.empty ()) | ||
return build_string (1, ""); | ||
// Initialize to NULL_TREE | ||
tree string_chain = NULL_TREE; | ||
|
||
for (const auto &template_str : expr.template_strs) | ||
{ | ||
auto str = template_str.symbol; | ||
auto string_tree = build_string (str.size () + 1, str.c_str ()); | ||
|
||
string_chain = tree_cons (NULL_TREE, string_tree, string_chain); | ||
} | ||
// Reverse the chain before returning | ||
return nreverse (string_chain); | ||
} | ||
tree | ||
CompileAsm::asm_construct_outputs (HIR::InlineAsm &expr) | ||
{ | ||
return NULL_TREE; | ||
} | ||
|
||
tree | ||
CompileAsm::asm_construct_inputs (HIR::InlineAsm &expr) | ||
{ | ||
return NULL_TREE; | ||
} | ||
|
||
tree | ||
CompileAsm::asm_construct_clobber_tree (HIR::InlineAsm &expr) | ||
{ | ||
return NULL_TREE; | ||
} | ||
tree | ||
CompileAsm::asm_construct_label_tree (HIR::InlineAsm &expr) | ||
{ | ||
return NULL_TREE; | ||
} | ||
|
||
bool | ||
CompileAsm::asm_is_simple (HIR::InlineAsm &expr) | ||
{ | ||
return true; | ||
} | ||
|
||
bool | ||
CompileAsm::asm_is_inline (HIR::InlineAsm &expr) | ||
{ | ||
return true; | ||
} | ||
} // namespace Compile | ||
} // namespace Rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
// Copyright (C) 2020-2024 Free Software Foundation, Inc. | ||
|
||
// This file is part of GCC. | ||
|
||
// GCC is free software; you can redistribute it and/or modify it under | ||
// the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 3, or (at your option) any later | ||
// version. | ||
|
||
// GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
// for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with GCC; see the file COPYING3. If not see | ||
// <http://www.gnu.org/licenses/>. | ||
|
||
#ifndef RUST_COMPILE_ASM | ||
#define RUST_COMPILE_ASM | ||
|
||
#include "rust-compile-base.h" | ||
#include "rust-hir-visitor.h" | ||
|
||
namespace Rust { | ||
namespace Compile { | ||
|
||
class CompileAsm | ||
{ | ||
public: | ||
static tree asm_build_expr (HIR::InlineAsm &); | ||
static location_t asm_get_locus (HIR::InlineAsm &); | ||
static tree asm_construct_string_tree (HIR::InlineAsm &); | ||
static tree asm_construct_outputs (HIR::InlineAsm &); | ||
static tree asm_construct_inputs (HIR::InlineAsm &); | ||
static tree asm_construct_clobber_tree (HIR::InlineAsm &); | ||
static tree asm_construct_label_tree (HIR::InlineAsm &); | ||
|
||
static bool asm_is_simple (HIR::InlineAsm &); | ||
|
||
static bool asm_is_inline (HIR::InlineAsm &); | ||
}; | ||
} // namespace Compile | ||
} // namespace Rust | ||
#endif // RUST_COMPILE_ASM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters