add CallFlags#48
Merged
Merged
Conversation
Coverage
Diff CoverageDiff CoverageDiff: origin/main...HEAD, staged and unstaged changes
Summary
genext.hppLines 794-802 794 build_args.push_back(args[0]);
795 build_args.push_back(builder.build_const(Type::Int64, args.size() - 1));
796 build_args.push_back(builder.build_const(Type::Int32, (uint64_t)i->type()));
797 build_args.push_back(builder.build_const(Type::Int32, (uint64_t)i->call_conv()));
! 798 build_args.push_back(builder.build_const(Type::Int32, (uint64_t)i->flags()));
799 Value* built = builder.build_call(syms.build_call, Type::Ptr, build_args);
800 for (size_t it = 1; it < args.size(); it++) {
801 builder.build_call(syms.set_arg, Type::Void, {
802 built,jitir.hppLines 931-943 931 return std::hash<uint32_t>()((uint32_t) flags); \
932 } \
933 }; \
934 \
! 935 std::ostream& operator<<(std::ostream& stream, Flags flags) { \
! 936 metajit::PlainPrettyStream plain_stream(stream); \
! 937 flags.write(plain_stream); \
! 938 return stream; \
! 939 } \
940 \
941 metajit::PrettyStream& operator<<(metajit::PrettyStream& stream, const Flags& flags) { \
942 flags.write(stream); \
943 return stream; \Lines 2814-2822 2814 Type type() const { return _type; }
2815 CallConv call_conv() const { return _call_conv; }
2816 CallFlags flags() const { return _flags; }
2817 void set_call_conv(CallConv call_conv) { _call_conv = call_conv; }
! 2818 void set_flags(CallFlags flags) { _flags = flags; }
2819 void write(metajit::PrettyStream& stream) const override {
2820 stream << Highlight::Keyword << "Call" << Highlight::None;;
2821 stream << ' ';
2822 bool is_first = true;Lines 2843-2853 2843 stream << "\"" << _type << "\"";
2844 stream << ", ";
2845 stream << "\"call_conv\": ";
2846 stream << "\"" << _call_conv << "\"";
! 2847 stream << ", ";
! 2848 stream << "\"flags\": ";
! 2849 _flags.write_json(stream);
2850 stream << "}";
2851 } bool equals(const Value* other) const override {
2852 if (this == other) { return true; }
2853 if (other == nullptr) { return false; }Lines 2858-2866 2858 if (arg(it) != other_inst->arg(it)) { return false; }
2859 }
2860 if (_type != other_inst->_type) { return false; }
2861 if (_call_conv != other_inst->_call_conv) { return false; }
! 2862 if (_flags != other_inst->_flags) { return false; }
2863 return true;
2864 }
2865 size_t hash() const override {
2866 size_t hash = 7267317566803404502ULL;Lines 2869-2877 2869 hash ^= std::hash<Value*>()(arg(it));
2870 }
2871 hash ^= std::hash<Type>()(_type);
2872 hash ^= std::hash<CallConv>()(_call_conv);
! 2873 hash ^= std::hash<CallFlags>()(_flags);
2874 return hash;
2875 }
2876 };
2877 class BranchInst final: public Inst {Lines 4731-4743 4731 Value* build_call(Value* callee,
4732 Type type,
4733 const lwir::Span<Value*>& args,
4734 CallConv call_conv = CallConv::Default,
! 4735 CallFlags call_flags = CallFlags::None) {
4736 // Calls may read/write memory reachable through pointers, so invalidate
4737 // forwarding and exact aliasing state conservatively.
4738 invalidate_memory_state();
! 4739 return Builder::build_call(callee, type, args, call_conv, call_flags);
4740 }
4741
4742 Value* build_call(Value* callee,
4743 Type type,Lines 4742-4751 4742 Value* build_call(Value* callee,
4743 Type type,
4744 const std::vector<Value*>& args,
4745 CallConv call_conv = CallConv::Default,
! 4746 CallFlags call_flags = CallFlags::None) {
! 4747 return build_call(callee, type, lwir::Span<Value*>((Value**) args.data(), args.size()), call_conv, call_flags);
4748 }
4749
4750 template <class... Args>
4751 Block* build_block(Args... args) {Lines 4916-4925 4916 }
4917 void* jitir_build_lt_f_u(void* builder, void* a, void* b) {
4918 return (void*)((::metajit::TraceBuilder*)builder)->build_lt_f_u((Value*) a, (Value*) b);
4919 }
! 4920 void* jitir_build_call(void* builder, void* callee, uint64_t args, uint32_t type, uint32_t call_conv, uint32_t flags) {
! 4921 return (void*)((::metajit::TraceBuilder*)builder)->build_call((Value*) callee, (size_t) args, (Type) type, (CallConv) call_conv, (CallFlags) flags);
4922 }
4923 void* jitir_build_branch(void* builder, void* cond, void* true_block, void* false_block) {
4924 return (void*)((::metajit::TraceBuilder*)builder)->build_branch((Value*) cond, (Block*) true_block, (Block*) false_block);
4925 }Lines 8778-8786 8778 LtFUInst* clone = builder.build_lt_f_u(clone_arg(inst->arg(0), builder, values), clone_arg(inst->arg(1), builder, values));
8779 return clone;
8780 }
8781 if (dynamic_cast<CallInst*>(inst)) {
! 8782 CallInst* clone = builder.build_call(clone_arg(inst->arg(0), builder, values), inst->arg_count() - 1, ((CallInst*) inst)->type(), ((CallInst*) inst)->call_conv(), ((CallInst*) inst)->flags());
8783 for (size_t it = 1; it < inst->arg_count(); it++) {
8784 clone->set_arg(it, clone_arg(inst->arg(it), builder, values));
8785 }
8786 return clone;jitir_llvmapi.hppLines 887-896 887 build_args.push_back(args[0]);
888 build_args.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(context), args.size() - 1, false));
889 build_args.push_back(llvm::ConstantInt::get(llvm::Type::getInt32Ty(context), (uint64_t)i->type(), false));
890 build_args.push_back(llvm::ConstantInt::get(llvm::Type::getInt32Ty(context), (uint64_t)i->call_conv(), false));
! 891 build_args.push_back(llvm::ConstantInt::get(llvm::Type::getInt32Ty(context), (uint64_t)i->flags(), false));
! 892 assert(build_args.size() == 6);
893 llvm::Value* built = builder.CreateCall(api.build_call, build_args);
894 for (size_t it = 1; it < args.size(); it++) {
895 builder.CreateCall(api.set_arg, {
896 built, |
can-lehmann
marked this pull request as ready for review
June 21, 2026 04:13
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.