This patch adds the initial support required to support basic priting in `stdio.h` via `puts` and `fputs`. This is done using the existing LLVM C library `File` API. In this sense we can think of the RPC interface as our system call to dump the character string to the file. We carry a `uintptr_t` reference as our native "file descriptor" as it will be used as an opaque reference to the host's version once functions like `fopen` are supported. For some unknown reason the declaration of the `StdIn` variable causes both the AMDGPU and NVPTX backends to crash if I use the `READ` flag. This is not used currently as we only support output now, but it needs to be fixed Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D151282
29 lines
526 B
TableGen
29 lines
526 B
TableGen
include "config/public_api.td"
|
|
|
|
include "spec/stdc.td"
|
|
|
|
def StringAPI : PublicAPI<"string.h"> {
|
|
let Types = ["size_t"];
|
|
}
|
|
|
|
def StdlibAPI : PublicAPI<"stdlib.h"> {
|
|
let Types = [
|
|
"size_t",
|
|
"__atexithandler_t",
|
|
];
|
|
}
|
|
|
|
def FenvAPI: PublicAPI<"fenv.h"> {
|
|
let Types = ["fenv_t"];
|
|
}
|
|
|
|
def StdIOAPI : PublicAPI<"stdio.h"> {
|
|
let Macros = [
|
|
SimpleMacroDef<"_IOFBF", "0">,
|
|
SimpleMacroDef<"_IOLBF", "1">,
|
|
SimpleMacroDef<"_IONBF", "2">,
|
|
SimpleMacroDef<"EOF", "-1">,
|
|
];
|
|
let Types = ["size_t", "FILE"];
|
|
}
|