Go to the documentation of this file.
9 #ifndef LLVM_OPTION_ARGLIST_H
10 #define LLVM_OPTION_ARGLIST_H
24 #include <initializer_list>
39 template<
typename BaseIter,
unsigned NumOptSpecifiers = 0>
42 BaseIter Current, End;
46 OptSpecifier Ids[NumOptSpecifiers ? NumOptSpecifiers : 1];
48 void SkipToNextArg() {
49 for (; Current != End; ++Current) {
55 if (!NumOptSpecifiers)
59 const Option &
O = (*Current)->getOption();
69 using Traits = std::iterator_traits<BaseIter>;
79 BaseIter Current, BaseIter End,
80 const OptSpecifier (&Ids)[NumOptSpecifiers ? NumOptSpecifiers : 1] = {})
81 : Current(Current), End(End) {
82 for (
unsigned I = 0;
I != NumOptSpecifiers; ++
I)
83 this->Ids[
I] = Ids[
I];
103 return LHS.Current ==
RHS.Current;
134 using OptRange = std::pair<unsigned, unsigned>;
135 static OptRange emptyRange() {
return {-1u, 0u}; }
142 OptRange getRange(std::initializer_list<OptSpecifier> Ids)
const;
158 RHS.OptRanges.clear();
165 RHS.OptRanges.clear();
185 unsigned size()
const {
return Args.size(); }
203 template<
typename ...OptSpecifiers>
207 auto B = Args.begin() + Range.first;
208 auto E = Args.begin() + Range.second;
214 template<
typename ...OptSpecifiers>
218 auto B = Args.rend() - Range.second;
219 auto E = Args.rend() - Range.first;
239 template<
typename ...OptSpecifiers>
243 template<
typename ...OptSpecifiers>
244 bool hasArg(OptSpecifiers ...Ids)
const {
251 return (Args.begin() != Args.end()) && (++Args.begin()) != Args.end();
255 template<
typename ...OptSpecifiers>
267 template<
typename ...OptSpecifiers>
321 template<
typename ...OptSpecifiers>
324 A->render(*
this, Output);
350 const char *Translation,
351 bool Joined =
false)
const;
397 mutable std::list<std::string> SynthesizedStrings;
400 unsigned NumInputArgStrings;
403 void releaseMemory();
408 InputArgList(
const char*
const *ArgBegin,
const char*
const *ArgEnd);
412 SynthesizedStrings(
std::
move(
RHS.SynthesizedStrings)),
413 NumInputArgStrings(
RHS.NumInputArgStrings) {}
420 NumInputArgStrings =
RHS.NumInputArgStrings;
427 return ArgStrings[
Index];
435 return NumInputArgStrings;
540 #endif // LLVM_OPTION_ARGLIST_H
void AddLastArg(ArgStringList &Output, OptSpecifiers ...Ids) const
Render only the last argument match Id0, if present.
arg_iterator(BaseIter Current, BaseIter End, const OptSpecifier(&Ids)[NumOptSpecifiers ? NumOptSpecifiers :1]={})
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Arg * MakePositionalArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakePositionalArg - Construct a new Positional arg for the given option Id, with the provided Value.
A concrete instance of a particular driver option.
unsigned getNumInputArgStrings() const override
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be th...
Replace within non kernel function use of LDS with pointer
virtual unsigned getNumInputArgStrings() const =0
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be th...
ArgList - Ordered collection of driver arguments.
const_reverse_iterator rbegin() const
Arg * MakeFlagArg(const Arg *BaseArg, const Option Opt) const
MakeFlagArg - Construct a new FlagArg for the given option Id.
void claim() const
Set the Arg claimed bit.
const char * GetOrMakeJoinedArgString(unsigned Index, StringRef LHS, StringRef RHS) const
Create an arg string for (LHS + RHS), reusing the string at Index if possible.
bool hasArgNoClaim(OptSpecifiers ...Ids) const
hasArg - Does the arg list contain any option matching Id.
Arg * getLastArgNoClaim(OptSpecifiers ...Ids) const
Return the last argument matching Id, or null.
void AddAllArgsExcept(ArgStringList &Output, ArrayRef< OptSpecifier > Ids, ArrayRef< OptSpecifier > ExcludeIds) const
AddAllArgsExcept - Render all arguments matching any of the given ids and not matching any of the exc...
const arglist_type & getArgs() const
arg_iterator< arglist_type::const_iterator, N > filtered_iterator
bool hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default) const
hasFlag - Given an option Pos and its negative form Neg, return true if the option is present,...
alloca< 16 x float >, align 16 %tmp2=alloca< 16 x float >, align 16 store< 16 x float > %A,< 16 x float > *%tmp %s=bitcast< 16 x float > *%tmp to i8 *%s2=bitcast< 16 x float > *%tmp2 to i8 *call void @llvm.memcpy.i64(i8 *%s, i8 *%s2, i64 64, i32 16) %R=load< 16 x float > *%tmp2 ret< 16 x float > %R } declare void @llvm.memcpy.i64(i8 *nocapture, i8 *nocapture, i64, i32) nounwind which compiles to:_foo:subl $140, %esp movaps %xmm3, 112(%esp) movaps %xmm2, 96(%esp) movaps %xmm1, 80(%esp) movaps %xmm0, 64(%esp) movl 60(%esp), %eax movl %eax, 124(%esp) movl 56(%esp), %eax movl %eax, 120(%esp) movl 52(%esp), %eax< many many more 32-bit copies > movaps(%esp), %xmm0 movaps 16(%esp), %xmm1 movaps 32(%esp), %xmm2 movaps 48(%esp), %xmm3 addl $140, %esp ret On Nehalem, it may even be cheaper to just use movups when unaligned than to fall back to lower-granularity chunks. Implement processor-specific optimizations for parity with GCC on these processors. GCC does two optimizations:1. ix86_pad_returns inserts a noop before ret instructions if immediately preceded by a conditional branch or is the target of a jump. 2. ix86_avoid_jump_misspredicts inserts noops in cases where a 16-byte block of code contains more than 3 branches. The first one is done for all AMDs, Core2, and "Generic" The second one is done for:Atom, Pentium Pro, all AMDs, Pentium 4, Nocona, Core 2, and "Generic" Testcase:int x(int a) { return(a &0xf0)> >4 tmp
const_reverse_iterator rend() const
typename Traits::value_type value_type
const_iterator end() const
void AddSeparateArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddSeparateArg - Construct a new Positional arg for the given option Id, with the provided Value and ...
arg_iterator operator++(int)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Arg * MakeSeparateArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakeSeparateArg - Construct a new Positional arg for the given option Id, with the provided Value.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
ArgList & operator=(ArgList &&RHS)
This class implements an extremely fast bulk output stream that can only output to a stream.
StringRef getLastArgValue(OptSpecifier Id, StringRef Default="") const
getLastArgValue - Return the value of the last argument, or a default.
std::forward_iterator_tag iterator_category
void eraseArg(OptSpecifier Id)
eraseArg - Remove any option matching Id.
const char * getArgString(unsigned Index) const override
getArgString - Return the input argument string at Index.
OptSpecifier - Wrapper class for abstracting references to option IDs.
void append(Arg *A)
append - Append A to the arg list.
friend bool operator==(arg_iterator LHS, arg_iterator RHS)
iterator_range< filtered_reverse_iterator< sizeof...(OptSpecifiers)> > filtered_reverse(OptSpecifiers ...Ids) const
std::vector< std::string > getAllArgValues(OptSpecifier Id) const
getAllArgValues - Get the values of all instances of the given argument as strings.
arg_iterator< arglist_type::const_reverse_iterator, N > filtered_reverse_iterator
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
void ClaimAllArgs() const
ClaimAllArgs - Claim all arguments.
void AddAllArgValues(ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
AddAllArgValues - Render the argument values of all arguments matching the given ids.
void AddPositionalArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddPositionalArg - Construct a new Positional arg for the given option Id, with the provided Value an...
reverse_iterator rbegin()
static OptSpecifier toOptSpecifier(OptSpecifier S)
DerivedArgList(const InputArgList &BaseArgs)
Construct a new derived arg list from BaseArgs.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
bool hasMultipleArgs(OptSpecifier Id) const
Return true if the arg list contains multiple arguments matching Id.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
arg_iterator & operator++()
StringRef - Represent a constant reference to a string, i.e.
void addOptInFlag(ArgStringList &Output, OptSpecifier Pos, OptSpecifier Neg) const
Given an option Pos and its negative form Neg, render the option if Pos is present.
typename Traits::pointer pointer
void AddJoinedArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddJoinedArg - Construct a new Positional arg for the given option Id, with the provided Value and ap...
virtual const char * MakeArgStringRef(StringRef Str) const =0
Construct a constant string pointer whose lifetime will match that of the ArgList.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
void print(raw_ostream &O) const
void AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0, const char *Translation, bool Joined=false) const
AddAllArgsTranslated - Render all the arguments matching the given ids, but forced to separate args a...
std::ptrdiff_t difference_type
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
friend bool operator!=(arg_iterator LHS, arg_iterator RHS)
Option - Abstract representation for a single form of driver argument.
const InputArgList & getBaseArgs() const
void AddSynthesizedArg(Arg *A)
AddSynthesizedArg - Add a argument to the list of synthesized arguments (to be freed).
void AddAllArgs(ArgStringList &Output, ArrayRef< OptSpecifier > Ids) const
AddAllArgs - Render all arguments matching any of the given ids.
iterator_range< filtered_iterator< sizeof...(OptSpecifiers)> > filtered(OptSpecifiers ...Ids) const
pointer operator->() const
typename Traits::reference reference
arg_iterator - Iterates through arguments stored inside an ArgList.
const char * MakeArgString(const Twine &Str) const
const_iterator begin() const
DerivedArgList - An ordered collection of driver arguments, whose storage may be in another argument ...
A range adaptor for a pair of iterators.
void addOptOutFlag(ArgStringList &Output, OptSpecifier Pos, OptSpecifier Neg) const
Render the option if Neg is present.
bool hasArg(OptSpecifiers ...Ids) const
reference operator*() const
Arg * MakeJoinedArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakeJoinedArg - Construct a new Positional arg for the given option Id, with the provided Value.
LLVM Value Representation.
virtual const char * getArgString(unsigned Index) const =0
getArgString - Return the input argument string at Index.
void AddFlagArg(const Arg *BaseArg, const Option Opt)
AddFlagArg - Construct a new FlagArg for the given option Id and append it to the argument list.
const char * MakeArgStringRef(StringRef Str) const override
Construct a constant string pointer whose lifetime will match that of the ArgList.
Arg * getLastArg(OptSpecifiers ...Ids) const
Return the last argument matching Id, or null.