mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Add "naked" calling convention (removes prologue and epilogue)
This commit is contained in:
@@ -32,6 +32,7 @@ Calling_Convention :: enum u8 {
|
|||||||
Fast_Call = 5,
|
Fast_Call = 5,
|
||||||
|
|
||||||
None = 6,
|
None = 6,
|
||||||
|
Naked = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
Type_Info_Enum_Value :: distinct i64;
|
Type_Info_Enum_Value :: distinct i64;
|
||||||
|
|||||||
@@ -697,6 +697,9 @@ OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) {
|
|||||||
case ProcCC_None:
|
case ProcCC_None:
|
||||||
calling_convention = str_lit("none");
|
calling_convention = str_lit("none");
|
||||||
break;
|
break;
|
||||||
|
case ProcCC_Naked:
|
||||||
|
calling_convention = str_lit("naked");
|
||||||
|
break;
|
||||||
case ProcCC_InlineAsm:
|
case ProcCC_InlineAsm:
|
||||||
calling_convention = str_lit("inline-assembly");
|
calling_convention = str_lit("inline-assembly");
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -2588,6 +2588,10 @@ lbProcedure *lb_create_procedure(lbModule *m, Entity *entity) {
|
|||||||
lb_add_attribute_to_proc(m, p->value, "noreturn");
|
lb_add_attribute_to_proc(m, p->value, "noreturn");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pt->Proc.calling_convention == ProcCC_Naked) {
|
||||||
|
lb_add_attribute_to_proc(m, p->value, "naked");
|
||||||
|
}
|
||||||
|
|
||||||
switch (p->inlining) {
|
switch (p->inlining) {
|
||||||
case ProcInlining_inline:
|
case ProcInlining_inline:
|
||||||
lb_add_attribute_to_proc(m, p->value, "alwaysinline");
|
lb_add_attribute_to_proc(m, p->value, "alwaysinline");
|
||||||
|
|||||||
@@ -472,6 +472,7 @@ lbCallingConventionKind const lb_calling_convention_map[ProcCC_MAX] = {
|
|||||||
lbCallingConvention_X86_FastCall, // ProcCC_FastCall,
|
lbCallingConvention_X86_FastCall, // ProcCC_FastCall,
|
||||||
|
|
||||||
lbCallingConvention_C, // ProcCC_None,
|
lbCallingConvention_C, // ProcCC_None,
|
||||||
|
lbCallingConvention_C, // ProcCC_Naked,
|
||||||
lbCallingConvention_C, // ProcCC_InlineAsm,
|
lbCallingConvention_C, // ProcCC_InlineAsm,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3220,6 +3220,7 @@ ProcCallingConvention string_to_calling_convention(String s) {
|
|||||||
if (s == "fastcall") return ProcCC_FastCall;
|
if (s == "fastcall") return ProcCC_FastCall;
|
||||||
if (s == "fast") return ProcCC_FastCall;
|
if (s == "fast") return ProcCC_FastCall;
|
||||||
if (s == "none") return ProcCC_None;
|
if (s == "none") return ProcCC_None;
|
||||||
|
if (s == "naked") return ProcCC_Naked;
|
||||||
return ProcCC_Invalid;
|
return ProcCC_Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -215,8 +215,9 @@ enum ProcCallingConvention {
|
|||||||
ProcCC_FastCall = 5,
|
ProcCC_FastCall = 5,
|
||||||
|
|
||||||
ProcCC_None = 6,
|
ProcCC_None = 6,
|
||||||
|
ProcCC_Naked = 7,
|
||||||
|
|
||||||
ProcCC_InlineAsm = 7,
|
ProcCC_InlineAsm = 8,
|
||||||
|
|
||||||
ProcCC_MAX,
|
ProcCC_MAX,
|
||||||
|
|
||||||
|
|||||||
@@ -3618,6 +3618,9 @@ gbString write_type_to_string(gbString str, Type *type) {
|
|||||||
case ProcCC_None:
|
case ProcCC_None:
|
||||||
str = gb_string_appendc(str, " \"none\" ");
|
str = gb_string_appendc(str, " \"none\" ");
|
||||||
break;
|
break;
|
||||||
|
case ProcCC_Naked:
|
||||||
|
str = gb_string_appendc(str, " \"naked\" ");
|
||||||
|
break;
|
||||||
// case ProcCC_VectorCall:
|
// case ProcCC_VectorCall:
|
||||||
// str = gb_string_appendc(str, " \"vectorcall\" ");
|
// str = gb_string_appendc(str, " \"vectorcall\" ");
|
||||||
// break;
|
// break;
|
||||||
|
|||||||
Reference in New Issue
Block a user