search for: stringswitch

Displaying 20 results from an estimated 41 matches for "stringswitch".

2016 Feb 05
4
StringSwitch class
Hi: I have a question about the llvm StringSwitch class. Why is this more efficient than comparing the hashes of the strings or just using a bunch of if statements. Anupama -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160205/9be0fcc8/attachment.html>
2016 Feb 08
2
StringSwitch class
...gt; On Feb 5, 2016, at 4:42 PM, Mehdi Amini via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > >> On Feb 5, 2016, at 2:43 PM, Anupama Chandrasekhar via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hi: >> >> I have a question about the llvm StringSwitch class. Why is this more efficient than comparing the hashes of the strings or just using a bunch of if statements. > > I don't know about hashes performance (comparing a small string is probably more efficient than comparing hashes, and I'd be reluctant to collisions anyway). Now sin...
2016 Feb 10
2
StringSwitch class
Sorry for belaboring on a possibly minor point here, but is my understanding correct that even assuming that the case function is always inlined so we don't have extra function call overhead, we have the redundant if (!Result) checks when we use StringSwitch as opposed to a bunch of if- elses. Thanks. On Mon, Feb 8, 2016 at 12:00 PM, Anupama Chandrasekhar < anupama.lists at gmail.com> wrote: > The point I was wondering about is, say in the example, say the input > string is "de" > > int i = StringSwitch<int>("d...
2011 Jul 21
4
[LLVMdev] Correct use of StringRef and Twine
...imized - so perhaps this is the "right way" to write this code. [diff attached] So then here's another example (can't find the exact piece of code I had been working on, but taking tools/clang/lib/Basic/Targets.cpp::getCPUDefineSuffix as an example anyway - just something using a StringSwitch, really). If this function were to take a const Twine& and pass it along to StringSwitch, ultimately StringSwitch (being the sink for the Twine - the code needing to read the individual character elements) would be responsible for allocating a temporary SmallVectorImpl, passing that in, getting...
2011 Jul 22
0
[LLVMdev] Correct use of StringRef and Twine
...n fill in the bytes. I don't know if Twine does that yet though. > So then here's another example (can't find the exact piece of code I > had been working on, but taking > tools/clang/lib/Basic/Targets.cpp::getCPUDefineSuffix as an example > anyway - just something using a StringSwitch, really). If this > function were to take a const Twine& and pass it along to > StringSwitch, ultimately StringSwitch (being the sink for the Twine - > the code needing to read the individual character elements) would be > responsible for allocating a temporary SmallVectorImpl, pass...
2016 May 30
0
[cfe-dev] How to debug if LTO generate wrong code?
...-linux-gnu/5.3.1/../../../../include/c++/5.3.1/bits/stringfwd.h:74:33: note: 'std::string' declared here > typedef basic_string<char> string; > ^ > /home/jshi19/llvm-3.8.0.src/tools/gold/gold-plugin.cpp:800:9: error: no template named 'StringSwitch' in namespace 'llvm'; did you mean 'StringSet'? > llvm::StringSwitch<unsigned>(LTOCodeModel) > ~~~~~~^~~~~~~~~~~~ > StringSet > /home/jshi19/llvm-3.8.0.src/include/llvm/ADT/StringSet.h:23:9: note: 'StringSet' declared here > class Strin...
2014 Mar 18
2
[LLVMdev] TableGen docs
On 18 March 2014 12:54, Aaron Ballman <aaron at aaronballman.com> wrote: > Would it also make sense to include the clang usages of tablegen > somewhere in #1, and then perhaps have #2.5 about clang usages (not > volunteering you for that work btw)? Diagnostics and attributes make > heavy use of tablegen in clang, for instance. I meant to ask about this... Clang has a huge list
2017 May 27
6
Should we split llvm Support and ADT?
...Vector.h" #include "llvm/ADT/SparseBitVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/TinyPtrVector.h" #include "llvm/ADT/Twine.h" Is this something worth putting effort into? If so, I volunteer. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20...
2016 May 30
0
[cfe-dev] How to debug if LTO generate wrong code?
.../lib/gcc/x86_64-linux-gnu/5.3.1/../../../../include/c++/5.3.1/bits/stringfwd.h:74:33: note: 'std::string' declared here typedef basic_string<char> string; ^ /home/jshi19/llvm-3.8.0.src/tools/gold/gold-plugin.cpp:800:9: error: no template named 'StringSwitch' in namespace 'llvm'; did you mean 'StringSet'? llvm::StringSwitch<unsigned>(LTOCodeModel) ~~~~~~^~~~~~~~~~~~ StringSet /home/jshi19/llvm-3.8.0.src/include/llvm/ADT/StringSet.h:23:9: note: 'StringSet' declared here class StringSet : public llvm::Strin...
2016 May 09
2
LLVM issuse:AArch64 TargetParser
Hi all, Actually,I found there is a same problem for arm.For this case,I think > maybe we can play a trick in the clang. > Checking whether the given arch valid or not,before we throw it to the > parser,which can be used for both arm > and aarch64. For the actions I mentioned above,I wrote a check function as below, basing on the naming rules of the arm architecture. +//Only if
2016 Oct 14
2
creating an .init section
Hi, I would like to create an .init section in the LLVM backend. Can anyone shed me the light on how to do it? Do I have to create it in the clang? Thanks, Jin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161014/4f262397/attachment.html>
2011 Jul 19
0
[LLVMdev] Correct use of StringRef and Twine
On Jul 18, 2011, at 12:38 PM, David Blaikie wrote: > I'm attempting to do some amount of mass migration from const std::string& (& const char*) to StringRef. Great! > In doing so I stumbled across the fact that while StringRef has no op+ to speak of (well, it has += and I added a manual StringRef+std::string and std::string+StringRef for now - though I'm thinking perhaps
2010 May 12
0
[LLVMdev] MC ELF support
...e you extra target dependent fields if need be. This enforces layering between the parts CodeGen can access and the parts that are private to the assembler backend. On 0003: - Might as well merge this with 0002. On 0004: - This looks good, might as well bring it in first. - You could use ADT/StringSwitch for this sequence, if you like: -- + if (Type.equals(StringRef("function"))) { + Attr = MCSA_ELF_TypeFunction; + } else if (Type.equals(StringRef("object"))) { + Attr = MCSA_ELF_TypeObject; -- I recommend optimizing for getting the obvious parts or stub implementations...
2011 Jul 18
3
[LLVMdev] Correct use of StringRef and Twine
I'm attempting to do some amount of mass migration from const std::string& (& const char*) to StringRef. In doing so I stumbled across the fact that while StringRef has no op+ to speak of (well, it has += and I added a manual StringRef+std::string and std::string+StringRef for now - though I'm thinking perhaps they can be skipped in favor of Twine operations), Twine does provide a
2016 May 30
2
[cfe-dev] How to debug if LTO generate wrong code?
Hi Steven, > On May 29, 2016, at 11:28 PM, Shi, Steven <steven.shi at intel.com> wrote: > > Hi Mehdi, > Should I apply your attached patch on my llvm3.8 source firstly? Or should I use the latest llvm SVN trunk instead? I wrote it on trunk, but I expect it to be fairly easy to port on 3.8. This is really just quickly plumbing an option on the TargetMachine creation. --
2010 May 11
2
[LLVMdev] MC ELF support
Hi guys, attached are a couple of work in progress patches for ELF support in the MC module. I'm sending this email to gather some general feedback on the code. Applying these patches doesn't get you a fully working llvm-mc that understands ELF; it's just the ground work. I've got a couple more small patches that fixup some places that assume Mach-O object format which I'll
2016 Oct 08
3
RFC: Implement variable-sized register classes
...ely related to variable-sized register classes is the case where you have multiple registers with the same AsmName. This crops up in the same kind of cases where you have multiple instructions with the same encoding. Without a workaround, an assert is tripped in llvm-tblgen when trying to produce a StringSwitch for MatchRegisterName. The solution in Mips, PPC and others seems to be involve the generation of MatchRegisterName. What has been discussed so far with regards to HwMode and variable-size register classes points to a solution, but I don't think it's quite enough. Options include: 1. Only...
2017 May 27
4
Should we split llvm Support and ADT?
....h" >> #include "llvm/ADT/Statistic.h" >> #include "llvm/ADT/StringExtras.h" >> #include "llvm/ADT/StringMap.h" >> #include "llvm/ADT/StringRef.h" >> #include "llvm/ADT/StringSet.h" >> #include "llvm/ADT/StringSwitch.h" >> #include "llvm/ADT/TinyPtrVector.h" >> #include "llvm/ADT/Twine.h" >> >> >> Is this something worth putting effort into? If so, I volunteer. >> >> >> >> _______________________________________________ >> LLV...
2018 May 14
1
Unable to build 'lld' on Mac OS 10.9
... class StringLiteral : public StringRef {         ^ /testlocation/llvm_lld/llvm-stable/include/llvm/ADT/StringRef.h:864:15:note: candidate disabled: invalid string literal    constexpr StringLiteral(const char (&Str)[N])               ^ /testlocation/llvm_lld/llvm-stable/include/llvm/ADT/StringSwitch.h:70:36:note: passing argument to parameter 'S' here  StringSwitch &Case(StringLiteral S, T Value) {                                    ^ 1 error generated. make[2]: ***[lib/Support/CMakeFiles/LLVMSupport.dir/AMDGPUMetadata.cpp.o] Error 1 make[1]: ***[lib/Support/CMakeFiles/LLVMSup...
2017 May 27
3
Should we split llvm Support and ADT?
...T/Statistic.h" >>>> #include "llvm/ADT/StringExtras.h" >>>> #include "llvm/ADT/StringMap.h" >>>> #include "llvm/ADT/StringRef.h" >>>> #include "llvm/ADT/StringSet.h" >>>> #include "llvm/ADT/StringSwitch.h" >>>> #include "llvm/ADT/TinyPtrVector.h" >>>> #include "llvm/ADT/Twine.h" >>>> >>>> >>>> Is this something worth putting effort into? If so, I volunteer. >>>> >>>> >>>> >&...