disable LLVM API calls
This commit is contained in:
parent
3ce2a607ad
commit
a379ba9cf1
@ -886,70 +886,70 @@ pub fn make() void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Prune
|
// TODO: Prune
|
||||||
if (do_codegen) {
|
// if (do_codegen) {
|
||||||
for (threads) |*thread| {
|
// for (threads) |*thread| {
|
||||||
thread.add_thread_work(Job{
|
// thread.add_thread_work(Job{
|
||||||
.id = switch (codegen_backend) {
|
// .id = switch (codegen_backend) {
|
||||||
.llvm => .llvm_codegen_thread_module,
|
// .llvm => .llvm_codegen_thread_module,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
while (true) {
|
// while (true) {
|
||||||
var to_do: u64 = 0;
|
// var to_do: u64 = 0;
|
||||||
for (threads) |*thread| {
|
// for (threads) |*thread| {
|
||||||
const jobs_to_do = thread.task_system.job.to_do - thread.task_system.job.completed;
|
// const jobs_to_do = thread.task_system.job.to_do - thread.task_system.job.completed;
|
||||||
const asks_to_do = thread.task_system.ask.to_do - thread.task_system.ask.completed;
|
// const asks_to_do = thread.task_system.ask.to_do - thread.task_system.ask.completed;
|
||||||
assert(asks_to_do == 0);
|
// assert(asks_to_do == 0);
|
||||||
|
//
|
||||||
to_do += jobs_to_do;
|
// to_do += jobs_to_do;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (to_do == 0) {
|
// if (to_do == 0) {
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
var modules_present = PinnedArray(usize){};
|
// var modules_present = PinnedArray(usize){};
|
||||||
for (threads, 0..) |*thread, i| {
|
// for (threads, 0..) |*thread, i| {
|
||||||
if (thread.functions.length > 0) {
|
// if (thread.functions.length > 0) {
|
||||||
_ = modules_present.append(i);
|
// _ = modules_present.append(i);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
switch (modules_present.length) {
|
// switch (modules_present.length) {
|
||||||
0 => unreachable,
|
// 0 => unreachable,
|
||||||
1 => unreachable,
|
// 1 => unreachable,
|
||||||
2 => {
|
// 2 => {
|
||||||
const first = modules_present.slice()[0];
|
// const first = modules_present.slice()[0];
|
||||||
const second = modules_present.slice()[1];
|
// const second = modules_present.slice()[1];
|
||||||
const destination = threads[first].llvm.module;
|
// const destination = threads[first].llvm.module;
|
||||||
{
|
// {
|
||||||
var message: []const u8 = undefined;
|
// var message: []const u8 = undefined;
|
||||||
destination.toString(&message.ptr, &message.len);
|
// destination.toString(&message.ptr, &message.len);
|
||||||
std.debug.print("{s}\n", .{message});
|
// std.debug.print("{s}\n", .{message});
|
||||||
}
|
// }
|
||||||
const source = threads[second].llvm.module;
|
// const source = threads[second].llvm.module;
|
||||||
{
|
// {
|
||||||
var message: []const u8 = undefined;
|
// var message: []const u8 = undefined;
|
||||||
source.toString(&message.ptr, &message.len);
|
// source.toString(&message.ptr, &message.len);
|
||||||
std.debug.print("{s}\n", .{message});
|
// std.debug.print("{s}\n", .{message});
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (!destination.link(source, .{
|
// if (!destination.link(source, .{
|
||||||
.override_from_source = true,
|
// .override_from_source = true,
|
||||||
.link_only_needed = false,
|
// .link_only_needed = false,
|
||||||
})) {
|
// })) {
|
||||||
exit(1);
|
// exit(1);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
var message: []const u8 = undefined;
|
// var message: []const u8 = undefined;
|
||||||
destination.toString(&message.ptr, &message.len);
|
// destination.toString(&message.ptr, &message.len);
|
||||||
std.debug.print("============\n===========\n{s}\n", .{message});
|
// std.debug.print("============\n===========\n{s}\n", .{message});
|
||||||
},
|
// },
|
||||||
else => unreachable,
|
// else => unreachable,
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// while (true) {}
|
// while (true) {}
|
||||||
}
|
}
|
||||||
@ -1095,24 +1095,6 @@ fn thread_callback(thread_index: u32) void {
|
|||||||
for (jobs) |job| {
|
for (jobs) |job| {
|
||||||
switch (job.id) {
|
switch (job.id) {
|
||||||
.llvm_setup => {
|
.llvm_setup => {
|
||||||
const context = LLVM.Context.create();
|
|
||||||
const module_name: []const u8 = "thread";
|
|
||||||
const module = LLVM.Module.create(module_name.ptr, module_name.len, context);
|
|
||||||
const builder = LLVM.Builder.create(context);
|
|
||||||
const attributes = LLVM.Attributes{
|
|
||||||
.naked = context.getAttributeFromEnum(.Naked, 0),
|
|
||||||
.noreturn = context.getAttributeFromEnum(.NoReturn, 0),
|
|
||||||
.nounwind = context.getAttributeFromEnum(.NoUnwind, 0),
|
|
||||||
.inreg = context.getAttributeFromEnum(.InReg, 0),
|
|
||||||
.@"noalias" = context.getAttributeFromEnum(.NoAlias, 0),
|
|
||||||
};
|
|
||||||
thread.llvm = .{
|
|
||||||
.context = context,
|
|
||||||
.module = module,
|
|
||||||
.builder = builder,
|
|
||||||
.attributes = attributes,
|
|
||||||
};
|
|
||||||
|
|
||||||
for ([_]Type.Integer.Signedness{.unsigned, .signed}) |signedness| {
|
for ([_]Type.Integer.Signedness{.unsigned, .signed}) |signedness| {
|
||||||
for (0..64+1) |bit_count| {
|
for (0..64+1) |bit_count| {
|
||||||
const integer_type = Type.Integer{
|
const integer_type = Type.Integer{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user