LLVM 20.0.0git
Macros | Functions | Variables
ForceFunctionAttrs.cpp File Reference
#include "llvm/Transforms/IPO/ForceFunctionAttrs.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "forceattrs"
 

Functions

static void forceAttributes (Function &F)
 If F has any forced attributes given on the command line, add them.
 
static bool hasForceAttributes ()
 

Variables

static cl::list< std::string > ForceAttributes ("force-attribute", cl::Hidden, cl::desc("Add an attribute to a function. This can be a " "pair of 'function-name:attribute-name', to apply an attribute to a " "specific function. For " "example -force-attribute=foo:noinline. Specifying only an attribute " "will apply the attribute to every function in the module. This " "option can be specified multiple times."))
 
static cl::list< std::string > ForceRemoveAttributes ("force-remove-attribute", cl::Hidden, cl::desc("Remove an attribute from a function. This can be a " "pair of 'function-name:attribute-name' to remove an attribute " "from a specific function. For " "example -force-remove-attribute=foo:noinline. Specifying only an " "attribute will remove the attribute from all functions in the " "module. This " "option can be specified multiple times."))
 
static cl::opt< std::string > CSVFilePath ("forceattrs-csv-path", cl::Hidden, cl::desc("Path to CSV file containing lines of function names and attributes to " "add to them in the form of `f1,attr1` or `f2,attr2=str`."))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "forceattrs"

Definition at line 19 of file ForceFunctionAttrs.cpp.

Function Documentation

◆ forceAttributes()

static void forceAttributes ( Function F)
static

If F has any forced attributes given on the command line, add them.

If F has any forced remove attributes given on the command line, remove them. When both force and force-remove are given to a function, the latter takes precedence.

Definition at line 51 of file ForceFunctionAttrs.cpp.

References llvm::Attribute::canUseAsFnAttr(), llvm::dbgs(), F, ForceAttributes, ForceRemoveAttributes, llvm::Attribute::getAttrKindFromName(), LLVM_DEBUG, llvm::Attribute::None, and llvm::StringRef::split().

Referenced by llvm::ForceFunctionAttrsPass::run().

◆ hasForceAttributes()

static bool hasForceAttributes ( )
static

Definition at line 85 of file ForceFunctionAttrs.cpp.

References ForceAttributes, and ForceRemoveAttributes.

Referenced by llvm::ForceFunctionAttrsPass::run().

Variable Documentation

◆ CSVFilePath

cl::opt< std::string > CSVFilePath("forceattrs-csv-path", cl::Hidden, cl::desc( "Path to CSV file containing lines of function names and attributes to " "add to them in the form of `f1,attr1` or `f2,attr2=str`.")) ( "forceattrs-csv-path"  ,
cl::Hidden  ,
cl::desc( "Path to CSV file containing lines of function names and attributes to " "add to them in the form of `f1,attr1` or `f2,attr2=str`.")   
)
static

◆ ForceAttributes

cl::list< std::string > ForceAttributes("force-attribute", cl::Hidden, cl::desc( "Add an attribute to a function. This can be a " "pair of 'function-name:attribute-name', to apply an attribute to a " "specific function. For " "example -force-attribute=foo:noinline. Specifying only an attribute " "will apply the attribute to every function in the module. This " "option can be specified multiple times.")) ( "force-attribute"  ,
cl::Hidden  ,
cl::desc( "Add an attribute to a function. This can be a " "pair of 'function-name:attribute-name', to apply an attribute to a " "specific function. For " "example -force-attribute=foo:noinline. Specifying only an attribute " "will apply the attribute to every function in the module. This " "option can be specified multiple times.")   
)
static

◆ ForceRemoveAttributes

cl::list< std::string > ForceRemoveAttributes("force-remove-attribute", cl::Hidden, cl::desc("Remove an attribute from a function. This can be a " "pair of 'function-name:attribute-name' to remove an attribute " "from a specific function. For " "example -force-remove-attribute=foo:noinline. Specifying only an " "attribute will remove the attribute from all functions in the " "module. This " "option can be specified multiple times.")) ( "force-remove-attribute"  ,
cl::Hidden  ,
cl::desc("Remove an attribute from a function. This can be a " "pair of 'function-name:attribute-name' to remove an attribute " "from a specific function. For " "example -force-remove-attribute=foo:noinline. Specifying only an " "attribute will remove the attribute from all functions in the " "module. This " "option can be specified multiple times.")   
)
static