Skip to content

Commit

Permalink
Rename function relations (part 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
langston-barrett committed Oct 7, 2022
1 parent 275ec30 commit bc1f9ad
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 176 deletions.
17 changes: 9 additions & 8 deletions FactGenerator/include/predicates.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
#define PREDICATE(group, name, fname)
#endif
// The goal of the above TODO is to move most or all of the below declarations
// from using PREDICATE to PREDICATE2.
// from using PREDICATE to PREDICATE2 and PREDICATE_INSTR.
#define PREDICATE2(group, name) PREDICATE(group, name, group ## _ ## name)
#define PREDICATE_INSTR(group, name) PREDICATE(group, name, group ## _instr_ ## name)

GROUP_BEGIN(block)
PREDICATE2(block, predecessor)
Expand Down Expand Up @@ -44,19 +45,19 @@ GROUP_BEGIN(func)
PREDICATE(func, id_defn, func)
PREDICATE(func, id_decl, func_decl)
PREDICATE2(func, unnamed_addr)
PREDICATE(func, linkage, func_linkage_type)
PREDICATE2(func, linkage)
PREDICATE2(func, visibility)
PREDICATE(func, calling_conv, func_calling_convention)
PREDICATE2(func, calling_conv)
PREDICATE2(func, section)
PREDICATE2(func, alignment)
PREDICATE(func, fn_attr, func_attr)
PREDICATE2(func, fn_attr)
PREDICATE2(func, gc)
PREDICATE2(func, pers_fn)
PREDICATE2(func, name)
PREDICATE(func, type, func_ty)
PREDICATE2(func, ty)
PREDICATE2(func, signature)
PREDICATE2(func, param)
PREDICATE(func, ret_attr, func_return_attr)
PREDICATE2(func, return_attr)
PREDICATE2(func, param_attr)
GROUP_END(function)

Expand Down Expand Up @@ -226,7 +227,7 @@ PREDICATE(invoke, instr_indirect, indirect_invoke_instr)
PREDICATE(invoke, function, invoke_instr_fn_operand)
PREDICATE(invoke, arg, invoke_instr_arg)
PREDICATE(invoke, calling_conv, invoke_instr_with_calling_convention)
PREDICATE(invoke, ret_attr, invoke_instr_with_return_attr)
PREDICATE(invoke, return_attr, invoke_instr_with_return_attr)
PREDICATE(invoke, param_attr, invoke_instr_with_param_attr)
PREDICATE(invoke, fn_attr, invoke_instr_with_fn_attr)
PREDICATE(invoke, normal_label, invoke_instr_normal_label)
Expand Down Expand Up @@ -448,7 +449,7 @@ PREDICATE(call, instr_indirect, indirect_call_instr)
PREDICATE(call, function, call_instr_fn_operand)
PREDICATE(call, arg, call_instr_arg)
PREDICATE(call, calling_conv, call_instr_with_calling_convention)
PREDICATE(call, ret_attr, call_instr_with_return_attr)
PREDICATE(call, return_attr, call_instr_with_return_attr)
PREDICATE(call, param_attr, call_instr_with_param_attr)
PREDICATE(call, fn_attr, call_instr_with_fn_attr)
PREDICATE(call, tail, call_instr_is_tail_opt)
Expand Down
4 changes: 2 additions & 2 deletions FactGenerator/src/InstructionVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void InstructionVisitor::visitInvokeInst(const llvm::InvokeInst &II) {

if (Attrs.hasAttributes(Attributes::ReturnIndex)) {
string attrs = Attrs.getAsString(Attributes::ReturnIndex);
gen.writeFact(pred::invoke::ret_attr, iref, attrs);
gen.writeFact(pred::invoke::return_attr, iref, attrs);
}

gen.writeFnAttributes<pred::invoke>(iref, Attrs);
Expand Down Expand Up @@ -580,7 +580,7 @@ void InstructionVisitor::visitCallInst(const llvm::CallInst &CI) {
if (Attrs.hasAttributes(Attributes::ReturnIndex)) {
const auto ReturnAttrs = Attrs.getAttributes(Attributes::ReturnIndex);
for (const auto Attr : ReturnAttrs) {
gen.writeFact(pred::call::ret_attr, iref, Attr.getAsString());
gen.writeFact(pred::call::return_attr, iref, Attr.getAsString());
}
}

Expand Down
6 changes: 3 additions & 3 deletions FactGenerator/src/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void FactGenerator::writeFunction(
refmode_t typeSignature = recordType(func.getFunctionType());

// Record function type signature
writeFact(pred::func::type, funcref, typeSignature);
writeFact(pred::func::ty, funcref, typeSignature);

// Record function signature (name plus type signature) after
// unmangling
Expand Down Expand Up @@ -79,7 +79,7 @@ void FactGenerator::writeFunction(

if (Attrs.hasAttributes(Attributes::ReturnIndex))
writeFact(
pred::func::ret_attr,
pred::func::return_attr,
funcref,
Attrs.getAsString(Attributes::ReturnIndex));

Expand Down Expand Up @@ -158,7 +158,7 @@ void FactGenerator::writeFnAttributes(
// Record attribute by kind
switch (index) {
case Attributes::AttrIndex::ReturnIndex:
writeFact(PredGroup::ret_attr, refmode, attr);
writeFact(PredGroup::return_attr, refmode, attr);
break;
case Attributes::AttrIndex::FunctionIndex:
writeFact(PredGroup::fn_attr, refmode, attr);
Expand Down
74 changes: 37 additions & 37 deletions datalog/export/debug-output-extended.dl
Original file line number Diff line number Diff line change
Expand Up @@ -339,44 +339,44 @@
.output fsub_instr_second_operand (compress=true)
.output func (compress=true)
.output func_alignment (compress=true)
.output func_attr (compress=true)
.output func_attr__alignstack (compress=true)
.output func_attr__alwaysinline (compress=true)
.output func_attr__argmemonly (compress=true)
.output func_attr__builtin (compress=true)
.output func_attr__cold (compress=true)
.output func_attr__convergent (compress=true)
.output func_attr__inaccessiblemem_or_argmemonly (compress=true)
.output func_attr__inaccessiblememonly (compress=true)
.output func_attr__inlinehint (compress=true)
.output func_attr__jumptable (compress=true)
.output func_attr__minsize (compress=true)
.output func_attr__naked (compress=true)
.output func_attr__nobuiltin (compress=true)
.output func_attr__noduplicate (compress=true)
.output func_attr__noimplicitfloat (compress=true)
.output func_attr__noinline (compress=true)
.output func_attr__nonlazybind (compress=true)
.output func_attr__norecurse (compress=true)
.output func_attr__noredzone (compress=true)
.output func_attr__noreturn (compress=true)
.output func_attr__nounwind (compress=true)
.output func_attr__optnone (compress=true)
.output func_attr__optsize (compress=true)
.output func_attr__readnone (compress=true)
.output func_attr__readonly (compress=true)
.output func_attr__returns_twice (compress=true)
.output func_attr__safestack (compress=true)
.output func_attr__sanitize_address (compress=true)
.output func_attr__sanitize_memory (compress=true)
.output func_attr__sanitize_thread (compress=true)
.output func_attr__ssp (compress=true)
.output func_attr__sspreq (compress=true)
.output func_attr__sspstrong (compress=true)
.output func_attr__uwtable (compress=true)
.output func_fn_attr (compress=true)
.output func_fn_attr__alignstack (compress=true)
.output func_fn_attr__alwaysinline (compress=true)
.output func_fn_attr__argmemonly (compress=true)
.output func_fn_attr__builtin (compress=true)
.output func_fn_attr__cold (compress=true)
.output func_fn_attr__convergent (compress=true)
.output func_fn_attr__inaccessiblemem_or_argmemonly (compress=true)
.output func_fn_attr__inaccessiblememonly (compress=true)
.output func_fn_attr__inlinehint (compress=true)
.output func_fn_attr__jumptable (compress=true)
.output func_fn_attr__minsize (compress=true)
.output func_fn_attr__naked (compress=true)
.output func_fn_attr__nobuiltin (compress=true)
.output func_fn_attr__noduplicate (compress=true)
.output func_fn_attr__noimplicitfloat (compress=true)
.output func_fn_attr__noinline (compress=true)
.output func_fn_attr__nonlazybind (compress=true)
.output func_fn_attr__norecurse (compress=true)
.output func_fn_attr__noredzone (compress=true)
.output func_fn_attr__noreturn (compress=true)
.output func_fn_attr__nounwind (compress=true)
.output func_fn_attr__optnone (compress=true)
.output func_fn_attr__optsize (compress=true)
.output func_fn_attr__readnone (compress=true)
.output func_fn_attr__readonly (compress=true)
.output func_fn_attr__returns_twice (compress=true)
.output func_fn_attr__safestack (compress=true)
.output func_fn_attr__sanitize_address (compress=true)
.output func_fn_attr__sanitize_memory (compress=true)
.output func_fn_attr__sanitize_thread (compress=true)
.output func_fn_attr__ssp (compress=true)
.output func_fn_attr__sspreq (compress=true)
.output func_fn_attr__sspstrong (compress=true)
.output func_fn_attr__uwtable (compress=true)
.output func_by_location (compress=true)
.output func_by_value_param (compress=true)
.output func_calling_convention (compress=true)
.output func_calling_conv (compress=true)
.output func_calls_func (compress=true)
.output func_constant (compress=true)
.output func_constant_fn_name (compress=true)
Expand All @@ -386,7 +386,7 @@
.output func_gc (compress=true)
.output func_is_illformed (compress=true)
.output func_is_wellformed (compress=true)
.output func_linkage_type (compress=true)
.output func_linkage (compress=true)
.output func_missing_pts_signature (compress=true)
.output func_name (compress=true)
.output func_needs_pts_signature (compress=true)
Expand Down
74 changes: 37 additions & 37 deletions datalog/export/debug-output.dl
Original file line number Diff line number Diff line change
Expand Up @@ -339,44 +339,44 @@
.output fsub_instr_second_operand (compress=true)
.output func (compress=true)
.output func_alignment (compress=true)
.output func_attr (compress=true)
.output func_attr__alignstack (compress=true)
.output func_attr__alwaysinline (compress=true)
.output func_attr__argmemonly (compress=true)
.output func_attr__builtin (compress=true)
.output func_attr__cold (compress=true)
.output func_attr__convergent (compress=true)
.output func_attr__inaccessiblemem_or_argmemonly (compress=true)
.output func_attr__inaccessiblememonly (compress=true)
.output func_attr__inlinehint (compress=true)
.output func_attr__jumptable (compress=true)
.output func_attr__minsize (compress=true)
.output func_attr__naked (compress=true)
.output func_attr__nobuiltin (compress=true)
.output func_attr__noduplicate (compress=true)
.output func_attr__noimplicitfloat (compress=true)
.output func_attr__noinline (compress=true)
.output func_attr__nonlazybind (compress=true)
.output func_attr__norecurse (compress=true)
.output func_attr__noredzone (compress=true)
.output func_attr__noreturn (compress=true)
.output func_attr__nounwind (compress=true)
.output func_attr__optnone (compress=true)
.output func_attr__optsize (compress=true)
.output func_attr__readnone (compress=true)
.output func_attr__readonly (compress=true)
.output func_attr__returns_twice (compress=true)
.output func_attr__safestack (compress=true)
.output func_attr__sanitize_address (compress=true)
.output func_attr__sanitize_memory (compress=true)
.output func_attr__sanitize_thread (compress=true)
.output func_attr__ssp (compress=true)
.output func_attr__sspreq (compress=true)
.output func_attr__sspstrong (compress=true)
.output func_attr__uwtable (compress=true)
.output func_fn_attr (compress=true)
.output func_fn_attr__alignstack (compress=true)
.output func_fn_attr__alwaysinline (compress=true)
.output func_fn_attr__argmemonly (compress=true)
.output func_fn_attr__builtin (compress=true)
.output func_fn_attr__cold (compress=true)
.output func_fn_attr__convergent (compress=true)
.output func_fn_attr__inaccessiblemem_or_argmemonly (compress=true)
.output func_fn_attr__inaccessiblememonly (compress=true)
.output func_fn_attr__inlinehint (compress=true)
.output func_fn_attr__jumptable (compress=true)
.output func_fn_attr__minsize (compress=true)
.output func_fn_attr__naked (compress=true)
.output func_fn_attr__nobuiltin (compress=true)
.output func_fn_attr__noduplicate (compress=true)
.output func_fn_attr__noimplicitfloat (compress=true)
.output func_fn_attr__noinline (compress=true)
.output func_fn_attr__nonlazybind (compress=true)
.output func_fn_attr__norecurse (compress=true)
.output func_fn_attr__noredzone (compress=true)
.output func_fn_attr__noreturn (compress=true)
.output func_fn_attr__nounwind (compress=true)
.output func_fn_attr__optnone (compress=true)
.output func_fn_attr__optsize (compress=true)
.output func_fn_attr__readnone (compress=true)
.output func_fn_attr__readonly (compress=true)
.output func_fn_attr__returns_twice (compress=true)
.output func_fn_attr__safestack (compress=true)
.output func_fn_attr__sanitize_address (compress=true)
.output func_fn_attr__sanitize_memory (compress=true)
.output func_fn_attr__sanitize_thread (compress=true)
.output func_fn_attr__ssp (compress=true)
.output func_fn_attr__sspreq (compress=true)
.output func_fn_attr__sspstrong (compress=true)
.output func_fn_attr__uwtable (compress=true)
.output func_by_location (compress=true)
.output func_by_value_param (compress=true)
.output func_calling_convention (compress=true)
.output func_calling_conv (compress=true)
.output func_calls_func (compress=true)
.output func_constant (compress=true)
.output func_constant_fn_name (compress=true)
Expand All @@ -386,7 +386,7 @@
.output func_gc (compress=true)
.output func_is_illformed (compress=true)
.output func_is_wellformed (compress=true)
.output func_linkage_type (compress=true)
.output func_linkage (compress=true)
.output func_missing_pts_signature (compress=true)
.output func_name (compress=true)
.output func_needs_pts_signature (compress=true)
Expand Down
Loading

0 comments on commit bc1f9ad

Please sign in to comment.