| 1 |
// Copyright (C) 2020-2024 Free Software Foundation, Inc. |
| 2 |
|
| 3 |
// This file is part of GCC. |
| 4 |
|
| 5 |
// GCC is free software; you can redistribute it and/or modify it under |
| 6 |
// the terms of the GNU General Public License as published by the Free |
| 7 |
// Software Foundation; either version 3, or (at your option) any later |
| 8 |
// version. |
| 9 |
|
| 10 |
// GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 11 |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 13 |
// for more details. |
| 14 |
|
| 15 |
// You should have received a copy of the GNU General Public License |
| 16 |
// along with GCC; see the file COPYING3. If not see |
| 17 |
// <http://www.gnu.org/licenses/>. |
| 18 |
|
| 19 |
#ifndef RUST_COMPILE_ASM |
| 20 |
#define RUST_COMPILE_ASM |
| 21 |
|
| 22 |
#include "rust-compile-base.h" |
| 23 |
#include "rust-hir-visitor.h" |
| 24 |
|
| 25 |
namespace Rust { |
| 26 |
namespace Compile { |
| 27 |
|
| 28 |
class CompileAsm : private HIRCompileBase |
| 29 |
{ |
| 30 |
private: |
| 31 |
// RELEVANT MEMBER FUNCTIONS |
| 32 |
|
| 33 |
// The limit is 5 because it stands for the 5 things that the C version of |
| 34 |
// build_asm_expr accepts: string, output, input, clobber and label. |
| 35 |
// The function signature is |
| 36 |
// |
| 37 |
// tree |
| 38 |
// build_asm_expr (location_t loc, tree string, tree outputs, tree inputs, |
| 39 |
// tree clobbers, tree labels, bool simple, bool is_inline) |
| 40 |
static const int ASM_TREE_ARRAY_LENGTH = 5; |
| 41 |
tree asm_build_stmt (location_t, |
| 42 |
const std::array<tree, ASM_TREE_ARRAY_LENGTH> &); |
| 43 |
|
| 44 |
tree asm_construct_string_tree (HIR::InlineAsm &); |
| 45 |
tree asm_construct_outputs (HIR::InlineAsm &); |
| 46 |
tree asm_construct_inputs (HIR::InlineAsm &); |
| 47 |
tree asm_construct_clobber_tree (HIR::InlineAsm &); |
| 48 |
tree asm_construct_label_tree (HIR::InlineAsm &); |
| 49 |
|
| 50 |
public: |
| 51 |
// WE WILL OPEN THIS UP WHEN WE WANT TO ADD A DEDICATED PASS OF HIR'S ASM |
| 52 |
// translation. |
| 53 |
// static tree Compile (HIR::Expr *expr, Context *ctx); |
| 54 |
|
| 55 |
CompileAsm (Context *ctx); |
| 56 |
|
| 57 |
tree tree_codegen_asm (HIR::InlineAsm &); |
| 58 |
}; |
| 59 |
} // namespace Compile |
| 60 |
} // namespace Rust |
| 61 |
#endif // RUST_COMPILE_ASM |