Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6976797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:32:35+00:00 2026-05-27T17:32:35+00:00

I am writing an optimization for my compiler and I use LLVM IR as

  • 0

I am writing an optimization for my compiler and I use LLVM IR as my Intermediate Language. I have parsed the input file and converted it to LLVM IR. During optimization, I need to retrieve the operands of the instructions. I am able to find getOpCode() in the Instruction class, but unable to retrieve the operand list. How do I go about that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:32:35+00:00Added an answer on May 27, 2026 at 5:32 pm

    There are lots of operand accessors, usually provided by the class llvm::User, whose doxygen page is: http://llvm.org/doxygen/classllvm_1_1User.html There’s getNumOperands() and getOperand(unsigned int), as well as iterator-style accessors op_begin() and op_end().

    For example, given Instruction %X = add i32 %a, 2, I->getOperand(0) will return the Value* for %a, and I->getOperand(1) will return the Value* for i32 2 (castable to ConstantInt).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing Objective-C code with LLVM. I have one file full of very performance-critical
I am writing some hash functions for a compiler and I use the __int64
So lately I have been working on writing a simple compiler to better understand
I am writing a jQuery plugin and I am at the optimization stage. I
When writing application code, it's generally accepted that premature micro -optimization is evil, and
Writing a test app to emulate PIO lines, I have a very simple Python/Tk
I am writing a library for efficient number processing. I have to support different
I a writing a Simulation program and wondering if the use of const double
I'm currently writing a toy compiler targeting Java bytecode in the translation. I would
In a programme I am writing, I have to pass large data structures (images)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.