summaryrefslogtreecommitdiff
path: root/llvm/utils/TableGen/AsmWriterInst.cpp
AgeCommit message (Collapse)Author
2024-03-25[RFC][TableGen] Restructure TableGen Source (#80847)Pierre van Houtryve
Refactor of the llvm-tblgen source into: - a "Basic" library, which contains the bare minimum utilities to build `llvm-min-tablegen` - a "Common" library which contains all of the helpers for TableGen backends. Such helpers can be shared by more than one backend, and even unit tested (e.g. CodeExpander is, maybe we can add more over time) Fixes #80647
2024-02-09[NFC] clang-format utils/TableGen (#80973)Pierre van Houtryve
``` find llvm/utils/TableGen -iname "*.h" -o -iname "*.cpp" | xargs clang-format-16 -i ``` Split from #80847
2023-02-17llvm-tblgen: Apply IWYU partiallyNAKAMURA Takumi
2022-03-11Cleanup include: TableGenserge-sans-paille
This also includes a few cleanup from Support. Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D121331
2021-11-22Use std::string::substr (NFC)Kazu Hirata
2021-01-22[llvm] Use isAlpha/isAlnum (NFC)Kazu Hirata
2020-03-26[MCInstPrinter] Pass `Address` parameter to MCOI::OPERAND_PCREL typed ↵Fangrui Song
operands. NFC Follow-up of D72172 and D72180 This patch passes `uint64_t Address` to print methods of PC-relative operands so that subsequent target specific patches can change `*InstPrinter::print{Operand,PCRelImm,...}` to customize the output. Add MCInstPrinter::PrintBranchImmAsAddress which is set to true by llvm-objdump. ``` // Current llvm-objdump -d output aarch64: 20000: bl #0 ppc: 20000: bl .+4 x86: 20000: callq 0 // Ideal output aarch64: 20000: bl 0x20000 ppc: 20000: bl 0x20004 x86: 20000: callq 0x20005 // GNU objdump -d. The lack of 0x is not ideal because the result cannot be re-assembled aarch64: 20000: bl 20000 ppc: 20000: bl 0x20004 x86: 20000: callq 20005 ``` In `lib/Target/X86/X86GenAsmWriter1.inc` (generated by `llvm-tblgen -gen-asm-writer`): ``` case 12: // CALL64pcrel32, CALLpcrel16, CALLpcrel32, EH_SjLj_Setup, JCXZ, JECXZ, J... - printPCRelImm(MI, 0, O); + printPCRelImm(MI, Address, 0, O); return; ``` Some targets have 2 `printOperand` overloads, one without `Address` and one with `Address`. They should annotate derived `Operand` properly with `let OperandType = "OPERAND_PCREL"`. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D76574
2019-02-12[tablegen] Add locations to many PrintFatalError() callsDaniel Sanders
Summary: While working on the GISel Combiner, I noticed I was producing location-less error messages fairly often and set about fixing this. In the process, I noticed quite a few places elsewhere in TableGen that also neglected to include a relevant location. This patch adds locations to errors that relate to a specific record (or a field within it) and also have easy access to the relevant location. This is particularly useful when multiclasses are involved as many of these errors refer to the full name of a record and it's difficult to guess which substring is grep-able. Unfortunately, tablegen currently only supports Record granularity so it's not currently possible to point at a specific Init so these sometimes point at the record that caused the error rather than the precise origin of the error. Reviewers: bogner, aditya_nandakumar, volkan, aemerson, paquette, nhaehnle Reviewed By: nhaehnle Subscribers: jdoerfert, nhaehnle, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58077 llvm-svn: 353862
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2016-01-22[TableGen] Remove the CGIOpNo from AsmWriterOperand as its not used for ↵Craig Topper
anything. NFC llvm-svn: 258488
2016-01-17[TableGen] Use a StringRef instead of creating a new std::string. It gets ↵Craig Topper
passed to a function that takes a StringRef anyway. NFC llvm-svn: 258007
2016-01-17[TableGen] Changes to AsmWriterEmitter to remove the CodeGenInstruction to ↵Craig Topper
AsmWriterInst map. NFC Adds the corresponding CodeGenInstruction number to each AsmWriterInst. Then write all the operand uniqueing loops using the AsmWriterInst array and indices. Then use the CodeGenInstruction index to fill out the OpCodeInfo array. llvm-svn: 258005
2016-01-14[TableGen] Pass PassSubtarget flag into getCode instead of storing a copy of ↵Craig Topper
the flag in every AsmWriterOperand. NFC llvm-svn: 257743
2016-01-11[TableGen] Remove a few spaces from AsmMatcher output. NFCCraig Topper
llvm-svn: 257308
2015-05-29Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer
If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238602
2015-03-27[MCInstPrinter] Enable MCInstPrinter to change its behavior based on theAkira Hatanaka
per-function subtarget. Currently, code-gen passes the default or generic subtarget to the constructors of MCInstPrinter subclasses (see LLVMTargetMachine::addPassesToEmitFile), which enables some targets (AArch64, ARM, and X86) to change their instprinter's behavior based on the subtarget feature bits. Since the backend can now use different subtargets for each function, instprinter has to be changed to use the per-function subtarget rather than the default subtarget. This patch takes the first step towards enabling instprinter to change its behavior based on the per-function subtarget. It adds a bit "PassSubtarget" to AsmWriter which tells table-gen to pass a reference to MCSubtargetInfo to the various print methods table-gen auto-generates. I will follow up with changes to instprinters of AArch64, ARM, and X86. llvm-svn: 233411
2014-11-25Remove dead code.Craig Topper
llvm-svn: 222781
2013-12-02Remove dead code.Rafael Espindola
llvm-svn: 196066
2013-07-23Remove 'else' after 'return'. No functional change.Craig Topper
llvm-svn: 186929
2013-07-23Remove trailing whitespace.Craig Topper
llvm-svn: 186928
2012-10-25Remove exception handling usage from tblgen.Joerg Sonnenberger
Most places can use PrintFatalError as the unwinding mechanism was not used for anything other than printing the error. The single exception was CodeGenDAGPatterns.cpp, where intermediate errors during type resolution were ignored to simplify incremental platform development. This use is replaced by an error flag in TreePattern and bailout earlier in various places if it is set. llvm-svn: 166712
2011-10-01Move TableGen's parser and entry point into a libraryPeter Collingbourne
This is the first step towards splitting LLVM and Clang's tblgen executables. llvm-svn: 140951
2010-11-01factor the operand list (and related fields/operations) out of Chris Lattner
CodeGenInstruction into its own helper class. No functionality change. llvm-svn: 117893
2010-11-01move FlattenVariants out of AsmMatcherEmitter into a sharedChris Lattner
CodeGenInstruction::FlattenAsmStringVariants method. Use it to simplify the code in AsmWriterInst, which now no longer needs to worry about variants. llvm-svn: 117886
2010-04-04change a ton of code to not implicitly use the "O" raw_ostreamChris Lattner
member of AsmPrinter. Instead, pass it in explicitly. llvm-svn: 100306
2010-02-10Changed AsmWriterOperand to also include the index of theSean Callanan
operand into the CodeGenInstruction's list of operands, which is useful for EDEmitter. (Still working on PR6219) llvm-svn: 95759
2010-02-09Fixed some indentation in the AsmWriterInstSean Callanan
implementation. Also changed the constructor so that it does not require a Record, making it usable by the EDEmitter. llvm-svn: 95715
2010-02-09Per PR 6219, factored AsmWriterInst and AsmWriterOperandSean Callanan
out of the AsmWriterEmitter. This patch does the physical code movement, but leaves the implementation unchanged. I'll make any changes necessary to generalize the code in a separate patch. llvm-svn: 95697