Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tilde Requests #14

Open
10 of 28 tasks
gingerBill opened this issue Jul 14, 2023 · 3 comments
Open
10 of 28 tasks

Tilde Requests #14

gingerBill opened this issue Jul 14, 2023 · 3 comments

Comments

@gingerBill
Copy link

gingerBill commented Jul 14, 2023

I will add to this as I go along when I see things which may be missing.

API

  • Any function that takes a const char* also take a length where possible
    • Maybe using your convention of when ptrdiff_t is -1, it's NUL terminated
  • Function Signature ABI handling
    • Documentation
    • Better Abstraction that handles it for you, maybe?
  • f16 type
    • Even if it is just u16 internally or whatever
  • Range bounds on values to improve generation of bounds checks
    • If a pointer-like array has a specific range to it, and an integer is know to have a specific range, then a bounds check may be omitted
  • Minimum alignment of a TB_Node* (useful in some instructions that require an explicit alignment)

Instructions

  • alloca equivalent
  • tb_inst_ptr is missing
  • tb_inst_sint/tb_inst_uint for types >64 bits (e.g. 128-bits)
  • tb_inst_memmove
    • High Priority
  • TB_(SHL|SHR|SAR) with slightly different to C semantics
    • Instead of C-like, I want Odin-like which is defined to have x<<2 == (x<<1)<<1
  • TB_BSWAP work with floats
    • useful for endian specific types and file formats
  • add/sub/mul with overflow check
    • Low priority, and for mul it can be done with TB_MULPAIR
  • add/sub/mul with saturation
    • Extension to TB_ArithmeticBehavior maybe?
    • Very low priority
  • fused multiply add (fma)
    • Very low priority
  • nontemporal stores and loads
    • Low priority
  • Fixed point arithmetic? (I'm not sure about this one)
    • Very low priority
  • Prefetch (read/write data/instruction)
    • Very low priority
  • WASM intrinsics (when WASM is needed)
    • wasm.memory.grow
    • wasm.memory.size
    • wasm.memory.atomic.wait32
    • wasm.memory.atomic.notify
  • tb_inst_memzero helper?
    • Is this even a needed?
TB_API void tb_inst_memzero(TB_Function* f, TB_Node* dst, TB_Node* val, TB_Node* count, TB_CharUnits align, bool is_volatile) {
    tb_inst_memset(f, dst, tb_inst_uint(f, TB_TYPE_I8, 0), count, align, is_volatile);
}

"Intrinsics"

  • cpu_relax
    • pause on amd64
    • isb on arm64
  • x86_cpuid
  • x86_xgetbv
  • Valgrind client request
    • It's just a weird set of instructions that does nothing but Valgrind et al looks for

IR Debugging

  • Linearized Textual IR Printer (not GraphViz)

Debug Information

  • Set column information along with file and line information
  • Ability to set scopes
  • Enum Types
  • Named types

Questions

  • Does tb_inst_set_region_name require that the name passed is in unique to that function or does Tilde handle this?
  • How to get the previous instruction?—i.e. of a region
@RealNeGate
Copy link
Owner

For the questions, currently tb_inst_set_region_name does not require unique names but it will bite you once i make the flattened IR form if you reuse the same name.

If you wanna know the previous "instructions" to a region, you can check the inputs list and it'll tell you all the predecessors, you can do tb_get_parent_region(region->inputs[i]) if you want the top of that predecessor, but the actual inputs[i] is almost always a projection (TB_PROJ) stemming from a branch, you can reach the branch with another ->inputs[0].

@RealNeGate
Copy link
Owner

image

There we go, linearized IR printing. It uses the TB_FuncOpt which is usually is preserved for optimizations but i might rename it because it's really just for analysis/transformations and flattening the IR is a form of analysis.

@gingerBill
Copy link
Author

Feature Request:

  • Debug type for functions
  • From debug type, it can produce the function prototype type for the specified ABI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants