Skip to content

Tilde Requests #14

Open
Open

Description

@gingerBill

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

Activity

  1. RealNeGate commented on Jul 14, 2023

    @RealNeGate
    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].

  2. RealNeGate commented on Jul 15, 2023

    @RealNeGate
    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.

  3. gingerBill commented on Jul 15, 2023

    @gingerBill
    Author

    Feature Request:

    • Debug type for functions
    • From debug type, it can produce the function prototype type for the specified ABI.
  4. ngortheone commented on Oct 10, 2024

    @ngortheone

    @gingerBill @RealNeGate I have a crazy off-topic idea/question for you guys.
    Odin is "done". So why not write a C compiler(or at least compiler backend) in Odin?

    I imagine Odin will provide great productivity gains and correctness as well.

    (I am currently playing with Odin and I love it, and I heard that GB wants to replace LLVM with Tilde)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions