Code Monkey home page Code Monkey logo

helix's People

Contributors

dontbelieveme avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

helix's Issues

Test f5013-cconv-return-small-struct.c fail

struct MyStruct
{
  int a;
};

struct MyStruct get_small_struct()
{
  struct MyStruct a = { 33 };
  return a;
}
MyStruct = struct { i32 }

@ci0:ptr = global i32 0:i32
@ci1:ptr = global i32 33:i32

function get_small_struct(): void {
.0:
        stack_alloc [i8 x 4], %0:ptr
        stack_alloc [i8 x 4], %1:ptr
        ptrtoint [ptr -> i32], %1:ptr, %2:i32
        load @ci0:ptr, %3:i32
        iadd %2:i32, %3:i32, %4:i32
        inttoptr [i32 -> ptr], %4:i32, %5:ptr
        load @ci1:ptr, %6:i32
        store %6:i32, %5:ptr
        load %1:ptr, %7:MyStruct
        store %7:MyStruct, %0:ptr
        br .1
.1:
        load %0:ptr, r0:i32
        ret
}
[2022-02-14 03:02:17.238] [general] [info] Creating module from 'C:\helix\t.c'
[2022-02-14 03:02:17.240] [driver] [trace] End frontend compilation
[2022-02-14 03:02:17.240] [driver] [trace] Begin middle & backend compilation
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (1) 'genlegal' - [Generic] Legalise illegal constructs IR to a legal equivilant
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (2) 'structslegal' - [Generic] Legalise loading & storing struct types to/from virtual registers
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (3) 'retcomb' - [Generic] Combine multiple returns into a singular exit point
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (4) 'genlower' - [Generic] Lower high level IR constructs
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (5) 'consthoist' - [ARM] Split and hoist constants to a form compatible with the ARM
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (6) 'cconv' - [ARM] Lower IR to be compatible with the platform calling convention
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (7) 'lowerallocastructs' - [Generic] Lower the stack allocations of structs to arrays
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (8) 'match' - [ARM] Matches the IR to it's machine instructions and generates machine IR
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (9) 'regalloc2' - [ARM] V2 Register allocation (linear scan)
[2022-02-14 03:02:17.241] [pass_manager] [trace] Registered pass (10) 'emit' - [ARM] Matches the IR to it's machine instructions and emits it as assembly to a file
[2022-02-14 03:02:17.242] [pass_manager] [trace] Pass: genlegal
[2022-02-14 03:02:17.242] [pass_manager] [trace] Validating pass 'genlegal'
[2022-02-14 03:02:17.242] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-02-14 03:02:17.242] [pass_manager] [trace] Pass: structslegal
[2022-02-14 03:02:17.242] [pass_manager] [trace] Validating pass 'structslegal'
[2022-02-14 03:02:17.242] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-02-14 03:02:17.242] [pass_manager] [trace] Pass: retcomb
[2022-02-14 03:02:17.242] [pass_manager] [trace] Validating pass 'retcomb'
[2022-02-14 03:02:17.242] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-02-14 03:02:17.242] [pass_manager] [trace] Pass: genlower
[2022-02-14 03:02:17.242] [genlower] [debug] Found 1 instructions that require lowering
[2022-02-14 03:02:17.243] [pass_manager] [trace] Validating pass 'genlower'
[2022-02-14 03:02:17.243] [pass_manager] [trace] Pass: consthoist
[2022-02-14 03:02:17.243] [pass_manager] [trace] Validating pass 'consthoist'
[2022-02-14 03:02:17.243] [pass_manager] [trace] Pass: cconv
[2022-02-14 03:02:17.243] [pass_manager] [trace] Validating pass 'cconv'
[2022-02-14 03:02:17.243] [pass_manager] [trace] Pass: lowerallocastructs
[2022-02-14 03:02:17.243] [pass_manager] [trace] Validating pass 'lowerallocastructs'
[2022-02-14 03:02:17.243] [pass_manager] [trace] Pass: match
[2022-02-14 03:02:17.243] [critical] ******************** Internal Compiler Error ********************
[2022-02-14 03:02:17.243] [critical]     Unreachable code reached (paradoxical, i know)
[2022-02-14 03:02:17.243] [critical]
[2022-02-14 03:02:17.244] [critical]     File:        C:\helix\src\arm.cpp
[2022-02-14 03:02:17.244] [critical]     Line:        37
[2022-02-14 03:02:17.244] [critical]     Function:    GetMachineMode
[2022-02-14 03:02:17.244] [critical]     Explanation: no machine mode for type
[2022-02-14 03:02:17.244] [critical] ******************** Internal Compiler Error ********************

Output IR control flow graph using Graphiz

Debug utility (like --emit-ir-post=xxxx) it would be good to be able to generate a visual graph of the control flow (with the basic blocks in each node) which can be processed by Graphiz.

Something like --dump-cfg-post=xxxx to emit the graph after the given pass.

Move the matching predicate & utility functions from `instructions.h` to `mir.h`

It's a bit messy with them being in instructions.h - they are only there because it was the other file I had open at the time... that's laziness for you.

They should be moved to mir.h.

The functions (as it stands) are:

  • stringify_operand
  • is_const_int_with_value
  • is_global
  • is_int
  • is_register
  • is_basic_block

In fact, all of these are reasoning about values & not instructions... sigh

Return structs from functions

Returning structs needs some special handling, see Parameter Passing - AAPCS32

https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#64result-return

In short:

  • If it's smaller than (or equal to) 4 bytes in size (native register size) then it is stored directly in the r0 register (sign or zero extended if nessesary)
  • If it's larger than 4 bytes then the value is stored in memory and the address of that value is passed to the called function as a parameter (in r0)

Incorrect IR codegen for overflowing integer constants

Given this C code

int main() {
	unsigned char my_byte = 1000;
	return 0;
}

the following IR is generated

function main(): i32 {
.0:
        stack_alloc [i8 x 1], %0:ptr
        store 1000:i8, %0:ptr
        ret 0:i32
}

Of course you can't store 1000 in an i8, so this should wrap the integer around correctly 232.

(In fact clang actually warns about this, and gives this

C:\helix\.\testsuite\f.c:4:15: warning: implicit conversion from 'int' to 'u8' (aka 'unsigned char') changes value from
      1000 to 232 [-Wconstant-conversion]
        u8 my_byte = 1000;
           ~~~~~~~   ^~~~

Test f0012-integral-casts-small-to-big.c failing

[2022-01-11 16:24:34.233] [general] [info] Creating module from 'C:\helix\testsuite\f0\f0012-integral-casts-small-to-big.c'
[2022-01-11 16:24:34.235] [driver] [trace] End frontend compilation
[2022-01-11 16:24:34.235] [driver] [trace] Begin middle & backend compilation
[2022-01-11 16:24:34.235] [pass_manager] [trace] Registered pass (1) 'genlegal' - [Generic] Legalise illegal constructs IR to a legal equivilant
[2022-01-11 16:24:34.235] [pass_manager] [trace] Registered pass (2) 'structslegal' - [Generic] Legalise loading & storing struct types to/from virtual registers
[2022-01-11 16:24:34.235] [pass_manager] [trace] Registered pass (3) 'retcomb' - [Generic] Combine multiple returns into a singular exit point
[2022-01-11 16:24:34.236] [pass_manager] [trace] Registered pass (4) 'genlower' - [Generic] Lower high level IR constructs
[2022-01-11 16:24:34.236] [pass_manager] [trace] Registered pass (5) 'consthoist' - [ARM] Split and hoist constants to a form compatible with the ARM
[2022-01-11 16:24:34.236] [pass_manager] [trace] Registered pass (6) 'cconv' - [ARM] Lower IR to be compatible with the platform calling convention
[2022-01-11 16:24:34.236] [pass_manager] [trace] Registered pass (7) 'lowerallocastructs' - [Generic] Lower the stack allocations of structs to arrays
[2022-01-11 16:24:34.236] [pass_manager] [trace] Registered pass (8) 'regalloc' - [ARM] Register allocation
[2022-01-11 16:24:34.236] [pass_manager] [trace] Registered pass (9) 'match' - [ARM] Matches the IR to it's machine instructions and generates machine IR
[2022-01-11 16:24:34.236] [pass_manager] [trace] Registered pass (10) 'emit' - [ARM] Matches the IR to it's machine instructions and emits it as assembly to a file
[2022-01-11 16:24:34.237] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.237] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.237] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.237] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.237] [pass_manager] [trace] Pass: genlegal
[2022-01-11 16:24:34.237] [pass_manager] [trace] Validating pass 'genlegal'
[2022-01-11 16:24:34.237] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.238] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.238] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.238] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.238] [pass_manager] [trace] Pass: structslegal
[2022-01-11 16:24:34.238] [pass_manager] [trace] Validating pass 'structslegal'
[2022-01-11 16:24:34.238] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.238] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.238] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.239] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.239] [pass_manager] [trace] Pass: retcomb
[2022-01-11 16:24:34.239] [pass_manager] [trace] Validating pass 'retcomb'
[2022-01-11 16:24:34.239] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.239] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.239] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.239] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.240] [pass_manager] [trace] Pass: genlower
[2022-01-11 16:24:34.240] [genlower] [debug] Found 0 instructions that require lowering
[2022-01-11 16:24:34.240] [genlower] [debug] Found 0 instructions that require lowering
[2022-01-11 16:24:34.240] [genlower] [debug] Found 0 instructions that require lowering
[2022-01-11 16:24:34.240] [genlower] [debug] Found 0 instructions that require lowering
[2022-01-11 16:24:34.240] [pass_manager] [trace] Validating pass 'genlower'
[2022-01-11 16:24:34.240] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.240] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [pass_manager] [trace] Pass: consthoist
[2022-01-11 16:24:34.241] [pass_manager] [trace] Validating pass 'consthoist'
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [pass_manager] [trace] Pass: cconv
[2022-01-11 16:24:34.241] [pass_manager] [trace] Validating pass 'cconv'
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.241] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.242] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.242] [pass_manager] [trace] Pass: lowerallocastructs
[2022-01-11 16:24:34.242] [pass_manager] [trace] Validating pass 'lowerallocastructs'
[2022-01-11 16:24:34.242] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.242] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.242] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.242] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.242] [pass_manager] [trace] Pass: regalloc
[2022-01-11 16:24:34.242] [regalloc] [debug] @ i32=4 bytes, +4
[2022-01-11 16:24:34.242] [regalloc] [debug] @ i16=2 bytes, +6
[2022-01-11 16:24:34.242] [regalloc] [debug] @ i16=2 bytes, +8
[2022-01-11 16:24:34.242] [regalloc] [debug] @ i32=4 bytes, +12
[2022-01-11 16:24:34.243] [regalloc] [debug] @ i16=2 bytes, +14
[2022-01-11 16:24:34.243] [regalloc] [debug] Result Offset: 12 (Stack Frame: 16, Var Offset: 4)
[2022-01-11 16:24:34.243] [regalloc] [debug] Result Offset: 10 (Stack Frame: 16, Var Offset: 6)
[2022-01-11 16:24:34.243] [regalloc] [debug] Result Offset: 8 (Stack Frame: 16, Var Offset: 8)
[2022-01-11 16:24:34.243] [regalloc] [debug] Result Offset: 4 (Stack Frame: 16, Var Offset: 12)
[2022-01-11 16:24:34.243] [regalloc] [debug] Result Offset: 2 (Stack Frame: 16, Var Offset: 14)
[2022-01-11 16:24:34.243] [regalloc] [debug] @ i32=4 bytes, +4
[2022-01-11 16:24:34.243] [regalloc] [debug] @ i16=2 bytes, +6
[2022-01-11 16:24:34.243] [regalloc] [debug] @ i16=2 bytes, +8
[2022-01-11 16:24:34.243] [regalloc] [debug] @ i32=4 bytes, +12
[2022-01-11 16:24:34.243] [regalloc] [debug] @ i16=2 bytes, +14
[2022-01-11 16:24:34.243] [regalloc] [debug] Result Offset: 12 (Stack Frame: 16, Var Offset: 4)
[2022-01-11 16:24:34.244] [regalloc] [debug] Result Offset: 10 (Stack Frame: 16, Var Offset: 6)
[2022-01-11 16:24:34.244] [regalloc] [debug] Result Offset: 8 (Stack Frame: 16, Var Offset: 8)
[2022-01-11 16:24:34.244] [regalloc] [debug] Result Offset: 4 (Stack Frame: 16, Var Offset: 12)
[2022-01-11 16:24:34.244] [regalloc] [debug] Result Offset: 2 (Stack Frame: 16, Var Offset: 14)
[2022-01-11 16:24:34.244] [regalloc] [debug] @ i32=4 bytes, +4
[2022-01-11 16:24:34.244] [regalloc] [debug] @ i16=2 bytes, +6
[2022-01-11 16:24:34.244] [regalloc] [debug] @ i16=2 bytes, +8
[2022-01-11 16:24:34.244] [regalloc] [debug] @ i32=4 bytes, +12
[2022-01-11 16:24:34.244] [regalloc] [debug] @ i16=2 bytes, +14
[2022-01-11 16:24:34.244] [regalloc] [debug] Result Offset: 12 (Stack Frame: 16, Var Offset: 4)
[2022-01-11 16:24:34.245] [regalloc] [debug] Result Offset: 10 (Stack Frame: 16, Var Offset: 6)
[2022-01-11 16:24:34.245] [regalloc] [debug] Result Offset: 8 (Stack Frame: 16, Var Offset: 8)
[2022-01-11 16:24:34.245] [regalloc] [debug] Result Offset: 4 (Stack Frame: 16, Var Offset: 12)
[2022-01-11 16:24:34.245] [regalloc] [debug] Result Offset: 2 (Stack Frame: 16, Var Offset: 14)
[2022-01-11 16:24:34.245] [regalloc] [debug] @ i32=4 bytes, +4
[2022-01-11 16:24:34.245] [regalloc] [debug] @ i16=2 bytes, +6
[2022-01-11 16:24:34.245] [regalloc] [debug] @ i16=2 bytes, +8
[2022-01-11 16:24:34.245] [regalloc] [debug] @ i32=4 bytes, +12
[2022-01-11 16:24:34.245] [regalloc] [debug] @ i16=2 bytes, +14
[2022-01-11 16:24:34.245] [regalloc] [debug] Result Offset: 12 (Stack Frame: 16, Var Offset: 4)
[2022-01-11 16:24:34.245] [regalloc] [debug] Result Offset: 10 (Stack Frame: 16, Var Offset: 6)
[2022-01-11 16:24:34.246] [regalloc] [debug] Result Offset: 8 (Stack Frame: 16, Var Offset: 8)
[2022-01-11 16:24:34.246] [regalloc] [debug] Result Offset: 4 (Stack Frame: 16, Var Offset: 12)
[2022-01-11 16:24:34.246] [regalloc] [debug] Result Offset: 2 (Stack Frame: 16, Var Offset: 14)
[2022-01-11 16:24:34.246] [pass_manager] [trace] Validating pass 'regalloc'
[2022-01-11 16:24:34.246] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.246] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.246] [validate] [warning] instruction 'sext' has no validation rules, ignoring
[2022-01-11 16:24:34.246] [validate] [warning] instruction 'zext' has no validation rules, ignoring
[2022-01-11 16:24:34.246] [pass_manager] [trace] Pass: match
[2022-01-11 16:24:34.246] [general] [error] Failed to match instruction 'sext [i16 -> i32], r0:i16, r1:i32'
[2022-01-11 16:24:34.246] [critical] ******************** Internal Compiler Error ********************
[2022-01-11 16:24:34.246] [critical]     Unreachable code reached (paradoxical, i know)
[2022-01-11 16:24:34.247] [critical]
[2022-01-11 16:24:34.247] [critical]     File:        C:\helix\vs2022\src\arm-md.cpp
[2022-01-11 16:24:34.247] [critical]     Line:        609
[2022-01-11 16:24:34.247] [critical]     Function:    Helix::ARMv7::Expand
[2022-01-11 16:24:34.247] [critical]     Explanation: cannot expand instruction to machine ir, check arm.md
[2022-01-11 16:24:34.247] [critical] ******************** Internal Compiler Error ********************

Backend code generation rewrite to represent machine instructions in the IR

Currently machine instructions are only represented at the very last level - as text.
This would see those machine instructions represented in the (a) IR somehow.

This representation could be generated from the existing patterns in arm.md (with a bit of adjustment):

(define-insn "add_r32r32"
	[(kInsn_IAdd
		(match_operand:i32 0 "register")
		(match_operand:i32 1 "register")
		(match_operand:i32 2 "register"))]
	"add {2}, {0}, {1}")
  • The opcode of the machine instruction could be specified as the first given field (the name, in this case add_r32r32).
  • The pattern to used to generate the machine instruction (from abstract IR) is the same as normal, given in the second field).
  • The assembly text to generate from this machine instruction is given as the last instruction.
  • Operands to the machine instruction could be parsed from the parameters given in the assembly text string.

Sub Tasks

Unsupported C features

This is a working list of all features that are not supported:

  • ++/-- prefix/postfix operators
  • +=, -=, *=, /= binary operators
  • User defined structures
  • Global data
  • String literals (ties into "global data", since that's pretty much just what strings are)
  • Dereferencing in an assignment (e.g. *b = 10)
  • goto
  • do/while loops
  • switch statements
  • Boolean operators (&&, ||, !)
  • Bitwise operators (>>, <<, |, &, ~, <<=, >>=, |=, &=, ~=)
  • enums
  • non implicit casts
  • % modulo operator
  • sizeof

Generate assembly from machine IR instead of abstract IR

Rework match pass so that it generates assembly text based off the machine instructions rather than the abstract IR instructions.

The match pass should probably become final and match will be repurposed to translate from high level IR to low level IR

Add equivalent of GCCs `define_expand`.

So that a machine instruction pattern can be used to generate multiple IR machine instructions. This necessary for instructions such as icmp or cbr which currently expand to multiple assembly instructions

First test occasionally fails the first time running the testsuite for the first time

Sporadic failure of the first testcase when running the testsuite for the first time in a while.

The fact that it only fails the first time & not subsequent times during the same "session" are going to make this a bugger to repro & debug.

Maybe something is timing out (first time running programs often take longer to startup, maybe some caching of behalf of Windows or something?)

Test f5004-legalise-struct-initialisers.c fail

[2022-01-11 16:21:28.319] [general] [info] Creating module from 'C:\helix\testsuite\f5\f5004-legalise-struct-initialisers.c'
[2022-01-11 16:21:28.320] [driver] [trace] End frontend compilation
[2022-01-11 16:21:28.321] [driver] [trace] Begin middle & backend compilation
[2022-01-11 16:21:28.321] [pass_manager] [trace] Registered pass (1) 'genlegal' - [Generic] Legalise illegal constructs IR to a legal equivilant
[2022-01-11 16:21:28.321] [pass_manager] [trace] Registered pass (2) 'structslegal' - [Generic] Legalise loading & storing struct types to/from virtual registers
[2022-01-11 16:21:28.322] [pass_manager] [trace] Registered pass (3) 'retcomb' - [Generic] Combine multiple returns into a singular exit point
[2022-01-11 16:21:28.322] [pass_manager] [trace] Registered pass (4) 'genlower' - [Generic] Lower high level IR constructs
[2022-01-11 16:21:28.322] [pass_manager] [trace] Registered pass (5) 'consthoist' - [ARM] Split and hoist constants to a form compatible with the ARM
[2022-01-11 16:21:28.322] [pass_manager] [trace] Registered pass (6) 'cconv' - [ARM] Lower IR to be compatible with the platform calling convention
[2022-01-11 16:21:28.322] [pass_manager] [trace] Registered pass (7) 'lowerallocastructs' - [Generic] Lower the stack allocations of structs to arrays
[2022-01-11 16:21:28.322] [pass_manager] [trace] Registered pass (8) 'regalloc' - [ARM] Register allocation
[2022-01-11 16:21:28.322] [pass_manager] [trace] Registered pass (9) 'match' - [ARM] Matches the IR to it's machine instructions and generates machine IR
[2022-01-11 16:21:28.322] [pass_manager] [trace] Registered pass (10) 'emit' - [ARM] Matches the IR to it's machine instructions and emits it as assembly to a file
[2022-01-11 16:21:28.322] [pass_manager] [trace] Pass: genlegal
[2022-01-11 16:21:28.323] [pass_manager] [trace] Validating pass 'genlegal'
[2022-01-11 16:21:28.323] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.323] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.323] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.323] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.323] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.323] [pass_manager] [trace] Pass: structslegal
[2022-01-11 16:21:28.323] [pass_manager] [trace] Validating pass 'structslegal'
[2022-01-11 16:21:28.323] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.323] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.323] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.324] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.324] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.324] [pass_manager] [trace] Pass: retcomb
[2022-01-11 16:21:28.324] [pass_manager] [trace] Validating pass 'retcomb'
[2022-01-11 16:21:28.324] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.324] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.324] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.324] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.324] [validate] [warning] instruction 'lfa' has no validation rules, ignoring
[2022-01-11 16:21:28.325] [pass_manager] [trace] Pass: genlower
[2022-01-11 16:21:28.325] [genlower] [debug] Found 5 instructions that require lowering
[2022-01-11 16:21:28.325] [pass_manager] [trace] Validating pass 'genlower'
[2022-01-11 16:21:28.325] [pass_manager] [trace] Pass: consthoist
[2022-01-11 16:21:28.325] [pass_manager] [trace] Validating pass 'consthoist'
[2022-01-11 16:21:28.325] [pass_manager] [trace] Pass: cconv
[2022-01-11 16:21:28.325] [critical] ******************** Internal Compiler Error ********************
[2022-01-11 16:21:28.325] [critical]     Assertion Failed!
[2022-01-11 16:21:28.325] [critical]
[2022-01-11 16:21:28.325] [critical]     File:      C:\helix\src\lower.cpp
[2022-01-11 16:21:28.325] [critical]     Line:      379
[2022-01-11 16:21:28.325] [critical]     Function:  Helix::CConv::Execute
[2022-01-11 16:21:28.326] [critical]     Condition: ARMv7::TypeSize(returnValue->GetType()) <= r0Size
[2022-01-11 16:21:28.326] [critical]     Reason:    return value can't fit in output register
[2022-01-11 16:21:28.326] [critical] ******************** Internal Compiler Error ********************

Make function prologue & epilogue configurable (in machine description files?)

Currently function prologue is hardcoded to be emitted before handling any instructions in the function & the function epilogue is emitted by the machine description pattern for ret.

This could be cleaned up a little bit by defining them in the machine description patterns instead & having the final (emitter) pass lookup them up from there instead of having it hardcoded.

Crash when running with no provided arguments

Seems to occur because clang things that we've not checked an error, but we clearly do...

 	ucrtbase.dll!00007ffa9fc1286e()	Unknown
 	hxc.exe!llvm::Error::fatalUncheckedError(void)	C++
 	[Inline Frame] hxc.exe!llvm::Error::assertIsChecked() Line 266	C++
 	[Inline Frame] hxc.exe!llvm::Error::{dtor}() Line 228	C++
 	hxc.exe!Helix::Frontend::Run(int argc, const char * * argv) Line 1699	C++
 	hxc.exe!main(int argc, const char * * argv) Line 11	C++
 	[External Code]	

Not a massive problem, but recording nonetheless

Match against multi instruction patterns in arm.md

e.g.

(define-insn "load_sgptr"
	[(kInsn_Load
		(match_operand:ptr 0 "global")
		(match_operand:i32 1 "register"))
         (kInsn_SignExtend
		(match_operand:i8 0 "register")
		(match_operand:i32 1 "register"))]
	"movw {1}, :lower16:{0}"
	"movt {1}, :upper16:{0}"
	"ldrsb {1}, [{1}]")

Required for #10 - so that the correct load instruction (e.g. ldrsb, ldrb, ldrsh, ldrh etc...) can be generated when loading from globals that are smaller than 32 bits in size)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.