Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAGISelEmitter not looking up instruction namespace accurately. #1373

Closed
npatil2 opened this issue Nov 11, 2006 · 3 comments
Closed

DAGISelEmitter not looking up instruction namespace accurately. #1373

npatil2 opened this issue Nov 11, 2006 · 3 comments
Labels
bugzilla Issues migrated from bugzilla build-problem tablegen

Comments

@npatil2
Copy link

npatil2 commented Nov 11, 2006

Bugzilla Link 1001
Resolution FIXED
Resolved on Feb 22, 2010 12:53
Version trunk
OS Linux

Extended Description

I was trying to write my own simple LLVM backend for my own simple ISA when I
ran into the following error message:

MCGenDAGISel.inc: In member function
'llvm::SDNode*::MCDAGToDAGISel::SelectCode(llvm::SDOperand)':
MCGenDAGISel.inc:463: error: 'INSTRUCTION_LIST_END' is not a member of
'llvm::TargetInstrInfo'

My target description had only one instruction NOP. The problem disappears when
I change NOP to ADD. In fact anything alphabetically before INLINEASM is
okay. (INLINEASM & PHINODE are in namespace TargetInstrInfo.) I have traced
down the problem to utils/TableGen/DAGISelEmitter.cpp:3390, where we only look
at the first instruction in the list of all instructions. So if there happen to
be no instructions alphabetically before INLINEASM, we get screwed.

Please let me know if you need any more information :)

@lattner
Copy link
Collaborator

lattner commented Nov 12, 2006

This looks like a relatively easy bug to fix, but a hard one for me to test without an example. Can you
propose a patch please?

Thanks,

-Chris

@npatil2
Copy link
Author

npatil2 commented Nov 14, 2006

There's two ways. (I think I'd prefer (a).)

(a) Check for TargetInstrInfo explicitly

--- DAGISelEmitter.cpp 8 Nov 2006 23:01:03 -0000 1.281
+++ DAGISelEmitter.cpp 14 Nov 2006 03:11:13 -0000
@@ -3387,7 +3387,13 @@
}

void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {

  • std::string InstNS = Target.inst_begin()->second.Namespace;
  • std::string InstNS;

  • CodeGenTarget::inst_iterator i;

  • for (i = Target.inst_begin(); i != Target.inst_end(); ++i) {

  • InstNS = i->second.Namespace;

  • if (InstNS != "TargetInstrInfo")

  •   break;
    
  • }
    if (!InstNS.empty()) InstNS += "::";

    // Group the patterns by their top-level opcodes.


(b) Check for INLINEASM & PHI explicitly:

diff -u -r1.281 DAGISelEmitter.cpp
--- DAGISelEmitter.cpp 8 Nov 2006 23:01:03 -0000 1.281
+++ DAGISelEmitter.cpp 14 Nov 2006 03:16:36 -0000
@@ -3387,7 +3387,15 @@
}

void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {

  • std::string InstNS = Target.inst_begin()->second.Namespace;
  • std::string InstNS;

  • CodeGenTarget::inst_iterator i;

  • for (i = Target.inst_begin(); i != Target.inst_end(); ++i) {

  • std::string name = i->second.TheDef->getName();

  • if (name != "INLINEASM" && name != "PHI") {

  •   InstNS = i->second.Namespace;
    
  •   break;
    
  • }

  • }
    if (!InstNS.empty()) InstNS += "::";

    // Group the patterns by their top-level opcodes.


Thanks,

@lattner
Copy link
Collaborator

lattner commented Nov 20, 2006

Option #​1 sounds good to me! Thanks, I applied your patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061120/040138.html

Thanks,

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla build-problem tablegen
Projects
None yet
Development

No branches or pull requests

2 participants